Read time: 4 minutes
SQL Server backup is done using different methods like T-SQL Code, SQL Server Management Studio, or using a third-party tool. The purpose of taking a backup of the database is to combat and reduce the chances of embarrassment during corruption, damage, crashing, etc., of the database or in case you wish to migrate the database or to create a copy of the database or other requirements.
Things to Be Taken Care of Before SQL Backup Restoration
Before you start the process of restoring database backup, you need to take care of a few things which are given under:
- Keep database backup ready.
- Keep the file location handy.
- You should have permission to access the file/directory.
- There should be no corruption of the backup file.
- The disk containing the backup file should be healthy.
- The version of the database should not be higher than the version of the SQL Server.
Methods to Restore Database Backup In SQL Server 2012
These methods can be used if you had taken care to backup your SQL Server database.
Method 1: Using Enterprise Manager in SQL Server 2012
Follow the steps given under to restore database backup in SQL Server 2012
- Start SQL Server 2012.
- Expand the database and select database right-click on it.
- Select Tasks > Restore > Database. The Restore dialog box will open.
- Select the database from the list under Source.
- Select the database from the list under Destination.
- Select the date of the database by clicking on Timeline. This will open a new dialog box.
- Select either the Last backup taken or Specific date and time. Press OK
- Select Files (on the left) and check to Relocate all files to folder.
- Select options (just below Files on the left).
- Select options viz. Restore options, Tail-Log backup, Server connections, Prompt as per need. Press OK.
- This will start Restoring files; once it is completed, a message will show that the database has been restored successfully.
Method 2: Using SQL Server Management Studio
- Start SQL Server Management Studio (SSMS).
- Connect SSMS to that SQL Instance to which you will restore the backup.
- Under Object Explorer, right-click Databases.
- Select Restore Database. This will open a new dialog box.
- Under Source, select required Database (you can select it from the drop-down list)
- Under Destination, select Database to be restored.
- Under Restore, you have 2 options shown to restore the backup database, viz. Last backup taken or Select a specific date and time. Choose the desired option. Press OK
- Now Select ‘Files’ on the left pane. Check Relocate all files to folder to Restore database files by selecting the desired specified folders. You may rename the database files as well.
- Press Options on the left, below Files. Under Restore Options on the right, select any options as per your need.
- Select the desired option for Recovery State viz.:
- RESTORE WITH RECOVERY
This default behavior rolls back the uncommitted transactions, and thus the database can be used readily. It does not restore additional transaction logs. You should select this option if you want to restore all the necessary backups instantly.
- RESTORE WITH NONRECOVERY
This does not roll back the uncommitted transactions, and the database is non-operational. It restores additional transaction logs. The database can only be used after recovery.
- RESTORE WITH STANDBY
It renders the database in read-only mode, and uncommitted transactions are undone. To enable recovery effects, it saves the undo actions in a standby file.
NOTE: Do remember to check Close existing connections to close all active connections between SQL Server Management Studio and the database, or else it will render Restore Operations fail.
- Click OK if you wish to restore the database. Once the restore is successful, a message box will display it.
We hope that you found this write-up helpful in restoring database backup in SQL Server 2012. Above mentioned methods will not work in case the backup is inaccessible, corrupt, damaged, or lost. In such scenarios, you need a powerful and efficient third-party tool like Kernel SQL Backup Recovery, which can recover data from corrupted SQL backup files; it supports the recovery from all SQL Server versions, maintaining the integrity of data. In case you encounter any scenario of corruption of SQL backup, then also you need the help of the SQL Backup Recovery tool