Verification of a database backup [CR 487181]

As of version 12.7 ESD #9, Sybase IQ provides a mechanism to verify an existing Sybase IQ version 12.6 or 12.7 database backup using the VERIFY clause of the RESTORE SQL statement. The verification process checks the specified archive for the same errors a restore process checks, but performs no write operations. All status messages and detected errors are written to the server log file.

Syntax

RESTORE DATABASE 'db_file' FROM 'archive_device' [ FROM 'archive_device' ]... [ CATALOG ONLY  ] [ KEY key_spec ] [ [ RENAME dbspace-name TO 'new-dbspace-path']...     | VERIFY [ COMPATIBLE ] ]

See “RESTORE statement” in Chapter 6, “SQL Statements” in Sybase IQ Reference Manual for the complete RESTORE syntax, parameter descriptions, and usage.

Example

RESTORE DATABASE <database_name.db>
FROM '/sys1/dump/dmp1'
FROM '/sys1/dump/dmp2'
VERIFY

Usage

The VERIFY clause of the RESTORE command directs the server to validate the specified Sybase IQ database backup archives for a full, incremental, incremental since full, or virtual backup without performing any write operations.

You cannot use the RENAME clause with the VERIFY clause; the error “VERIFY and RENAME cannot be used together in a RESTORE statement” is reported.

The backup verification process can run on a different host than the database host.

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

NoteThe verification of a backup archive is distinct from 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.

You should 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

If RESTORE VERIFY is specified 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 if the COMPATIBLE clause is specified.

If RESTORE VERIFY COMPATIBLE is specified 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 the validation of an incremental backup, the RESTORE VERIFY COMPATIBLE process opens the Sybase IQ dbspaces in readonly mode in order to do consistency checking. No dbspaces are modified during the verification process.

In the case of 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 the 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 displayed in the server log file with the percentage of the number of IQ blocks completed:

5000/100000 (5%) Blocks verified

A message is displayed in the server log file when 100% of the IQ blocks are verified.

The messages “VERIFY RESTORE Started,” the number of IQ blocks to be verified, and “VERIFY RESTORE 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:

If any of these errors are found and the verification process is able to continue to the end of the archive, the error “The verification of the provided archive has failed. Please check the server log for details of the errors thrown during verify.” is reported.

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

Permissions

Must have DBA or backup authority.

See also