Thursday, March 12, 2009

Checking Database Integrity

There are at least two commands one can run to check the integrity of a MSSQL database. They are:

DBCC CHECKCONSTRAINTS

and

DBCC CHECKDB

The latter actually runs the following inclusively, so unless you want to be extremely granular about your process, you only need run DBCC CHECKDB:

  • Runs DBCC CHECKALLOC on the database.
  • Runs DBCC CHECKTABLE on every table and view in the database.
  • Runs DBCC CHECKCATALOG on the database.


Here is Microsoft's excellent reference:
http://msdn.microsoft.com/en-us/library/ms188796.aspx

No comments: