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

Troubleshooting Guide: SQL Server Error 3401

Why This Error Happens

Error 3401 occurs when SQL Server’s recovery process encounters a database page or transaction log record that is physically corrupted, preventing a proper rollback of an incomplete transaction. This is commonly caused by underlying storage issues (disk failures, SAN/RAID controller faults, or improper shutdowns) that corrupt data pages before SQL Server can flush them correctly. Because the transaction cannot be rolled back cleanly, SQL Server defers the recovery and marks the affected page or file as suspect, requiring manual intervention to restore consistency.

Step-by-Step Resolution Guide

Step 1: Identify the Corrupted Page or File

  • Check the SQL Server Error Log (via SQL Server Management Studio > Management > SQL Server Logs, or C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG) for the specific Page ID and File ID referenced alongside Error 3401.
  • Run DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS; to get a full list of corrupted objects and confirm the scope of damage.
  • Note whether the corruption affects a single page, an index, or the entire file structure.

Step 2: Take the Database Offline Safely

  • Prevent further writes to the corrupted file by setting the database to single-user or restricted mode:
    ALTER DATABASE YourDatabaseName SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE;
  • If the transaction log itself is deferred, avoid restarting the SQL Server service repeatedly, as this can trigger the same deferred transaction failure on every startup.
  • Back up the current (corrupted) state of the database and log files, even if non-functional, before proceeding with repair in case rollback steps make things worse.

Step 3: Restore from a Clean Backup

  • Locate your most recent valid full backup and subsequent transaction log backups (stored typically in D:\SQLBackups\ or your configured backup directory).
  • Perform a page-level restore if only specific pages are corrupted:
    RESTORE DATABASE YourDatabaseName PAGE='1:12345' FROM DISK = 'D:\SQLBackups\FullBackup.bak' WITH NORECOVERY;
  • Follow with transaction log restores to bring the page back in sync:
    RESTORE LOG YourDatabaseName FROM DISK = 'D:\SQLBackups\LogBackup.trn' WITH RECOVERY;

Step 4: Run Repair as a Last Resort

  • If no valid backup exists, run DBCC CHECKDB ('YourDatabaseName', REPAIR_ALLOW_DATA_LOSS) only after placing the database in single-user mode.
  • Understand this step may delete corrupted rows or pages entirely, resulting in permanent data loss for those records.
  • Re-run DBCC CHECKDB afterward to confirm no further errors are reported.

Step 5: Investigate and Resolve Underlying Hardware Issues

  • Check Windows Event Viewer (Event Viewer > Windows Logs > System) for Disk, NTFS, or Virtual Disk Service (VDS) warnings around the time of the incident.
  • Run chkdsk D: /F /R on the volume hosting your SQL data files to detect and repair file system-level issues.
  • Verify SAN/RAID controller health and firmware is current, as faulty storage is the most common root cause of recurring page corruption.

Alternative or Verification Steps

  • After recovery, re-run DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS; to confirm zero allocation or consistency errors remain.
  • If corruption recurs shortly after resolution, enable Page Verification: CHECKSUM (ALTER DATABASE YourDatabaseName SET PAGE_VERIFY CHECKSUM;) and schedule more frequent integrity checks to catch hardware-level issues earlier.