Verify data consistency before backing up a database

Having backups of a database sometimes is not enough—you must have consistent, accurate backups (especially for master). If you back up a database that contains internal errors, the database will have the same errors when you restore it.

Using the dbcc commands, you can check a database for errors before backing it up. Always use dbcc commands to verify the integrity of a database before dumping it. If dbcc detects errors, correct them before dumping the database.

Over time, you can begin to think of running dbcc as insurance for your databases. If you discovered few or no errors while running dbcc in the past, you may decide that the risk of database corruption is small and that dbcc needs to be run only occasionally. Or, if the consequences of losing data are too high, you should continue to run dbcc commands each time you back up a database.

NoteFor performance considerations, many sites choose to run dbcc checks outside of peak hours or on separate servers.

See Chapter 25, “Checking Database Consistency,” for information about the dbcc command.