Tuesday, December 14, 2010

DBCC (Database repairs)


DBCC CHECKDB can perform repairs of corruption that it finds in the database. But what could you do if you don’t have a backup, and the DBCC returns errors that include:

-          Corruption in a PFS page header
-          Corruption in the leaf level of a critical system catalog index
-          Errors from system catalog cross-checks
-          Data purity errors

You might want to get to know the REPAIR_ALLOW_DATA_LOSS option.
It does what it says. It deletes whatever that is corrupt and fix up all linkages to and from the corrupt object. This is the fastest and easiest way to remove a corruption. But remember, even REPAIR_ALLOW_DATA_LOSS can`t fix every corruption.

You need to set the database to single_user before you run this command.
The syntax:

DBCC CHECKDB (‘DB_NAME’, ‘REPAIR_ALLOW_DATA_LOSS’)

No comments: