Restore backup records starting from the latest snapshot record in the specified file up to the specified label.
void mco_backup_restore(
/*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
);
con
file_name
label
cipher
NULL for unencrypted backups.err_buf
NULL if error details are not needed).err_buf_sz
err_buf. On output: number of characters written. If NULL, the function returns MCO_E_ILLEGAL_PARAM.This function restores a database to the state corresponding to the specified
labelby applying the latest snapshot and all subsequent incremental backup records up to that label.The target database must have identical properties (e.g., page size, memory layout) as the original database that was backed up. Restoration into a database with different configuration is not supported.
See Incremental Backup and Restore for more details.
MCO_S_OK
MCO_E_DISK_OPEN
MCO_E_ILLEGAL_PARAM
label was not found,MCO_E_DISK_SEEK
{
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_restore(con, filename, label, NULL, NULL);
if (rc != MCO_S_OK) {
/* handle restore error */
}
}