SQL Server Error 936: Fix Invalid Snapshot Source
In this article
SQL Server Error 936 occurs when a database snapshot becomes invalid because its source database has been modified in a way that breaks the snapshot's link, most commonly due to the source database being restored, deleted, or having its file structure altered. To resolve this, you must drop the invalid snapshot and recreate it from the current state of the source database, as a snapshot is a read-only view of a specific point in time and cannot be "re-linked" once the source's LSN (Log Sequence Number) chain is broken.
What You'll Need
- SQL Server Management Studio (SSMS) or a similar SQL query tool.
- Sysadmin or db_owner permissions on both the source database and the snapshot database.
- Sufficient disk space to recreate the sparse file for the new snapshot.
- Knowledge of the original T-SQL script used to create the snapshot (if you wish to replicate the exact configuration).
Step-by-Step
- Identify the Invalid Snapshot: Open SQL Server Management Studio (SSMS). In the Object Explorer, expand the Databases folder. Look for the database snapshot in question. If you are unsure which one is causing the error, run a query against
sys.databasesto check thesource_database_idcolumn. Any snapshot returning Error 936 when queried will be identified here. - Verify the Source Database State: Before attempting to fix the snapshot, ensure the source database is online and healthy. Right-click the source database in Object Explorer and select Properties to verify its status. If the source database was recently restored from a backup, this is the primary reason the snapshot became invalid, as the restore process creates a new database identity that the snapshot no longer recognizes.
- Drop the Invalid Snapshot: Because a snapshot is a dependent object, once it is invalid, it cannot be repaired. You must remove it entirely. Open a New Query window and execute the following command, replacing
[YourSnapshotName]with the actual name of the invalid snapshot:DROP DATABASE [YourSnapshotName];
If the database is stuck in a state where a standard drop fails, you may need to set the database toSINGLE_USERmode first, though this is rare for snapshots. - Clear Cached Connections: Occasionally, active sessions may still be trying to access the invalid snapshot, which can cause the
DROP DATABASEcommand to hang. If the drop command does not execute, runsp_who2to find active sessions connected to the snapshot and kill those processes using theKILL [SPID]command. - Recreate the Database Snapshot: Now that the invalid snapshot is removed, you can create a new one. You must use T-SQL for this, as SSMS does not provide a GUI wizard for snapshot creation. Use the following template:
CREATE DATABASE [YourSnapshotName] ON ( NAME = [SourceDataFileName], FILENAME = 'C:\Path\To\Snapshot_Data.ss' ), ( NAME = [SourceLogFileName], FILENAME = 'C:\Path\To\Snapshot_Log.ss' ) AS SNAPSHOT OF [YourSourceDatabaseName];
Note: Ensure theFILENAMEpaths point to a valid directory where the SQL Server service account has write permissions. Labels and paths may vary slightly based on your OS version and drive mapping. - Validate the New Snapshot: Once the command completes successfully, test the snapshot by running a simple
SELECTquery against a table within the snapshot database. If the data returns without Error 936, the link is successfully established.
Common Mistakes
One of the most frequent mistakes is attempting to "attach" the snapshot files manually using the ATTACH_DB command. Database snapshots are not standard databases; they are sparse files that rely on a pointer to the source database. Attempting to attach them as standalone databases will fail or result in further corruption.
Another common error is neglecting the disk space requirements for the sparse file. While a snapshot initially takes up very little space, it grows as the source database changes. If the drive hosting the snapshot runs out of space, the snapshot can become corrupted or invalid, leading back to Error 936 or similar I/O errors. Always monitor the volume where .ss files are stored.
Users also frequently forget that snapshots are tied to the specific identity of the source database. If you perform a RESTORE DATABASE with the REPLACE option on the source, the snapshot is immediately invalidated because the internal database ID and LSN change, even if the database name remains identical.
Tips
To avoid frequent manual recreations, consider automating your snapshot process. If you use snapshots for pre-deployment backups, write a stored procedure that automatically drops the existing snapshot and creates a new one as part of your deployment pipeline. This ensures you always have a valid point-in-time recovery option.
Place your snapshot sparse files on a separate physical disk from your primary data files. This reduces I/O contention and prevents a full snapshot disk from crashing the primary source database. Since snapshots only record changed blocks, the performance impact is generally low, but disk throughput still matters during heavy write operations on the source.
Use descriptive naming conventions for your snapshots, such as DB_Snapshot_20261204. This makes it easier to identify which snapshots are outdated and need to be dropped during routine maintenance, preventing a buildup of old sparse files that consume disk space.
Troubleshooting
If the DROP DATABASE command fails with an error stating that the database is in use, try switching the database to single-user mode. However, since snapshots are read-only, this is less common. Instead, check for any open transactions or reporting tools (like Power BI or SSRS) that may be polling the snapshot in the background.
If you receive an "Access Denied" error when recreating the snapshot, check the permissions of the folder where you are placing the .ss files. The SQL Server Service account (e.g., NT Service ssqlserver) must have full control over that folder. Do not simply grant permissions to your own Windows user account; the service account is what actually creates the file.
If the snapshot becomes invalid shortly after creation, check the source database for heavy index rebuilds or large-scale data imports. Massive changes to the source database cause the snapshot's sparse file to grow rapidly. If the growth exceeds the available disk space, the snapshot may be marked as invalid by the system to protect the integrity of the source database.
Frequently Asked Questions
Can I repair a snapshot without dropping it?
No. Once a snapshot is invalid due to a source change (like a restore), the link is permanently broken. The only solution is to drop and recreate it.
Does dropping a snapshot affect the source database?
No. Dropping a snapshot is a safe operation. It only deletes the sparse file and the metadata associated with the snapshot; it has no impact on the data or performance of the source database.
Why did my snapshot become invalid after a backup?
A standard backup does not invalidate a snapshot. However, a restore operation does. If you restored the source database from a backup, the snapshot is no longer compatible with the new version of the source.
How many snapshots can I have for one source database?
You can have multiple snapshots of a single source database. However, keep in mind that each snapshot tracks changes. The more snapshots you have, the more disk space will be consumed as the source database is modified.
Is a database snapshot the same as a backup?
No. A snapshot is a pointer to the source database and is used for quick reverts or reporting. A backup is a separate copy of the data. If the source database files are deleted, the snapshot becomes useless, whereas a backup allows for full recovery.