Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automated restore process

Status
Not open for further replies.

mutley1

MIS
Jul 24, 2003
909
I have a script that reads the msdb database and compiles the T-SQL for a restore to the last backup (using full / diffs and tran logs). I think many of you would have seen it around - it's Glen Larsen's one kindly posted on databasejournal.com. Quick question (having a blonde moment) - but why does the differential backup have a "replace" command in there?

Cheers,

M.

Code:
RESTORE DATABASE MYDATABASE
 from disk =
'C:\MYDATABASE\MYDATABASE_FULL_24_Nov_2006_114913.bak'
 WITH
REPLACE, NORECOVERY
go
 
RESTORE DATABASE MYDATABASE
 from disk =
'C:\MYDATABASE\MYDATABASE_DIFF_27_Nov_2006_0945.bak'
 WITH REPLACE,
NORECOVERY
go
 
RESTORE LOG MYDATABASE
 FROM DISK =
'C:\MYDATABASE\MYDATABASE_Log_BackUp_27_Nov_2006_094502.bak'
 WITH
NORECOVERY
go
 
RESTORE LOG MYDATABASE
 FROM DISK =
'C:\MYDATABASE\MYDATABASE_Log_BackUp_27_Nov_2006_095000.bak'
 WITH
RECOVERY
go
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top