Troubleshooting Guide: Error 3067 – “Failed While Trying to Delete File Snapshot”
Why This Error Happens
Error 3067 occurs when SQL Server 2025 attempts to clean up a database snapshot file (typically during a DROP DATABASE, snapshot refresh, or automated backup verification process) but is denied access by the underlying file system. This is most commonly caused by the SQL Server service account lacking NTFS delete permissions on the sparse file, the file being locked by another process (such as an antivirus scanner or backup agent), or the volume shadow copy/file handle not being released properly by the VDI (Virtual Device Interface) layer. In rarer cases, disk-level corruption or a mismatch between the snapshot’s logical path and the physical file’s actual location on disk triggers the same error code.
Step-by-Step Resolution Guide
Step 1: Verify File Lock and Ownership
- Open Resource Monitor on Windows Server 2025 and search the CPU tab for handles matching the
.sssnapshot file extension. - Identify if a third-party process (antivirus, backup software, or indexing service) is holding a lock on the file located typically under
C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA\. - Terminate or exclude the conflicting process temporarily to test if the lock releases.
Step 2: Correct NTFS Permissions
- Navigate to the data directory via File Explorer or PowerShell:
Get-Acl "D:\SQLData\Snapshots". - Ensure the SQL Server service account (e.g.,
NT Service\MSSQLSERVERor your custom domain service account) has Full Control over the snapshot folder, not just Modify/Write. - Apply the permission change recursively using:
icacls "D:\SQLData\Snapshots" /grant "NT SERVICE\MSSQLSERVER:(OI)(CI)F" /T.
Step 3: Exclude Snapshot Directories from Antivirus/EDR Scanning
- Add an exclusion rule in Windows Defender or your enterprise EDR for the
*.ssfile extension and the SQL Data/Snapshot root folder. - Use PowerShell to add the exclusion:
Add-MpPreference -ExclusionPath "D:\SQLData\Snapshots". - Restart the SQL Server (MSSQLSERVER) service to clear any residual locks from the previous scanning cycle.
Step 4: Manually Force Snapshot Cleanup
- If the snapshot is orphaned (no longer linked to an active session), stop the SQL Server service entirely via
services.msc. - Manually delete the corresponding
.ssfile from the file system using an elevated Command Prompt:del "D:\SQLData\Snapshots\Snapshot_Name.ss". - Restart the SQL Server service and run
DBCC CHECKDBon the source database to ensure no metadata references the deleted file.
Alternative or Verification Steps
- To verify the fix, re-run the
DROP DATABASE [Snapshot_Name]command in SQL Server Management Studio (SSMS) and confirm it completes without returning Error 3067 in the Messages pane. - If the error persists after permission changes, check the Windows Event Viewer under Windows Logs > System for disk-level I/O errors (Event ID 7 or 153), which may indicate a failing physical disk requiring
chkdsk /fon the volume.