Using Database Snapshots
You can create, query, or drop database snapshots just as with regular databases. The main difference is that you can create them only from an existing database as a point-in-time, read-only database. After you create a snapshot, it can be queried the same way as regular databases. You cannot perform updates, inserts, or deletions on the data or make schema changes (adding or removing tables and columns).
You can use snapshots to revert a database to a specific point in time using similar syntax to what you would use to RESTORE the database from a database backup.
The following sections describe database snapshot operations in more detail.
Creating a Database Snapshot
You can create database snapshots only using the Transact-SQL command CREATE DATABASE <. . .> ON <. . .> AS SNAPSHOT OF <. . .>.
Following are the step-by-step instructions to create a database snapshot of the AdventureWorks2012 sample database:
USE AdventureWorks2012; GO EXECUTE sp_helpfile; GO
Get Microsoft SQL Server 2012 Bible now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.