Tuesday, July 9, 2013

SQL Server consistency check

How can you be sure everything is OK with your Sql server database?

Run a consistency check to check the database objects logical and physical integrity

- DBCC CHECKDB - checks the entire database. Executes CHECKALLOC, CHECKCATALOG and CHECKTABLE for every table and view
- DBCC CHECKALLOC - checks the consistency of disk space allocation for a specific database
- DBCC CHECKCATALOG - checks catalog consistency for a specific online database
- DBCC CHECKTABLE - checks the integrity of all pages and structures in a specific table/indexed view
- DBCC CHECKFILEGROUP - executes CHECKALLOC and CHECKTABLE for every table in the filegroup you specified