How to Fix SQL Server Error 5229 (Msg 5229)
An incomplete online index build or leftover anti-matter column triggers sql server error 5229. You fix this error by rebuilding the affected index or restoring from a clean backup. Database teams often see this message during routine health checks. It carries a severity level of 16 in the database engine. The warning points to an object ID, index ID, partition ID, and allocation unit ID. You need a clear plan to check the table and clean up the stuck state. What causes sql server error 5229
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
An incomplete online index build or leftover anti-matter column triggers sql server error 5229. You fix this error by rebuilding the affected index or restoring from a clean backup.
Database teams often see this message during routine health checks. It carries a severity level of 16 in the database engine. The warning points to an object ID, index ID, partition ID, and allocation unit ID. You need a clear plan to check the table and clean up the stuck state.
What causes sql server error 5229 in the database engine
During an online index operation, the engine tracks deleted rows using special markers. The database marks these temporary records with an anti-matter column. When the index build finishes, the engine removes these temporary markers from the partition. If a system crash or storage fault interrupts this cleanup, the markers stay behind.
When a routine consistency check scans the table later, it spots the leftover column. The engine knows that normal user data should not keep anti-matter markers after an operation ends. It logs message 5229 with severity 16 to alert the database team. This shows that the specific allocation unit holds unfinished internal state.
Storage subsystem glitches can also corrupt page headers and leave these markers stuck. Heavy write traffic during an aborted index change makes this problem more likely. While the table stays online, you must clear the bad state to keep data safe. Ignoring the error can lead to failed queries or wider index corruption later.
How to diagnose and fix the failure in production
Start by reading the full error log output to find the exact IDs. The message lists the object ID, index ID, partition ID, and allocation unit ID. Match the object ID to the table name and find the specific index. Do not run risky repair tasks right away on a live production system.
First, check if a clean database backup exists from before the error started. If the issue is only in a non-clustered index, you can rebuild that index. Rebuilding the index writes fresh pages and drops the stuck anti-matter records. Run the rebuild during a quiet window to avoid blocking active user apps.
Kubernetes API Server Access + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
If the error sits in the base table or clustered index, take extra care. Test your fix on a restored copy of the database first. After you rebuild the index on the test copy, run a table check again. Make sure the message clears and no rows go missing before touching production.
How to limit access during database repair
Fixing table errors does not mean every engineer needs full admin rights. In this database engine, the db_owner fixed role can run all maintenance tasks. Still, a member of db_owner can also drop the whole database. You cannot change the permissions assigned to fixed database roles.
Give most engineers read-only roles while they check logs and table states. Members of the db_datareader role can read all data from user tables and views. If someone only needs to check one database, use a contained database user. An admin must enable contained databases on the server and database first.
For folks who need access to many databases, use a standard login in master. Keep write roles like db_datawriter away from general debug accounts. When a repair script is ready, let a senior admin review and run it. You can also mask emails, phone numbers, card numbers, and national IDs in query results. Masking rewrites matched fields in results so debug steps stay safe.
Govern SQL Server queries and responses in flight
Table grants decide which SQL Server objects a caller may touch. They do not check query intent or rewrite sensitive values in results across every client and agent. By design, hoop.dev sits inline in the TDS wire protocol next to SQL Server as a sidecar for your SQL Server. On every production batch from an engineer or AI agent, hoop.dev decides to pass, mask, block, or hold it for approval.
With hoop.dev guardrails and hoop.dev data masking, banned statements are refused or held for review, matched sensitive fields in supported result columns are masked in memory, and each decision is logged. Check out the code on GitHub.
Frequently asked questions
What does severity 16 mean for message 5229?
Severity 16 means the error is a general problem that database admins can fix. It does not crash the whole server, but you must check the affected table.
Can I fix this error without taking the database offline?
Yes, if the anti-matter column sits inside a non-clustered index, you can rebuild it. Always check the object ID and index ID first to confirm where the error lives.
Who should have permission to run table repair commands?
Only trusted admins in the db_owner role or server admins should run repair tasks. Regular team members should use db_datareader to check data without changing tables.
Related guides
In this post