Verifying a Database Backup

Sybase IQ includes a mechanism that verifies an existing Sybase IQ version 12.6 or later database backup using the VERIFY clause of the RESTORE SQL statement.

The verification process directs the server to validate the specified Sybase IQ database backup archives for a full, incremental, incremental since full, or virtual backup, and to check the specified archive for the same errors a restore process checks, but performs no write operations. All status and error messages are written to the server log file.

The backup verification process can run on a different host than the database host. You must have DBA, BACKUP, or OPERATOR authority to run RESTORE VERIFY.

For syntax and usage of the RESTORE VERIFY clause, see the RESTORE statement in Reference: Statements and Options.

Note: The verification of a backup archive is different than the database consistency checker (DBCC) verify mode (sp_iqcheckdb 'verify...'). RESTORE VERIFY validates the consistency of the backup archive to be sure it can be restored, whereas DBCC validates the consistency of the database data.

Run sp_iqcheckdb 'verify...' before taking a backup. If an inconsistent database is backed up, then restored from the same backup archive, the data continues to be in an inconsistent state, even if RESTORE VERIFY reports a successful validation.

Verification of an Incremental Backup

Use the RESTORE… VERIFY COMPATIBLE clause to check the compatibility of an incremental archive with the existing database files. If the database files do not exist on the system on which you invoke RESTORE…VERIFY COMPATIBLE, an error is returned. If you specify COMPATIBLE while verifying a full backup, the keyword is ignored; no compatibility checks need to be made while restoring a full backup.

If you specify RESTORE VERIFY without COMPATIBLE for an incremental restore, Sybase IQ does not look for any dbspaces and does not perform any compatibility checks. No warning is reported, even if the files do not exist. The compatibility check is performed only when you include the COMPATIBLE clause.

If you specify RESTORE VERIFY COMPATIBLE for an incremental restore, and the IQ catalog store or any of the Sybase IQ dbspaces do not exist, the compatibility check cannot be made; an error is reported and the operation fails.

During validation of an incremental backup, the RESTORE VERIFY COMPATIBLE process opens the Sybase IQ dbspaces in read-only mode to perform consistency checking. No dbspaces are modified.

In incremental restores, if the database has been modified or the particular incremental archive is not the correct archive for the database, RESTORE VERIFY COMPATIBLE reports the error Database has changed since last restore. (SQLCODE -1012008, SQLSTATE QUA08) or This restore cannot immediately follow the previous restore. (SQLCODE -1012009, SQLSTATE QUA09).

Verification Progress Reporting

The RESTORE VERIFY process verifies every stripe specified in the command. As the verification process checks stripes and their corresponding files, it reports progress in terms of the number of IQ blocks verified. After every 5000 IQ blocks verified, a message is written to the server log file:
5000/100000 (5%) Blocks verified

A final message is written to the server log file when 100% of the IQ blocks are verified.

The messages RESTORE VERIFY Started, the number of IQ blocks to be verified, and RESTORE VERIFY successfully completed are also written in the server log, when the verify action starts and completes, respectively. For example:
I. 11/17 06:45:24. VERIFY RESTORE Started
I. 11/17 06:45:24. Total number of IQ blocks to be verified: 764
I. 11/17 06:45:24. Total number of IQ blocks verified: 764/764 ( 100 % )
I. 11/17 06:45:24. VERIFY RESTORE Successfully Complete 

Verification Error Reporting

If the verification process finds errors after which it can continue, the process continues checking the archive and logs information for the errors detected.

The errors for which the verification can continue are:

  • Header of block to be restored appears to be corrupted. (SQLCODE -1012011l, SQLSTATE QUA11)
  • Media data appears corrupted (bad checksum). (SQLCODE -1012012, SQLSTATE QUA12)
  • Media meta data appears corrupted (boundary record). (SQLCODE -1012013, SQLSTATE QUA13)
  • Media meta data appear corrupted (multiple begin boundary records). (SQLCODE -1012014, SQLSTATE QUA14

If any of these errors are found and the verification process can continue to the end of the archive, Sybase IQ reports this error:

The verification of the provided archive has failed. Please check the server log for details of the errors thrown during verify.

If any error pertaining to RESTORE is found other than the errors above, the error that occurred is reported, and the verification process stops.

Related concepts
Before You Restore
Command Line Options that Control Permissions
Moving Database Files
The Utility Database
Utility Database Server Security
Performing Backups with Non-Sybase Products
Recording dbspace Names
Restoring in the Correct Order
Specifying Archive Devices
The RESTORE Statement