Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

need to delete the datbase and then restore of the different backup on daily bases Expand / Collapse
Author
Message
Posted Wednesday, July 3, 2013 6:40 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 10:30 AM
Points: 238, Visits: 317
Good Morning I would appreciate if I can get a syntax to run, this is what I need to accomplish,

Delete the database, (it gives me error with connections open)

Once it is deleted I want to restore it of .bak file,

Help is much appreciated,

Regards,

Bubby
Post #1470018
Posted Wednesday, July 3, 2013 6:59 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, September 22, 2014 4:37 AM
Points: 1,379, Visits: 2,688
Why are you deleting the database before restoring it?

You can restore with replace, which will overwrite the entire database
Post #1470030
Posted Wednesday, July 3, 2013 7:06 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 10:30 AM
Points: 238, Visits: 317
Can I get the syntax for that, it makes sense
Post #1470034
Posted Wednesday, July 3, 2013 7:16 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, September 22, 2014 4:37 AM
Points: 1,379, Visits: 2,688

restore database [db_name] from disk = 'location\.bak' with replace
Post #1470042
Posted Wednesday, July 3, 2013 7:20 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 10:30 AM
Points: 238, Visits: 317
Please do not worry, thanks anyways, I did the task as below,

RESTORE DATABASE XYZ FROM DISK = 'C:\XYZ.BAK'
WITH REPLACE
GO
Post #1470044
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse