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

Troubleshooting Guide: SQL Server Error 5223 – Empty Page Could Not Be Deallocated

Why This Error Happens

Error 5223 occurs when SQL Server’s internal deallocation routine encounters an empty page that does not match the expected state recorded in the Page Free Space (PFS) or Index Allocation Map (IAM) pages. This is almost always a symptom of underlying database corruption, often caused by a faulty I/O subsystem, improper shutdowns, or storage-level bit flips on the data file. In rarer cases, it can result from a SQL Server engine bug interacting with specific index maintenance operations (such as ALTER INDEX REORGANIZE) on Windows Server 2025 environments using newer storage drivers.

Step-by-Step Resolution Guide

Step 1: Verify the Scope of Corruption

  • Run DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS; to confirm if the error is isolated or part of broader corruption.
  • Check the SQL Server Error Log (C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG) for correlating I/O warnings (Event ID 823 or 824).
  • Cross-reference Windows Event Viewer (Application and System logs) for disk or storage controller warnings around the same timestamp.

Step 2: Isolate and Repair the Affected Object

  • Identify the specific object ID and page ID referenced in the error using DBCC PAGE (DatabaseName, FileID, PageID, 3) WITH TABLERESULTS;.
  • If the object is a non-clustered index, drop and rebuild it manually using DROP INDEX [IndexName] ON [TableName]; followed by CREATE INDEX... rather than relying on automated repair, as this avoids data loss.
  • If the corruption resides in a heap or clustered index, proceed to restore from backup (preferred) before attempting REPAIR_ALLOW_DATA_LOSS.

Step 3: Restore From a Clean Backup (Recommended Path)

  • Take a tail-log backup of the current state if the database is still accessible: BACKUP LOG [YourDatabaseName] TO DISK = 'E:\Backups\TailLog.trn';.
  • Restore the last known good full backup followed by subsequent differential/log backups to bring the database to the point just before corruption.
  • Validate the restored database immediately with DBCC CHECKDB before bringing it back online for production use.

Step 4: Check and Update Storage Drivers on Windows Server 2025

  • Navigate to Device Manager > Storage Controllers and verify driver versions against the vendor’s latest release (especially for NVMe or SAN-attached volumes).
  • Run wevtutil qe System /q:"*[System[(EventID=153 or EventID=129)]]" /f:text in PowerShell to check for disk timeout or controller reset events.
  • Update firmware/drivers and reboot the Windows Server 2025 host to rule out a hardware-level root cause before re-running database operations.

Alternative or Verification Steps

  • Re-run DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS; after remediation — a clean run with zero allocation or consistency errors confirms the fix.
  • If corruption recurs on the same LUN or disk after repair, treat it as a hardware fault: migrate the database files to a different physical volume and run chkdsk E: /f /r (replace E: with your data drive) during a maintenance window.