How to Restore Database from Snapshot in SQL Server Step by Step?

Written By Andrew Jackson
Anuraag Singh
Approved By Anuraag Singh
Published On December 8th, 2023
Reading Time 7 Minutes Reading

restore database from snapshot

Synopsis: Damage or corruption in SQL database is not a new thing to SQL users & DBAs. Therefore, this article is going to help users restore database from snapshot created using T-SQL command in the SQL Server. Along with the manual method, the automated solution is also given below. Most importantly, the critical causes why users need to take a snapshot of the entire database are mentioned as well. Reading the entire article can help users get the perfect solution.

Aren’t Familiar with Database Snapshots – Well, It is a feature available in the SQL Server databases that significantly help users in executing the point-in-time recovery for the database from the source. A snapshot captures the current state of the database. Therefore, if users execute any command that might go wrong or result in any sort of data loss or corruption, users can restore it with the DML operation. Basically, it’s like a mini task for backup and restore database in SQL DB.

Why Restore Database from Snapshot in SQL Server?

The major reason is restoring the database that is now inaccessible or having issues. However, if we dive deeper, we can find some of the most common causes mentioned below:

  • Data recovery – Accidental Data loss, corruption in the MDF files, etc are the major reasons for the data recovery using this snapshot restoring method.
  • Point-in-Time Recovery – As we know a snapshot captures a point-in-time view of the database. Thus, if users want to restore a specific state of the SQL database, they can simply use this method.
  • Testing and Development – SQL restore database from snapshot is helpful for testing & development purposes of SQL Server. It even helps to find out the database loopholes.
  • Performance Analysis – This restoring technique helps in analyzing the performance of the database after tests & changes. In case the changes impact the database negatively, we can revert them using this method.
  • Minimize Downtime – It is one of the best fail-safe mechanisms for sure. It can help reduce the downtime of the server. If anything goes wrong during any updates, restoring it is an easy task.

Restore Database from Snapshot T-SQL Manually

Now, we’re going to explain the manual task to users. This is why, what we are going to do is just use the T-SQL queries to simply create a snapshot. Then make changes to the original database as an act of data loss. Furthermore, we can proceed with the restoring process using the snapshot we created.

There are a total of three steps present for users in order to execute the entire manual task. However, there are sub-steps present here which makes this process a bit time-consuming. Still, we are going to explain all of it quite conveniently to learn how to restore database from snapshot in SQL Server without any errors.

Step-1. Create A Snapshot of the Database

Now, first of all, users need to execute the T-SQL query to create a database snapshot & save it in the system. Therefore, the command syntax for the same is:

CREATE DATABASE Test_Database_dbss ON
( NAME = Test_Database, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\')
AS SNAPSHOT OF Test_Database;


  • Test_Database = The name of the original database.
  • Test_Database_dbss = The name of the snapshot.

Make sure to change the names as per your preferred database & snapshot names.

After executing this command, users will get a result page like this:

Run command

After that simply refresh the snapshots folder.

refresh database

Then users can see a snapshot they just created after refreshing the folder.

database snapshot

Step-2. Delete or Make Changes in the Original Database

Now, we need to make changes to the original database to mimic data loss or corruption. The only we can proceed further to restore database from snapshot T-SQL way.

For this, we need to simply use the SQL Server Management Studio or SSMS. Launch SSMS & follow the below steps to get the perfect solution:

  • Select Table from the database >> Right-click and Click on the Delete button.
  • Click OK on the delete prompt window now.
  • Right-click on the Tables Folder >> Hit the Refresh option.
  • Table is deleted from the database, Check for it in the Snapshot now.

Now, we need to move toward our last in this process to restore what’s lost.

Step-3. Restore Database from Snapshot Created

Now, users need to run the below-mentioned command to simply restore their database deleted items.

USE master;
DATABASE_SNAPSHOT = 'Test_Database_dbss';

After running this command, users can see the results as mentioned in the below image.


Now, simply refresh the original database to check if the file is recovered or not.

Best Alternative to the Manual T-SQL Method

In case, users do not like the manual solution due to the complex solution, they can always trust the advanced automated solution. SysTools SQL Recovery Tool is one of the most advanced solutions in the industry for restoring a damaged or even corrupted SQL Database. Learning how to restore database from snapshot T-SQL is easy but learning with automated tool is even easier. Download the software & follow the steps mentioned below:

Download now Purchase Now

Step 1. Install and then Open the Software in the system.

Launch tool

Step 2. Add MDF Files by clicking on the Open button.

add MDF

Step 3. Now, Select from Quick or Advanced Scan modes.

quick or advanced scan

Step 4. Enter Destination and Set All DB Objects to repair.

enter database

Step 5. Hit the Export or Save button to Finish this operation.

click export

Also Read: How to Restore SQL Server Database from BAK File without Errors

The Final Say

Finally. After going to all of the methods available, users can easily restore database from snapshot in SQL Server. Both manual & automated solution is capable of restoring the database but obviously, the automated solution is way better. Apart from this, users can select the best method based on their requirements, users can select their preferred solution.

SQL Server Restore Database from Snapshot – User Queries

Q-1. Can this Snapshot method fix the DROP command in the database or not?

Ans: Yes, users can use this snapshot restoring process to simply restore the database deleted by the DROP command.

Q-2. Is it compulsory to save the snapshot to a fixed location or we can change it?

Ans: After how to restore database from snapshot in SQL Server, users must know that they can’t change the location. It will stay in the same database instance.

Q-3. Is this Advanced software free to use or comes with any kind of free version?

Ans: Well, this software is not free but it does provide users with a DEMO version. This is enough for them to test the tool & its capabilities with certain limitations.

Q-4. What if the data is just corrupted & not deleted?

Ans: In that case, we can say that users are free to use this command for both damaged and deleted data. If a snapshot is taken, it’s easier for them to recover the data files.


By Andrew Jackson

I am SQL DBA and SQL Server blogger too. I like to share about SQL Server and the problems related to it as well as their solution and also I do handle database related user queries, server or database maintenance, database management, etc. I love to share my knowledge with SQL Geeks.