Database file corruption may not be confirmed until the database server tries to access the affected part of the database. As part of your backup and recovery plan, you should periodically check that your database is valid by using tools such as the Validate Database Wizard in Sybase Central, or the Validation utility (dbvalid). You should validate your database both before and after you perform a backup. You must have VALIDATE authority to perform validation activities. See VALIDATE authority.
When you start a backup copy of a database to validate it, you can use the -ds database option to specify the location of dbspace files and the transaction log. This allows you to start the backed up copy of the database on the same computer as the original database while the original database is still running. See -ds dbeng12/dbsrv12 database option.
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 -fx option) does not validate data, continued row structure, or foreign key relationships.
Backup copies of the database and transaction log must not be changed in any way. 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.
However, if transactions were in progress, or if you specified BACKUP DATABASE WITH CHECKPOINT LOG COPY, the database server must perform recovery on the database when you start it. Recovery modifies the backup copy, which is not desirable.
If you can be sure that no transactions are in progress when the backup is being made, the database server does not need to perform recovery steps. In this case, you can perform a validity check on the backup using the read-only database option. See -r dbeng12/dbsrv12 server option.
Using the BACKUP statement with the WAIT BEFORE START clause ensures that no transactions are in progress when you start a backup.
Validation requires exclusive access to the object being validated. 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, treat it 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 reload.
Discuter à propos de cette page dans DocCommentXchange.
|Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1|