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

Troubleshooting Guide: SQL Server Error 2534 – Table Error: Page %S_PGID

Why This Error Happens

Error 2534 occurs when SQL Server’s consistency checker (DBCC) detects that a page identified in a table’s allocation structures does not actually belong to that object, indicating a mismatch between the Page Free Space (PFS) or Index Allocation Map (IAM) pages and the actual object ID/index ID stored on the page header. This is typically caused by physical disk corruption, improper shutdowns (power loss), faulty storage controllers/drivers, or SAN/storage replication issues that resulted in torn or incomplete page writes. In rarer cases, this can result from running NTFS compression or using antivirus/backup software that locks or modifies the .mdf/.ldf files while SQL Server is writing to them.

Step-by-Step Resolution Guide

Step 1: Isolate the Database and Verify Hardware Integrity

  • Immediately set the database to SINGLE_USER mode to prevent further writes that could compound the corruption: ALTER DATABASE [YourDB] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
  • Check the Windows Event Viewer (eventvwr.msc) under Windows Logs > System for Event ID 7 (Bad Block) or Event ID 51/129 (I/O timeouts) to rule out physical disk failure.
  • Run chkdsk C: /f /r (or the relevant drive letter hosting the data files) on the next reboot to scan for and repair file system-level errors.

Step 2: Run DBCC CHECKDB to Assess the Scope of Damage

  • Execute a full consistency check without repair first to see the extent of the corruption: DBCC CHECKDB ('YourDB') WITH NO_INFOMSGS, ALL_ERRORMSGS;
  • Review the output to confirm if the error is isolated to a single non-clustered index (easier fix) or a clustered index/heap (data loss risk).
  • If the corruption is on a non-clustered index, you can often resolve this cheaply by dropping and recreating the index rather than repairing the table.

Step 3: Restore from a Clean Backup (Preferred Method)

  • Navigate to your backup repository and verify the integrity of your last known good full backup using RESTORE VERIFYONLY FROM DISK = 'E:\Backups\YourDB.bak';
  • Restore the database to a new instance or alongside the corrupted one to extract clean data: RESTORE DATABASE [YourDB_Clean] FROM DISK = 'E:\Backups\YourDB.bak' WITH MOVE 'YourDB_Data' TO 'D:\SQLData\YourDB_Clean.mdf', MOVE 'YourDB_Log' TO 'D:\SQLLogs\YourDB_Clean.ldf';
  • If no backup exists, proceed to the repair step below as a last resort.

Step 4: Execute Repair with Data Loss (Last Resort)

  • If no clean backup is available and the error persists on critical system tables, run the repair command while the DB is still in single-user mode: DBCC CHECKDB ('YourDB', REPAIR_ALLOW_DATA_LOSS);
  • Be aware this command may deallocate the corrupted page entirely, resulting in permanent loss of the rows contained on that specific page.
  • Once complete, immediately run DBCC CHECKDB again to confirm 0 allocation errors and 0 consistency errors.

Alternative or Verification Steps

  • Verify the Fix: Run DBCC CHECKDB ('YourDB') WITH NO_INFOMSGS, ALL_ERRORMSGS; one final time; a clean result should return “0 allocation errors and 0 consistency errors found.”
  • Alternative: If REPAIR_ALLOW_DATA_LOSS fails to resolve the specific page error, export the surviving data from the affected table into a new table using SELECT * INTO NewTable FROM OldTable WHERE id NOT IN (corrupted_ids), then drop and rename the tables to purge the corrupted page entirely.