How to recover the database in MS SQL Server
Simply put, this is the process of retrieving the backup file and returning it to the database.
Recovery is the process of copying backed up data and putting recorded transactions into MS SQL Server data. Simply put, this is the process of retrieving the backup file and returning it to the database.
Database recovery can be done in two ways.
Method 1: Use T-SQL
The following syntax is used to restore databases.
Restore database from disk = ''
For example
The following command is used to restore the database named TestDB with a backup file named TestDB_Full.bak located at address D: if you choose to overwrite the current database.
Restore database TestDB from disk = ' D:TestDB_Full.bak' with replace
If you create a new database using this recovery command and there is no path or file to record history on the server above, use the command below. Make sure the path D: Data exists .
RESTORE DATABASE TestDB FROM DISK = 'D: TestDB_Full.bak' WITH MOVE 'TestDB' TO 'D:DataTestDB.mdf', MOVE 'TestDB_Log' TO 'D:DataTestDB_Log.ldf'
Method 2: Use SQL Server Management Studio SSMS
Step 1 : Connect to the database named TESTINSTANCE and right click on the folder, select Restore Database to appear as shown below.
Restore the database by selecting after right clicking
Step 2 : Select Device and select the path to open the backup file as shown below.
Find the place where the backup file was saved when you created it before
Step 3 : Click OK and the screen below will appear.
Select the recovery database and the previously created backup file
Step 4 : Select Files in the left corner of the screen, the following dialog box will appear.
File information for database recovery process
Step 5 : Select Options in the left corner and click OK to start restoring TestDB database as shown in the picture below.
Successfully restored TestDB database
Previous article: How to create a copy of data in MS SQL Server
The following article: How to create users in MS SQL Server
You should read it
- Learn about Mailbox Recovery Exchange 2010
- Database monitoring in MS SQL Server
- Use the ALTER DATABASE command to migrate DATABASE in SQL Server
- What is MS SQL Server?
- SQL Server setup is always available
- Network basics: Part 3 - DNS Server
- Create Active Directory accounts from the Exchange database (Part 1)
- Ways to log in database on MS SQL Server
- Learn about the role concept in SQL Server
- Save your database with Recovery Toolbox for MySQL
- Compare the performance of MongoDB and SQL Server 2008
- How to Set Up a Microsoft SQL Server Database in Docker on Linux