How to fix Error 5093 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 5093 — “The Operation Cannot Be Performed on a Database Snapshot”

Why This Error Happens

Error 5093 occurs when an operation that is not supported on database snapshots is attempted, such as running ALTER DATABASE, BACKUP, DBCC CHECKDB with repair options, or attempting to shrink, expand, or restore directly onto a snapshot. Database snapshots in SQL Server 2025 are read-only, point-in-time views backed by sparse files, and many administrative operations are explicitly blocked against them by the Database Engine. This also occurs if an application or script mistakenly targets the snapshot name instead of the source database due to misconfigured connection strings or naming conventions.

Step-by-Step Resolution Guide

Step 1: Identify the Target Database Context

  • Run the following query to confirm whether the database in question is actually a snapshot:
  SELECT name, source_database_id, is_read_only 
  FROM sys.databases 
  WHERE source_database_id IS NOT NULL;
  • If the database name returned matches the one throwing the error, it confirms you are operating on a snapshot rather than the source database.
  • Check the connection string or application config file (e.g., web.config, appsettings.json) for incorrect database references pointing to the snapshot.

Step 2: Redirect the Operation to the Source Database

  • Locate the source database using:
  SELECT DB_NAME(source_database_id) AS SourceDB, name AS SnapshotName 
  FROM sys.databases 
  WHERE name = 'YourSnapshotName';
  • Modify your script, job, or application connection string to point to the SourceDB instead of the snapshot.
  • Re-run the intended operation (backup, alter, maintenance task, etc.) against the correct source database.

Step 3: Drop and Recreate the Snapshot (If Corrupted or Stale)

  • If the snapshot itself is no longer needed or is causing conflicts with scheduled maintenance plans, drop it safely:
  DROP DATABASE YourSnapshotName;
  • Recreate it only if required, using the correct sparse file path:
  CREATE DATABASE YourSnapshotName ON 
  ( NAME = YourSourceDB_Data, FILENAME = 'C:\SQLData\YourSnapshotName.ss' )
  AS SNAPSHOT OF YourSourceDB;
  • Ensure the file path exists and the SQL Server service account has write permissions on the target directory.

Step 4: Audit Maintenance Plans and Scheduled Jobs

  • Open SQL Server Management Studio (SSMS) and navigate to SQL Server Agent > Jobs.
  • Review any backup, integrity check, or shrink jobs to ensure they explicitly exclude snapshot databases (filter using sys.databases.source_database_id IS NULL in dynamic job scripts).
  • Update any foreach database loops in PowerShell or T-SQL scripts to skip snapshots automatically.

Alternative or Verification Steps

  • Verify the fix by re-running the original failed operation against the source database; it should complete without Error 5093.
  • As an alternative, use sys.databases to generate a permanent exclusion list for snapshots in all automated maintenance scripts, preventing recurrence across Windows Server 2025 and Windows 11 SQL Server instances.