Troubleshooting Guide: SQL Server Error 9124 – Statistics Corruption
Why This Error Happens
Error 9124 occurs when SQL Server detects that the internal statistics blob (stored in sys.sys_stats or associated with an index) has become corrupted at the page level, often due to underlying disk I/O failures, improper shutdowns, or storage subsystem errors on Windows Server 2025. This is frequently triggered by bad sectors, faulty SAN/NAS caching, or file system corruption on NTFS/ReFS volumes hosting the .mdf/.ndf files. Because statistics objects are not covered by standard page-level checksums in the same way as data pages, SQL Server flags them as unrepairable and requires a manual rebuild rather than attempting an automatic repair via DBCC CHECKDB.
Step-by-Step Resolution Guide
Step 1: Identify the Scope of Corruption
- Run
DBCC CHECKDB('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS;to confirm whether corruption is isolated to statistics or extends to data/index pages. - Check the SQL Server Error Log (
C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG) for the exact object ID and index ID referenced in the error message. - Cross-reference the Windows Event Viewer (System and Application logs) for correlating Disk or NTFS warnings (Event ID 7 or 55) around the same timestamp.
Step 2: Drop and Rebuild the Corrupt Statistics
- Identify the exact statistics name from the error message (the
%.*lsplaceholder). - Execute
DROP STATISTICS [TableName].[StatisticsName];to remove the corrupted object. - Immediately regenerate it using
CREATE STATISTICS [StatisticsName] ON [TableName] ([ColumnName]) WITH FULLSCAN; - If the statistics are tied to an index rather than a standalone column, instead run
ALTER INDEX [IndexName] ON [TableName] REBUILD WITH (FULLSCAN, ONLINE = OFF);
Step 3: Clear and Regenerate All Database Statistics
- If multiple statistics objects are affected, run
sp_updatestats;to force a refresh across the entire database. - For a more aggressive reset, use
EXEC sp_msforeachtable "UPDATE STATISTICS ? WITH FULLSCAN";to rebuild statistics on every user table. - Restart the SQL Server service via
services.mscornet stop MSSQLSERVER && net start MSSQLSERVERto clear any cached execution plans referencing the old statistics.
Step 4: Validate Underlying Storage Health
- Open PowerShell as Administrator and run
Repair-Volume -DriveLetter D -Scan(replaceDwith your data drive) to check for file system-level errors. - Review disk health using
Get-PhysicalDisk | Select FriendlyName, HealthStatusto rule out failing hardware as the root cause.
Alternative or Verification Steps
- Re-run
DBCC CHECKDB('YourDatabaseName') WITH NO_INFOMSGS;after the rebuild to confirm Error 9124 no longer appears and no additional allocation errors are reported. - If corruption recurs immediately after rebuilding, restore the affected database from the last known-good backup using
RESTORE DATABASE ... WITH RECOVERY, as this indicates active disk-level corruption rather than a transient statistics issue.