Database repair

DBCC can repair both index inconsistencies and allocation problems. The sp_iqcheckdb repair mode is used to repair indexes. The sp_iqcheckdb allocation mode is used in conjunction with the database server startup option -iqdroplks to repair allocation problems.

The repair mode of DBCC can repair many types of index inconsistencies. Repair mode is invoked using the repair keyword in the sp_iqcheckdb command string. No special server startup options are needed for sp_iqcheckdb to fix index problems. The DBCC output indicates which indexes, if any, were repaired. Allocation checks are not performed in repair mode.

Allocation problems can be repaired by starting the database server with the -iqdroplks option and running sp_iqcheckdb 'allocation database'. This is the only DBCC command allowed with the -iqdroplks switch. If DBCC detects index inconsistencies while attempting allocation repair, an error is generated and allocation problems are not fixed.

See the section “Recovering leaked space” for specific information on recovering leaked blocks, (blocks that are allocated, but not used).