How to Restart an Interrupted SQL Server Database Restore
The RESTORE DATABASE…WITH RESTART command is a very useful command which is available in SQL Server 2005 and higher versions. A Database Administrator can use this command to finish restoring an interrupted database restore operation.In the below snippet you can see that ProductDB is in a (Restoring…) state once the SQL Server came online after the unexpected failure.
During such scenarios one can execute the RESTORE DATABASE…WITH RESTART command to successfully complete the database restore operation.
Below are two commands. The first gets a list of the backups on the file and the second does the actual restore with the restart option.
-- get backup information from backup file
RESTORE FILELISTONLY FROM DISK ='C:\DBBackups\ProductDB.bak' GO
-- restore the database
RESTORE DATABASE ProductDB FROM DISK ='C:\DBBackups\ProductDB.bak' WITH RESTART GO


No comments:
Post a Comment