MS SQL Server - Database Restore
Ms sql server
MS SQL Server - Restoring databases
Restoring is the process of copying data from a saving and applying recorded transactions to data. Restore is what you do with backups. Take the backup file and convert it back to a database.
The Restore Database option can be performed using one of the following two methods.
Method 1 - T-SQL
Restore database from from disk = ' '
The following command is used to restore the database called 'TestDB ' with the Backup file name 'TestDB_Full.bak ' which is available in location 'D: ' if you overwrite the existing database.
Restoreer TestDB database from disk = 'D: TestDB_Full.bak ' with replace
If you create a new database with this restore command and there is no similar data path, log files in the target server, and then use the move option like the following command.
Make sure that the D: data path exists as used in the following command for data and log files.
RESTORE DATABASE TestDB FROM DISK = 'D: TestDB_Full.bak ' WITH MOVE 'TestDB ' TO 'D: Data TestDB.mdf ', MOVE 'TestDB_Log ' TO 'D: Data TestDB_Log.ldf '
Method 2 - SSMS (SQL SERVER Management Studio)
Step 1 - Connect to the DB instance named 'TESTINSTANCE ' and right click on the Databases folder. Click Restore Database as shown in the following snapshot.
Step 2 - Select the device radio button and click on ellipse to select the backup file as shown in the following snapshot.
Step 3 - Click OK and the following screen appears.
Step 4 - Select the Files option which is in the upper left corner as shown in the following snapshot.
Step 5 - Select Options which is in the upper left corner and click OK to rerestore the 'TestDB ' database as shown in the following snapshot.