SQL Server Error 1119: Fix IAM Page Removal Failed
In this article
SQL Server error 1119 means the storage engine tried to remove an Index Allocation Map (IAM) page from a table or index and could not because another session or internal process still had a reference to it. The practical fix is to stop the competing activity, take the object offline or into single-user mode, and then rebuild or reorganize the affected index so the IAM chain is regenerated cleanly. You cannot safely force the removal of an IAM page while other sessions are touching the object, so the goal is to remove the contention first and then repair the allocation structures.
What You'll Need
- Membership in the sysadmin fixed server role or equivalent permissions to run DBCC commands and ALTER INDEX.
- The name of the database and the object (table or index) named in the error message.
- A maintenance window, because the repair steps can block other users.
- A current backup of the database before running any DBCC repair option that can change data pages.
- Access to SQL Server Management Studio (SSMS) or another client that can run T-SQL.
Step-by-Step
- Read the full error text. Error 1119 usually appears alongside a message that names the database, the object ID, and the IAM page. Note those values. If you only have the generic text, query
sys.objectsin the affected database to translate the object ID into a table or index name. - Identify what else is using the object. Run
sp_who2or querysys.dm_exec_requestsandsys.dm_tran_locksfiltered on the object. Look for long-running transactions, open cursors, replication agents, or background jobs that hold locks or references on the table. The error is telling you that something still has a handle on the allocation structure. - Stop the competing activity. Disable or pause SQL Server Agent jobs, ETL processes, or application connections that touch the table. If a specific session is holding a transaction, ask the application owner to commit or roll back, or kill the session only after confirming it is safe to do so. Killing a session rolls back its transaction and can take time on a large transaction.
- Put the database into single-user mode if needed. From a query window connected to the master database, run
ALTER DATABASE [YourDB] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;. This disconnects other sessions. Warn users first. When you are finished, restore access withALTER DATABASE [YourDB] SET MULTI_USER;. - Run a consistency check to confirm the scope. Execute
DBCC CHECKDB ([YourDB]) WITH NO_INFOMSGS;. Review the output for allocation errors, including 1119, and note whether the problem is limited to one index or spreads across multiple objects. Do not run repair options yet. - Rebuild the affected index. In most cases the cleanest fix is
ALTER INDEX [IndexName] ON [Schema].[Table] REBUILD;. If the error names a heap, create a clustered index or rebuild the table. Rebuilding regenerates the IAM pages and removes the stale reference. If the index is very large, useWITH (ONLINE = ON)where the edition supports it, though online rebuild still needs a brief lock at the end. - If rebuild is not possible, try reorganize.
ALTER INDEX [IndexName] ON [Schema].[Table] REORGANIZE;is lighter but may not clear every allocation problem. Use it only when a rebuild would be too disruptive and you have confirmed the error is transient. - Re-run DBCC CHECKDB. Confirm that error 1119 no longer appears and that no new allocation errors were introduced. If the check is clean, return the database to multi-user mode and re-enable the jobs and connections you paused.
Common Mistakes
- Running
DBCC CHECKDB ... REPAIR_ALLOW_DATA_LOSSas a first step. That option can delete pages and should only be used as a last resort after a backup and with a clear understanding of what will be lost. - Killing sessions without checking what they are doing. A long rollback can make the outage worse than the original error.
- Forgetting to return the database to MULTI_USER, leaving applications unable to connect.
- Rebuilding only the index named in the error while ignoring related indexes on the same table that share allocation structures.
- Assuming the error is corruption. Error 1119 is often a contention or transient allocation issue, not physical damage.
Tips
- Capture the exact error text and the object ID before doing anything; the message is your best clue about which object to target.
- Schedule index maintenance during low-activity windows so IAM changes do not collide with user queries.
- Keep statistics and index maintenance jobs from overlapping with large data loads.
- After a repair, review the SQL Server error log and the default trace for related allocation messages.
- If the same object repeatedly produces 1119, consider whether a background process such as replication or change tracking is holding references.
Troubleshooting
If the error persists after a rebuild, check whether the database is involved in replication, mirroring, or availability groups; secondary replicas and log readers can hold references that block allocation changes. In that case, pause the relevant agent or fail over according to your high-availability plan.
If DBCC CHECKDB reports additional consistency errors, do not run repair options on a production database without a verified backup. Restore the backup to a test server, run the repair there, and compare results before touching production. For severe corruption, contact Microsoft support rather than improvising.
If the object cannot be rebuilt because it is a system table or an internal structure, the error may indicate a broader storage problem. Check disk health, review Windows event logs, and confirm that the SQL Server service account has adequate permissions on the data files.
If applications reconnect immediately and re-trigger the error, use a login trigger or firewall rule to keep them out during the repair, then remove it afterward.
Frequently Asked Questions
Is SQL Server error 1119 a sign of database corruption?
Not necessarily. It often indicates contention or a transient allocation state. Run DBCC CHECKDB to determine whether actual corruption exists.
Can I fix error 1119 without downtime?
Sometimes, if the competing session can be stopped and an online index rebuild is supported. Otherwise a short maintenance window is the safest route.
Does rebuilding the index always fix it?
Rebuilding regenerates IAM pages and resolves most cases, but if another process still holds a reference, the error can return until that process is stopped.
Should I use REPAIR_ALLOW_DATA_LOSS?
Only as a last resort, after a verified backup, and with the understanding that pages may be removed and data lost.
Why does the error mention a page I cannot find?
IAM pages are internal allocation structures, not user data pages. Use the object ID in the message to locate the table or index rather than searching for the page directly.
Can this error appear after a restore or attach?
Yes. Restoring or attaching a database while other sessions are active can produce allocation messages. Retry the operation with the database in single-user mode.