SQL Server Error 1102: Fix Incorrect IAM Page
In this article
SQL Server error 1102 means the Index Allocation Map (IAM) page for a given object ID is inconsistent with the actual data pages, and the fastest safe fix is to run DBCC CHECKDB to confirm the extent of the damage, then restore from a known-good backup or repair with DBCC CHECKDB REPAIR_ALLOW_DATA_LOSS as a last resort. Before you touch anything, take a full backup of the affected database and, if possible, a copy of the MDF and LDF files, because every repair option below can remove data. This guide walks through the diagnostic and recovery sequence in the order a DBA should follow it.
What You'll Need
- Membership in the sysadmin fixed server role or an account with DBCC CHECKDB and backup permissions on the database.
- SQL Server Management Studio (SSMS) or Azure Data Studio connected to the instance.
- Enough free disk space to hold a full backup plus a copy of the database files.
- The most recent known-good backup of the database, if one exists.
- A maintenance window: CHECKDB and repair operations can be slow and block users.
- Access to the SQL Server error log and Windows Event Log for context on when the error appeared.
Step-by-Step
- Capture the exact error text. Open the SQL Server error log in SSMS under Management > SQL Server Logs, or query the system view with
EXEC sp_readerrorlog. Note the object ID, the database name and the message. The full text usually reads similar to: "Error: 1102, Severity: 22, State: 1. The IAM page for object ID n is incorrect." Write down the object ID; you will need it later. - Put the database in single-user mode if the error is blocking startup. If the database will not come online, stop the SQL Server service and restart it with the
-mstartup parameter (via SQL Server Configuration Manager > Startup Parameters, or from a command prompt withsqlservr.exe -m). This lets only one connection in, which is enough to run diagnostics. - Take a full backup immediately. In SSMS, right-click the database > Tasks > Back Up. Choose Full, pick a destination file, and verify the backup completes. Also copy the MDF and LDF files to another folder using Windows Explorer while the service is stopped. If the database is corrupt, this backup is your safety net before any repair attempt.
- Run DBCC CHECKDB in read-only mode first. In a query window against the affected database, run
DBCC CHECKDB ('YourDatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS;. Read the output carefully. CHECKDB will tell you which object is affected, whether the corruption is in a clustered index, a nonclustered index or a heap, and it will suggest a minimum repair level (REPAIR_REBUILD or REPAIR_ALLOW_DATA_LOSS). - Identify the object. Use the object ID from the error with
SELECT OBJECT_NAME(object_id);in the database context, or querysys.objects. If the object is a nonclustered index, you can often fix the problem by dropping and recreating that index, which is far safer than repairing the whole database. - Try a clean restore first. If you have a recent full backup plus log backups, restore them to a new database name, run
DBCC CHECKDBon the restored copy, and if it is clean, switch applications to the restored database. This is the only method that guarantees no data loss from the corruption itself. - If no good backup exists, rebuild the affected index. For a nonclustered index, run
ALTER INDEX IndexName ON Schema.Table REBUILD;. For a clustered index, the same command rebuilds the table's data pages, which can resolve IAM inconsistencies. Re-run CHECKDB afterward to confirm the error is gone. - Use REPAIR_REBUILD as the next step. Run
DBCC CHECKDB ('YourDatabaseName', REPAIR_REBUILD) WITH ALL_ERRORMSGS;. This repairs index-related corruption without deleting data. It requires the database to be in single-user mode. Re-run CHECKDB afterward. - Use REPAIR_ALLOW_DATA_LOSS only as a last resort. If REPAIR_REBUILD cannot fix the IAM page, run
DBCC CHECKDB ('YourDatabaseName', REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS;in single-user mode. Be aware: this can delete rows or entire pages to make the database consistent. Record what CHECKDB reports as removed, then compare row counts against the last known-good backup or application records. - Return the database to multi-user mode. Run
ALTER DATABASE YourDatabaseName SET MULTI_USER;and remove the-mstartup parameter if you added it. Restart the SQL Server service normally. - Run a final integrity check. Run
DBCC CHECKDBonce more with no repair option. A clean result means the IAM page is consistent. Schedule regular CHECKDB jobs going forward so you catch corruption earlier.
Common Mistakes
- Skipping the backup before repair. REPAIR_ALLOW_DATA_LOSS can delete data, and without a backup you cannot compare what was lost.
- Running repair commands in multi-user mode. DBCC repair options require single-user mode; otherwise they fail with a message about the database being in use.
- Assuming the error is always a disk failure. It can also come from abrupt shutdowns, antivirus interference with MDF/LDF files, or faulty storage drivers. Check the Windows Event Log for disk warnings.
- Dropping and recreating a clustered index without checking dependencies. Foreign keys and other indexes may need to be recreated afterward.
- Ignoring the object ID. The ID tells you whether the problem is a table, an index or a system object; repairing the wrong object wastes time.
Tips
- Run
DBCC CHECKDBwithWITH PHYSICAL_ONLYon very large databases during the week, and a full check on weekends, to keep detection fast. - Store backups on separate physical media from the database files so a single disk failure does not take both.
- Exclude MDF, LDF and backup folders from real-time antivirus scanning to reduce the chance of file-level corruption.
- Keep the SQL Server error log retention long enough to see when the 1102 error first appeared; this helps correlate with hardware events.
- If the same object ID keeps producing IAM errors after repair, suspect failing storage and run the manufacturer's drive diagnostics.
Troubleshooting
If DBCC CHECKDB itself fails to run because the database is offline or suspect, try ALTER DATABASE YourDatabaseName SET EMERGENCY; followed by ALTER DATABASE YourDatabaseName SET SINGLE_USER; and then run CHECKDB with REPAIR_ALLOW_DATA_LOSS. If the database is marked SUSPECT, restore from backup is usually the only reliable path. If repair reports that it cannot fix the IAM page, the corruption may be in a system table; in that case, restore the master or msdb database from backup if those are affected, or rebuild the system databases as a last resort. If the error returns immediately after repair, check the storage subsystem: run chkdsk on the volume during a maintenance window, review SMART data from the drive vendor's tool, and confirm the SQL Server service account has full control on the data folder. If you are not comfortable running repair commands, engage a qualified SQL Server professional; a wrong repair can turn a recoverable database into an unrecoverable one.
Frequently Asked Questions
What causes SQL Server error 1102?
The IAM page that tracks which extents belong to an object no longer matches the actual allocation. Common causes are sudden power loss, storage controller failures, antivirus locking database files, and physical disk errors.
Can I fix error 1102 without losing data?
Often yes, by restoring a clean backup or by rebuilding the affected index. REPAIR_REBUILD also preserves data. REPAIR_ALLOW_DATA_LOSS may delete rows, so use it only after backups and with the understanding that some data can be lost.
Does error 1102 mean my database is corrupt?
Yes. It is an allocation consistency error, which is a form of logical corruption. The database may still be readable, but you should treat it as corrupt until CHECKDB returns clean.
Do I need to take the database offline to repair it?
Repair options require single-user mode, which effectively takes the database offline for other users. Plan a maintenance window and notify users before you begin.
How often should I run DBCC CHECKDB?
At least weekly for most production databases, and more often for high-transaction systems. Adjust based on database size and your recovery point objective.
Will restoring from backup definitely fix error 1102?
Only if the backup itself is clean. Always run DBCC CHECKDB on the restored copy before switching applications over to it.