Troubleshooting Guide: Error 3973 – Database In Use by Another Thread in Exclusive Mode
Why This Error Happens
This error occurs when an internal SQL Server operation, such as a database snapshot creation, DBCC CHECKDB, or a restore operation, attempts to acquire an exclusive lock on a database workspace that is already held by another concurrent thread or session. It is frequently triggered when maintenance tasks (like CHECKDB with data_purity or repair options) run simultaneously with other transactional activity against the same database. In some cases, this can also surface due to an improperly closed internal snapshot used by SQL Server to maintain transactional consistency during consistency checks.
Step-by-Step Resolution Guide
Step 1: Identify Conflicting Sessions and Processes
- Open SQL Server Management Studio (SSMS) and connect to the affected instance on your Windows Server 2025 / Windows 11 machine.
- Run
sp_who2or querysys.dm_exec_requestsandsys.dm_tran_locksto identify sessions holding locks on the database in question. - Look specifically for sessions with
DbIdmatching your target database and arequest_modeofX(exclusive).
Step 2: Terminate Blocking Sessions Safely
- Once you identify the blocking session ID (SPID), verify it is not a critical system process before terminating it.
- Use
KILL <SPID>in a new query window to terminate the conflicting session. - If the issue stems from a DBCC CHECKDB operation, allow it to complete fully before re-running any other exclusive operations, as interrupting DBCC mid-process can cause further workspace conflicts.
Step 3: Check for Orphaned Internal Snapshots
- Navigate to the default data directory, typically
C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA\, and look for leftover snapshot files (usually named with a GUID pattern and.ssextension). - These orphaned snapshot files can occur if a previous DBCC operation was forcibly terminated.
- Restart the SQL Server service via
services.mscor runnet stop MSSQLSERVERfollowed bynet start MSSQLSERVERin an elevated Command Prompt to clear any stuck internal snapshot handles.
Step 4: Serialize Maintenance Operations
- Reschedule maintenance jobs (DBCC CHECKDB, index rebuilds, backups) in SQL Server Agent so they do not overlap on the same database.
- Open SQL Server Agent, navigate to Jobs, and adjust the Schedules tab to stagger execution times with at least a 15-30 minute buffer between jobs targeting the same database.
Step 5: Apply Latest Cumulative Update
- Verify your current build version by running
SELECT @@VERSION;. - If you are not on the latest Cumulative Update (CU) for SQL Server 2025, download and apply it from the Microsoft Update Catalog, as workspace locking issues are often addressed in service packs/CUs.
Alternative or Verification Steps
- After applying the fixes, re-run the original operation (e.g., DBCC CHECKDB or backup/restore) during a low-activity window and confirm it completes without Error 3973 appearing in the SQL Server Error Log (
ERRORLOGfile in theMSSQL\LOGdirectory). - If the error persists, consider restarting the SQL Server instance entirely during a maintenance window to clear any lingering internal workspace locks that a simple service restart did not resolve.