How to recover the database in MS SQL Server
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
- 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
May be interested
- Compare the performance of MongoDB and SQL Server 2008in the following article, we will point out the difference in performance of the relatively new database management system, which is mongodb and one of the popular systems like sql server (mysql or oracle). most of the data is given here in the form of charts, so we can easily imagine the advantages and disadvantages of mongodb as well as other database management systems.
- Microsoft Windows PowerShell and SQL Server 2005 SMO - Part 10in part 10, i will show you how to use powershell scripts in conjunction with smo and parameters to create sql server scripts. creating sql server scripts is an important task for administrators and sql server database development professionals.
- Use and manage Database Mailsql server 2005 has a small mail system called database mail. as an improved feature in sql mail compared to earlier versions of sql server, database mail is a mail queue system. email messages are stored in an internal queue
- Restore SQL Server from Transaction Logtransaction log (also known as database log or binary log) is an action history that is executed by the database system to ensure acid properties when the system fails.
- How to install SQL Server databaseone of the most important things you must do in sql server 2008 is to install data and log files
- How to create users in MS SQL Serverthe user here is an account on ms sql server to access the database (database).
- Upload multiple XML files into XML data type columnssql server database administrators often have some needs such as importing multiple files into a table in the database. this article will discuss how to upload multiple files (especially xml files) into the xml data column of the sql server database.
- Attach database in Microsoft SQL Server 2008this article will illustrate the different usage methods of the 'for attach' clause to overcome the limitations encountered when using sp_attach_db and sp_attach_single_file_db.
- The difference between Truncate and Delete in Microsoft SQL Serverin the following article, we will help you distinguish some basic differences between two delete syntax and truncate table in microsoft sql server application. basically, both of these statements help us to remove the data, but in essence it is not so.
- SQL Server 2008 SP2 has new SharePoint integrationssql server 2008 sp2 also updates for reporting and management tools, supporting up to 15,000 database (partition) partitions.