Why This Error Happens
Error 3937 occurs when SQL Server attempts to roll back a transaction but encounters a corrupted or inconsistent log record (LSN) that it cannot process. This typically stems from physical corruption in the transaction log file, often caused by faulty storage hardware, an unexpected power loss, or an abrupt shutdown of the SQL Server service. Because the rollback operation cannot complete safely, SQL Server marks the database as suspect to prevent further data integrity issues.
Step-by-Step Resolution Guide
Step 1: Check the Windows Event Log for Underlying I/O Errors
- Open Event Viewer (
eventvwr.msc) on Windows Server 2025 / Windows 11. - Navigate to Windows Logs > System and Application logs.
- Look for disk-related errors (Event ID 7, 9, 15, 51) that occurred around the same timestamp as Error 3937 — these confirm hardware/storage-level corruption.
Step 2: Attempt Database Recovery via Restart
- Restart the SQL Server service to allow automatic recovery to retry rollback:
net stop MSSQLSERVER
net start MSSQLSERVER
- Check
ERRORLOGlocated atC:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOGto confirm if recovery completed or failed again.
Step 3: Run DBCC CHECKDB to Assess Corruption
- Connect via SSMS or
sqlcmdand run:
DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS;
- Review the output for allocation or consistency errors tied to the log or data pages.
Step 4: Restore From a Known Good Backup
- If corruption is confirmed, the safest fix is restoring from your last clean full backup plus transaction log backups:
RESTORE DATABASE YourDatabaseName
FROM DISK = 'D:\Backups\YourDatabaseName_Full.bak'
WITH NORECOVERY;
RESTORE LOG YourDatabaseName
FROM DISK = 'D:\Backups\YourDatabaseName_Log.trn'
WITH RECOVERY;
Step 5: Emergency Repair (Only If No Backup Exists)
- As a last resort, set the database to EMERGENCY mode and attempt repair:
ALTER DATABASE YourDatabaseName SET EMERGENCY;
DBCC CHECKDB ('YourDatabaseName', REPAIR_ALLOW_DATA_LOSS);
ALTER DATABASE YourDatabaseName SET MULTI_USER;
- Note this may result in data loss and should only be used when restoration is not possible.
Alternative or Verification Steps
- Run
DBCC CHECKDBagain post-fix to confirm zero allocation/consistency errors are returned. - If the error recurs intermittently, run hardware diagnostics (
chkdsk /f /ron the volume) to rule out ongoing disk-level corruption affecting the log file.