Data Protection
  Home Download  | Login
 
How can I restore a SQL Server database?
Previous Top Next

The procedure depends on whether you were backing up your database using the simple recovery model or another recovery model. If you were using the simple recovery model and volume shadow copy service (the default database backup procedure for Data Protection) then follow these procedures:

1.   Use the file manager to select the database files (*.mdf and *.ldf) you want to restore.
2.   On the Restore Data: Options screen, choose to restore the files to a folder that is different from the folder containing your existing database files. Please choose a location that is on a local hard disk (SQL Server will not attach databases on network storage)
3.   Be sure not to overwrite any existing files when performing the restore.
4.   Follow the steps in the wizard to finish the restore process.
5.   Login as the database administrator and open a SQL command window.
6.   For each database your need to restore, perform the following SQL commands:

use master
go
sp_detach_db 'databasename'
go
sp_attach_db 'databasename' 'path to mdf file' 'path to ldf file'
go

7.   After you have verified all data was restored successfully, you may delete the old mdf and ldf files.

If you only need to perform partial recovery of a database, then follow this procedure:

1.   Restore the mdf and ldf files following steps 1 - 4 from above.
2.   Login as the database administrator and open a SQL command window.
3.   For each database you need to extract information from, perform the following SQL commands:

use master
go
sp_attach_db 'temp_databasename' 'path to mdf file' 'path to ldf file'
go
(use SQL commands or other tools to copy data you want to restore from temp_databasename to the live database)
sp_detach_db 'temp_databasename'
go

4.   After you have restored all the data you need you may delete the downloaded mdf and ldf files.

If Data Protection was not backing up the mdf and ldf files directly but was rather backing up SQL Server backup files, then please restore the SQL Server backup files and follow the restore procedures found here.