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

Why This Error Happens

Error 5115 occurs when SQL Server’s CREATE DATABASE…AS SNAPSHOT OF statement encounters a source file that does not match the internal SQL Server file header signature. This typically happens when the file path points to a renamed, copied, or corrupted .mdf/.ndf file, or when a non-database file (such as a .txt, .bak, or system file) is mistakenly referenced in the snapshot command. It can also occur if the file was created by an incompatible or much older version of SQL Server and lacks the expected header structure.

Step-by-Step Resolution Guide

Step 1: Verify the Source File Path and Extension

  • Open SQL Server Management Studio (SSMS) and check the exact file path used in your CREATE DATABASE snapshot statement.
  • Confirm the file has a valid .mdf or .ndf extension — not .bak, .trn, or .ldf.
  • Run the following to list actual database files:
SELECT name, physical_name FROM sys.master_files WHERE database_id = DB_ID('YourDatabaseName');

Step 2: Validate File Integrity Using DBCC

  • Run DBCC CHECKDB('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS; to confirm the source database file is not corrupted.
  • If corruption is detected, restore the database from a verified backup before attempting another snapshot.
  • Check Event Viewer under Windows Logs > Application for any disk-level I/O warnings tied to the file.

Step 3: Confirm File Permissions and Location

  • Navigate to the file location (commonly C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA\) and verify the SQL Server service account has Read/Write NTFS permissions.
  • Ensure the file is not located on a network share or mapped drive, as snapshots require local NTFS volumes.
  • Re-check that no antivirus or backup software has locked or altered the file header during a scan.

Step 4: Reissue the Snapshot Command with Correct Syntax

  • Rewrite the CREATE DATABASE statement, explicitly pointing to a valid .mdf file as the source:
CREATE DATABASE YourDB_Snapshot ON
( NAME = YourDB_Data, FILENAME = 'C:\SQLData\YourDB_Snapshot.ss' )
AS SNAPSHOT OF YourDB;
  • Double-check there are no extra spaces, incorrect quotes, or mismatched logical file names (NAME value must match sys.master_files).

Alternative or Verification Steps

  • After reissuing the command, confirm the snapshot was created successfully by querying SELECT * FROM sys.databases WHERE source_database_id IS NOT NULL;.
  • If the error persists, detach and reattach the source database in SSMS to refresh its file header metadata, then retry the snapshot operation.