Script to restore SQL Server database

A lot of people know how to restore an SQL Server database using the SQL Server Management Studio. Sometime it will not work if the database is in use. You have to close all active connections or even to take database offline and then online again.

It is much easier to restore the database via the attached script. Just unzip the file to a folder called C:\RestoreDB and copy the backup file to the same folder. Then edit RestoreDB.bat file and update it with the appropriate information – server name, user name, password, backup name, etc.

The last step is to run RestoreDB.bat – you can double-click it in Windows explorer or can oped a DOS prompt change the folder to C:\RestoreDB and run the script by typing its name and pressing “Enter” key.

RestoreDB_Script

Leave a Reply