Troubleshooting Guide: Error 1122 – Page Alignment Failure in SQL Server 2025
Why This Error Happens
Error 1122 occurs when DBCC CHECKDB encounters a page structure where internal pointer addresses do not fall on proper byte-alignment boundaries, indicating physical corruption at the storage level. This is typically caused by faulty disk I/O subsystems, improper shutdowns, or storage drivers silently dropping writes (torn pages) before they reach the physical disk. In virtualized or SAN-backed environments running Windows Server 2025, this can also stem from misconfigured write-caching policies that violate SQL Server’s I/O guarantees.
Step-by-Step Resolution Guide
Step 1: Isolate the Database and Run Diagnostics
- Place the affected database in single-user mode or take it offline for other connections to prevent further writes during diagnosis.
- Run
DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS, DATA_PURITY;to confirm the scope of corruption. - Note the specific PageID (%SPGID) referenced in the error log located at
C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG.
Step 2: Verify Hardware and Storage Integrity
- Check the Windows Event Viewer under Windows Logs > System for Disk or NTFS warnings (Event ID 7 or 51) occurring around the same timestamp as the SQL error.
- Run
chkdsk C: /f /r(or the relevant drive letter hosting the .mdf/.ndf files) via an elevated Command Prompt to scan for and repair file system-level sector errors. - If using a SAN or virtual disk, verify that the storage controller cache is configured for “Write Through” rather than “Write Back” unless a Battery Backup Unit (BBU) is confirmed active.
Step 3: Restore from a Clean Backup
- Since alignment errors usually indicate non-recoverable physical damage, the safest fix is restoring the specific database from the last known good backup.
- Use
RESTORE DATABASE [YourDatabaseName] FROM DISK = 'E:\Backups\LastGood.bak' WITH REPLACE, RECOVERY;to overwrite the corrupted file structure entirely. - Ensure the backup predates the first occurrence of the error in the logs to avoid restoring already-corrupted pages.
Step 4: Execute Repair as a Last Resort
- If no valid backup exists, revert to single-user mode using
ALTER DATABASE YourDatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE;. - Run
DBCC CHECKDB ('YourDatabaseName', REPAIR_ALLOW_DATA_LOSS);to force SQL Server to deallocate the corrupted page. - Be aware this action will result in the permanent loss of data contained within that specific page.
Alternative or Verification Steps
- Verify the Fix: Re-run
DBCC CHECKDBimmediately after the restore or repair process completes; a clean result with “0 allocation errors and 0 consistency errors” confirms the fix was successful. - Alternative Check: If the error persists immediately after a restore, run the Windows Memory Diagnostic Tool (
mdsched.exe), as faulty RAM on the host server can sometimes cause SQL Server to write misaligned data to disk even when the storage hardware itself is healthy.