SQL Server: How to repair corrupted Clustered Index using REPAIR_REBUILD option

I executed DBCC CHECKTABLE on one of my tables, and I got below error.
“table ‘tbl_students’ (ID 6589332541). Data row does not have a matching index row in the index ‘idx_tbl_students_id’ (ID 88). Possible missing or invalid keys for the index row matching.”

The above error is indicating the corruption of index “idx_tbl_students_id” so few records are missing.
If your index corrupted, there are two possible solutions. One is Restore your database backup and Second is Rebuild your corrupted indexes.

People are using REBUILD command for rebuilding the indexes, but in this article, I repaired the index using option REPAIR_REBUILD of DBCC.

You can use the REPAIR_REBUILD option with DBCC CHECKDB and DBCC CHECKTABLE. While executing those DBCC commands, you can repair corrupted indexes.

This can include quick repairs, such as repairing missing rows in non-clustered indexes, and more time-consuming repairs, such as rebuilding an index.

Following are example,

You can use below article and find script to rebuild all indexes of SQL Server Database:

SQL Server: T-SQL Script to Rebuild all Indexes of a Database

Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from dbrnd.com

Leave a Reply

1 Comment on "SQL Server: How to repair corrupted Clustered Index using REPAIR_REBUILD option"

Notify of
Sort by:   newest | oldest | most voted
Misha Chawla


Thanks for sharing this blog. I agree with you but, In my case, the Repair-Rebuild option did not work. In that case, a third party software “Stellar Phoenix SQL database Repair” helped me to repair corrupt database.