File Repair
Database Recovery with Piecemeal Restore in Microsoft SQL Server
July 28, 2026| 7 min read
Summary: This article outlines the reasons for restoring a database from a snapshot in SQL Server. Also, it explains the step-by-step process of creating a database snapshot and how to restore it. Further, it discusses using Stellar Toolkit for MS SQL software to restore the database when reverting from a snapshot won’t work. Download the demo version of the software from below to test its features.
Free Download 100% SecureA database snapshot is a useful feature that helps perform point-in-time recovery of your source database. A snapshot captures the current state of the database. So, if you do something wrong in a database, you can revert the database to the state it was in – when the snapshot was created. For instance, if you created a snapshot while performing a DML operation on a database, using the database snapshot helps restore the database to the state before the DML operation was performed.
Several reasons might require you to restore database from snapshot in SQL Server. The most common reason is that reverting the database to a specific point in time from a snapshot is faster than restoring from a backup. In addition, in the event of a user error, such as accidentally dropping a table, you can recover the dropped table by reverting the database from a snapshot.
Let's discuss an example demonstrating the step-by-step process of creating a database snapshot, modifying the database, and reverting the database from snapshot.
Here is the Transact-SQL (T-SQL) query to create a new database snapshot.
In this query, 'Test_Database' is the name of the database for which we are creating a snapshot. Further, 'Test_Database_dbss' is the name of the snapshot. Before executing the above query, make sure you replace the database name and database snapshot with the name of your database.
So now, let's run the T-SQL query, and you can see in the following screen that the commands are executed successfully.
Refresh the Database Snapshots folder.
On expanding the Database Snapshots folder, you can see that the snapshot of the 'Test_Database' is created. Expand it, and you will see one table which is the same as the original database. This is just for demo purposes.
Now let's make some changes to the original database. For instance, delete a table from the database. To do so:
The table is deleted from the original database. Check if the table still exists in the database snapshot.
Note: If you've several database snapshots in SQL Server, ensure to drop the unwanted snapshots. That's because you can revert only one database snapshot at a time.
Here is the syntax for restoring a database from the database snapshot:
RESTORE DATABASE yourdb_name FROM DATABASE_SNAPSHOT =yourdb_snapshot_name
In our case, we'll be restoring 'Test_Database' from snapshot to recover the deleted records.
The commands are executed successfully, as you can see in the following screenshot.
Refresh your original database, and you will see that the deleted table 'CompanyDetails' is now restored.
A snapshot is dependent on the source database. So, if the database gets corrupted, you cannot restore the database from a snapshot.
If you fail to revert a database to its current state from a snapshot, try restoring the database from the most recent backup. However, situations may arise when the backup you want to restore the database from has turned bad. You need to repair the database using DBCC CHECKDB with the minimum repair option as a last resort. However, using the repair options does not guarantee to preserve data integrity. Also, using the 'REPAIR_ALLOW_DATA_LOSS' option involves data loss risk.
A better alternative is to use Stellar Toolkit for MS SQL, a set of comprehensive tools designed for DBAs to repair a corrupted SQL database, extract data from a corrupted database, and reset a lost or forgotten password of SQL data files.
Read this: Stellar Toolkit for MS SQL – All in one Admin Utility