Troubleshooting Guide: SQL Server Error 1815 — “The %ls Property Cannot Be Used with Database Snapshot Files”
Why This Error Happens
This error occurs when an administrative script or application attempts to modify a property—such as file name, size, growth setting, or offline/online status—on a database that is actually a database snapshot rather than a standard read-write database. Database snapshots are read-only, point-in-time views built on sparse files, so properties related to file management (ALTER DATABASE MODIFY FILE, autogrowth, or file state changes) are intentionally blocked by the SQL Server engine. This typically happens when a DBA script targets a snapshot name by mistake, or when automated maintenance jobs (e.g., shrink, growth, or backup compatibility checks) iterate through sys.databases without filtering out snapshot instances.
Step-by-Step Resolution Guide
Step 1: Identify Whether the Target Database Is a Snapshot
- Run the following query to confirm the database type:
SELECT name, database_id, source_database_id
FROM sys.databases
WHERE source_database_id IS NOT NULL;
- If
source_database_idis populated (not NULL), the database is a snapshot and cannot accept file/property modifications. - Cross-check the name against your script or job step to confirm it was mistakenly targeted.
Step 2: Correct the Script or Job to Exclude Snapshots
- Open the failing maintenance plan, SQL Agent job, or PowerShell/T-SQL script (commonly found in
C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\for job history or in SQL Server Agent job steps). - Add a filter to exclude snapshot databases from any loop or property-altering logic:
WHERE source_database_id IS NULL
- If using PowerShell (
Invoke-Sqlcmdor dbatoolsGet-DbaDatabase), add a-ExcludeSnapshotor equivalent filter flag.
Step 3: Redirect the Operation to the Source Database
- If your intent was to modify file growth, size, or state, apply the change to the source database instead of the snapshot:
ALTER DATABASE [YourSourceDB_Name]
MODIFY FILE (NAME = N'YourFile', SIZE = 500MB);
- Verify the source database name via the
source_database_idlookup from Step 1, joined againstsys.databases.database_id.
Step 4: Drop and Recreate the Snapshot If It Is Obsolete or Corrupted
- If the snapshot is no longer needed or was created in error:
DROP DATABASE [YourSnapshotName];
- Recreate it cleanly only if required for reporting or recovery purposes:
CREATE DATABASE [YourSnapshotName] ON
(NAME = YourFile, FILENAME = 'C:\SQLData\YourFile_Snapshot.ss')
AS SNAPSHOT OF [YourSourceDB_Name];
Step 5: Restart Dependent Services (If Applied via Automation Tooling)
- If a third-party backup or monitoring tool triggered this error, restart the SQL Server Agent service via
services.mscon Windows Server 2025 to clear any cached database metadata. - Re-run the job manually to confirm the corrected logic executes without Error 1815.
Alternative or Verification Steps
- Re-run the original failing script or SQL Agent job and confirm it completes without referencing Error 1815 in the SQL Server Error Log (
ERRORLOGfile under theMSSQL\Logdirectory). - As an alternative, use
sp_helpdb 'YourDatabaseName'to quickly confirm database type and status before running any property-altering scripts in the future, preventing recurrence.