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

Troubleshooting Guide: Error 3984 – Cannot Acquire Database Lock During Transaction Change

Why This Error Happens

Error 3984 typically occurs when the database engine is unable to obtain the necessary lock on a resource (row, page, or table) because the transaction log is unable to mark a log sequence number (LSN) as part of an active checkpoint or recovery operation. This is most commonly caused by a corrupted or inconsistent transaction log file, insufficient memory allocated to the Lock Manager, or a long-running blocking transaction that has exhausted available lock resources. In some cases, this error surfaces after an improper shutdown or storage-level I/O interruption on Windows Server 2025 that leaves the database in a transitional state.

Step-by-Step Resolution Guide

Step 1: Verify Database and Transaction Log Integrity

  • Open SQL Server Management Studio (SSMS) and run DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORS;
  • Check the SQL Server Error Log located at C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG for related corruption warnings.
  • If corruption is found, restore from the latest clean backup before proceeding further.

Step 2: Identify and Terminate Blocking Transactions

  • Run the following query to identify blocking sessions: SELECT * FROM sys.dm_tran_locks WHERE request_status = 'WAIT';
  • Cross-reference blocking session IDs using EXEC sp_who2 'active';
  • If a session is confirmed as an orphaned or long-running blocker, terminate it using KILL <session_id>;

Step 3: Increase Lock Resources and Adjust Memory Configuration

  • Open SSMS, right-click the server instance, and go to Properties > Memory.
  • Ensure “Maximum server memory” is not set too restrictively (recommended: leave at least 20% of system RAM for the OS on Windows Server 2025).
  • If using locked pages, verify the SQL Server service account has the “Lock Pages in Memory” policy enabled via secpol.msc under Local Policies > User Rights Assignment.
  • Restart the SQL Server service via services.msc or net stop MSSQLSERVER && net start MSSQLSERVER for changes to take effect.

Step 4: Rebuild or Repair the Transaction Log (If Required)

  • If the log file is flagged as suspect, set the database to emergency mode: ALTER DATABASE YourDatabaseName SET EMERGENCY;
  • Run ALTER DATABASE YourDatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE; followed by DBCC CHECKDB ('YourDatabaseName', REPAIR_ALLOW_DATA_LOSS);
  • Revert to multi-user mode: ALTER DATABASE YourDatabaseName SET MULTI_USER;

Alternative or Verification Steps

  • Re-run the original transaction that triggered Error 3984 and monitor sys.dm_os_wait_stats for LCK_M_* wait types to confirm locks are being released properly.
  • If the issue persists, failover to a secondary replica (if using Always On Availability Groups) and perform a full consistency check on the primary node before reintroducing it to the cluster.