Microsoft SQL Server 2012 Bible
by Adam Jorgensen, Jorge Segarra, Patrick LeBlanc, Jose Chinchilla, Aaron Nelson
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
Figure 24.2 Database file information.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access