This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In the previous two articles, I have shared basic details about the SQL Server Snapshot and how we can configure it.
But one of the important things is, we can also restore a source database from the created Snapshot database.
When we update anything in the source database, it holds the modified pages and copied original pages into the Snapshot database.
The Snapshot database is a collection of the original pages and source database may have some original and updated pages.
The Snapshot is a virtual backup of the Source database and sometimes it happens that after the creation of Snapshot database, some invalid operation or update happen on the source database.
If any corruption happens in the Source database, we can restore original pages from Snapshot database and can overwrite on the modified pages in the Source database and Transaction log also update accordingly.
Generally, restoring a database from the Snapshot is not an always preferable option.
The best practice is to take a full database backup regularly and whenever it is required we can restore it. But to restore a Source Database using Snapshot Database is faster than the regular restore operation.
Script to restore using Snapshot Database:
1 2 3 4 5 |
USE master GO RESTORE DATABASE [Source_Database] FROM DATABASE_SNAPSHOT = 'Snapshot_Database' GO |
Leave a Reply