Show TOC

Database ValidationLocate this document in the navigation structure

Database file corruption may not be reported until the database server tries to access the affected part of the database. You should periodically check that your database is valid by using tools such as the Validation utility (dbvalid), the sa_validate system procedure, or the VALIDATE statement.

Depending on the options you specify, validation can include checksums, correctness of index data, and whether all table pages belong to objects in the database. Express database validation (the dbvalid -fx option) does not validate data, continued row structure, or foreign key relationships. You can also specify the WITH EXPRESS CHECK clause in the VALIDATE statement to disable referential integrity checking.

Validation does not acquire exclusive access to the table being validated and may report corruption if the table is modified during validation. For this reason, it is best to validate when there is no other activity on the database. If a base table in the database file is corrupt, you should treat the situation as a media failure and recover from your previous backup. If an index is corrupt, you may want to unload the database without indexes, and then reload it. You can also use the REBUILD clause of the ALTER INDEX statement to correct index corruption.

Tip

Using the BACKUP statement with the WAIT BEFORE START clause ensures that no transactions are in progress when you start a backup. If there were no transactions in progress during the backup, or if you specified BACKUP DATABASE WITH CHECKPOINT LOG RECOVER or WITH CHECKPOINT LOG NO COPY, you can check the validity of the backup database using read-only mode or by validating a copy of the backup database.