SQL Server error 1123 means the storage engine found a page whose type does not match what the table's metadata expects — for example, an index page where a data page should be, or a page belonging to a different object. It is almost always a symptom of corruption, not a configuration mistake, and the safe first move is to stop writing to the database, run DBCC CHECKDB in read-only mode, and restore from a known-good backup if CHECKDB reports errors that REPAIR cannot fix without data loss. The steps below walk through diagnosis, the right repair option, and how to verify the fix.
What You'll Need
- Membership in the sysadmin fixed server role, or equivalent permissions to run DBCC CHECKDB and restore backups.
- The name of the affected database and, if possible, the object (table or index) named in the error message.
- A recent full backup plus any differential and log backups taken since, stored on a separate drive or share.
- Free disk space at least equal to the size of the database for a CHECKDB with repair or a restore to a new location.
- SQL Server Management Studio (SSMS) or Azure Data Studio, or sqlcmd if you prefer command-line work.
- A maintenance window: CHECKDB with repair options takes the database offline for other users.
Step-by-Step
- Capture the full error text. Error 1123 usually arrives with a message number, severity, state, and the page ID (file:page). Copy the entire message from the SQL Server error log or the application that hit it. The page ID and object name tell you whether the problem is in a clustered index, a nonclustered index, or a heap.
- Stop writes to the database. Put the database in single-user mode or take the application offline so nothing else writes to the damaged pages. Every write risks spreading corruption. If the database is part of an availability group, consider suspending data movement on the secondary while you investigate.
- Check the SQL Server error log and Windows event log. Look for earlier 823, 824, or 825 errors, I/O errors, or disk warnings. Error 1123 rarely appears alone; a failing disk, controller, or antivirus filter driver is a common root cause. Note any hardware messages so you can address them before restoring.
- Run DBCC CHECKDB in read-only mode first. In SSMS, open a new query window against the master database and run:
DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS;
This reports every consistency error without changing anything. Read the output carefully: it lists the object, index, and page, plus a recommended repair level (REPAIR_ALLOW_DATA_LOSS, REPAIR_REBUILD, or REPAIR_FAST). - Take a fresh backup before any repair. Even a corrupt database should be backed up so you have a forensic copy. Run a full backup to a separate drive, then a log backup if the recovery model allows it. Do not overwrite older backups.
- Decide between restore and repair. If you have a clean backup and can tolerate losing recent transactions, restore is almost always safer and faster than repair. Restore the full backup, then differential and log backups in sequence, and run CHECKDB on the restored copy before returning it to service. If no clean backup exists, proceed to repair.
- Run DBCC CHECKDB with the recommended repair option. Start with the least destructive level the output suggested. For example:
DBCC CHECKDB ('YourDatabaseName', REPAIR_REBUILD) WITH NO_INFOMSGS;
REPAIR_REBUILD fixes index-level problems without losing data. If the output calls for REPAIR_ALLOW_DATA_LOSS, understand that it can delete rows or pages to make the database consistent — run it only after a backup and only if restore is not an option. Put the database in single-user mode first:ALTER DATABASE YourDatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE; - Rebuild indexes on the affected table. After a successful repair, rebuild all indexes on the table named in the error. In SSMS, right-click the table, choose Script Table as, and adapt, or use:
ALTER INDEX ALL ON dbo.YourTable REBUILD;
This forces SQL Server to re-read and rewrite every page, which surfaces any remaining damage. - Re-run DBCC CHECKDB with no repair option. Confirm the output now says CHECKDB found 0 allocation errors and 0 consistency errors. If errors remain, do not return the database to service; go back to the backup or escalate to a data recovery specialist.
- Return the database to multi-user mode and monitor. Run
ALTER DATABASE YourDatabaseName SET MULTI_USER;and watch the error log for 24–48 hours. If 1123 reappears on the same table, suspect a hardware or driver problem rather than a one-off page issue.
Common Mistakes
- Running REPAIR_ALLOW_DATA_LOSS first. It can delete rows and pages, and it is not reversible without a backup. Always start with REPAIR_REBUILD and only escalate if CHECKDB says so.
- Skipping the backup before repair. A repair that fails halfway leaves the database in a worse state than before.
- Ignoring the underlying I/O errors. Restoring onto the same failing disk will reproduce the corruption. Check storage, cables, controller firmware, and antivirus exclusions for SQL Server data and log files.
- Running CHECKDB during peak hours. It is I/O-heavy and can block or slow production workloads; schedule it in a maintenance window.
- Assuming the error names the table you need to fix. The page may belong to an index, and the object ID in the message is the reliable identifier.
Tips
- Run DBCC CHECKDB regularly (weekly is common) so you catch corruption before it spreads to backups.
- Keep backups on separate physical storage from the data files; corruption on the same disk affects both.
- Use
WITH NO_INFOMSGS, ALL_ERRORMSGSto keep CHECKDB output readable and complete. - Record the page ID from the error; it helps you confirm whether the same page is involved after a repair.
- If the database is large, consider CHECKDB WITH PHYSICAL_ONLY for frequent quick checks and a full CHECKDB less often.
Troubleshooting
If CHECKDB reports errors that REPAIR_REBUILD cannot fix and you have no clean backup, the remaining options are REPAIR_ALLOW_DATA_LOSS (accepting possible row loss) or professional data recovery. If the database will not come out of single-user mode, check for open connections with sp_who2 and kill them, then retry ALTER DATABASE ... SET MULTI_USER. If the error returns immediately after a restore, the backup itself is corrupt; try an older backup. If 1123 appears on a secondary replica in an availability group, remove and re-add the secondary database rather than repairing it directly. If the error log shows 823 or 824 alongside 1123, treat it as a storage problem first: run vendor diagnostics on the disk and controller before touching SQL Server again.
Frequently Asked Questions
Is error 1123 always corruption?
Almost always. It means a page's type does not match the metadata for the object, which is a consistency failure. Very rarely, a bug or a failed restore can produce it, but treat it as corruption until CHECKDB proves otherwise.
Can I fix it without downtime?
No. CHECKDB with repair requires exclusive access, and a restore replaces the database. Plan a maintenance window.
Will REPAIR_ALLOW_DATA_LOSS delete my data?
It can. It removes or rewrites pages to make the database consistent, which may mean losing rows. Back up first and restore instead whenever a clean backup exists.
Does rebuilding the index fix 1123?
Sometimes. If the damage is confined to an index, a rebuild rewrites the pages and can resolve it. If the base table pages are affected, you need CHECKDB repair or a restore.
How do I prevent it from happening again?
Fix the underlying storage issue, run regular CHECKDB, keep backups on separate hardware, and exclude SQL Server data and log directories from antivirus real-time scanning per Microsoft's guidance.
Can I run CHECKDB on a production database?
Yes, but it is I/O-intensive. Run it in a maintenance window or on a restored copy if the database is busy.