liveBook · Manning

Snapshot

As explained in 100 SQL Server Mistakes and How to Avoid Them

A database snapshot is a read-only, point-in-time view of a SQL Server database that preserves pages as they existed when the snapshot was created.

A database snapshot is a read-only, point-in-time view of a SQL Server database. It uses copy-on-write technology and preserves pages as they existed when the snapshot was created. section 12.2

Use snapshots to:

  • Generate reports against data from a particular point in time. section 12.2
  • Compare current data with an earlier state. section 12.2
  • Recover data deleted through human error or roll back a failed deployment while the source database remains healthy. section 12.2

A new snapshot starts as an empty sparse file. When a source page changes, SQL Server copies the original page into the snapshot before applying the update. Queries read preserved pages from the snapshot and unchanged pages from the source database. section 12.2

Mistake: treating a snapshot as a backup

A snapshot depends on the source database. If that database is corrupted or deleted, the snapshot is unavailable; if the instance or server fails, the snapshot cannot be moved to another instance for recovery. Keep backups as the recovery strategy, and use snapshots as a complement. section 12.2 section 12.12

Figure 12.2 Snapshot process

Use the snapshot-process figure to trace how source-page changes populate the snapshot while unchanged pages remain read from the source. section 12.2

How 100 SQL Server Mistakes and How to Avoid Them covers it

How deep it goes
Explains copy-on-write pages, sparse files, query routing, and source dependence, but stops short of creation commands.
Examples
Uses reporting, historical comparison, accidental deletion, failed deployment, sparse files, and source-page copying as examples.
What it assumes
Assumes basic databases and pages, while introducing sparse files and copy-on-write behavior.
What you can do after
Evaluate whether a snapshot suits reporting, comparison, or quick rollback without mistaking it for an independent backup.
How it connects
Connects database snapshots with backups, storage snapshots, point-in-time restore, and deployment rollback.

Also explained in

Compare how 11 books explain snapshot →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of 100 SQL Server Mistakes and How to Avoid Them. The section links point to the parts of the book it draws on.