mco_backup_verify

Check the backup consistency without restoring the database.

For an overview see page Incremental Online Backup in C

Prototype

    void mco_backup_verify(
        /*IN*/  mco_db_h con,
        /*IN*/  const char *file_name,
        /*IN*/  const char *label,
        /*IN*/  const char *cipher,
        /*IN*/  char *err_buf,
        /*IN-OUT*/ unsigned int *err_buf_sz
    );

Arguments

con
Database connection handle used to validate metadata (e.g., database name) against the backup.
file_name
Name of the backup file to verify.
label
Label of the backup point to verify. The function checks all records from the latest snapshot up to this label.
cipher
Optional decryption key if the backup is encrypted. May be NULL for unencrypted backups.
err_buf
Buffer for error message (may be NULL if error details are not needed).
err_buf_sz
On input: size of err_buf. On output: number of characters written. If NULL, the function returns MCO_E_ILLEGAL_PARAM.

Description

This function validates the integrity of a backup file by reading all records from the most recent snapshot up to the specified label and verifying their CRC checksums. It performs the same data validation steps as mco_backup_restore(), but does not modify the database.

This is useful for confirming that a backup is complete, consistent, and ready for future restoration.

See Incremental Backup and Restore for more details.

Return Codes

MCO_S_OK
Backup file is valid and consistent up to the specified label.
MCO_E_DISK_OPEN
Failed to open the backup file.
MCO_E_ILLEGAL_PARAM
One of the following occurred:
  • Incremental backup records in the file are out of order,
  • The specified label was not found,
  • A cipher key is required but not provided.
MCO_E_DISK_SEEK
Failed to seek to the required position in the backup file (possible file corruption).

Example

    {
        mco_db_h con;
        MCO_RET rc;
        const char *filename = "backup.bak";
        const char *label = "v1.2";

        rc = mco_db_connect("mydb", &con);
        if (rc != MCO_S_OK) {
            /* handle connection error */
        }

        rc = mco_backup_verify(con, filename, label, NULL, NULL);
        if (rc != MCO_S_OK) {
            /* handle verification error */
        }
    }

Files

Header file:
mco.h
Source file:
mcoabst.c
Library:
libmcolib.a