mco_backup_verify
接口适用于实时数据库 RT 。
在不恢复数据库的情况下检查备份一致性。
此功能通过指定的文件名和标签逐条读取备份来测试其有效性,然后检查所有记录的 CRC 校验和。
有关概述,请参阅页面C中的增量备份和恢复。
void mco_backup_verify(
/*IN*/ mco_db_h con,
/*IN*/ char const* file_name,
/*IN*/ char const* label,
/*IN*/ char const* cipher,
/*IN*/ char* err_buf,
/*IN-OUT*/ unsigned int * err_buf_sz
)
参数
con
mco_db_h
用于获取备份文件中数据库名称的数据库连接。
file_name
char const*
要列出的备份文件的名称。
label
char const*
用于恢复的备份标签。
cipher
char const*
用于解密备份的可选密码。
err_buf
char*
错误描述缓冲区。
err_buf_sz
unsigned int *
在输入时,它指定了 err_buf
的大小。在返回时,它包含写入缓冲区的字符数。如果 err_buf_sz
为 null
,则该例程返回 MCO_E_ILLEGAL_PARAM
。
返回
MCO_S_OK
恢复成功了。
MCO_E_DISK_OPEN
无法打开备份文件。
MCO_E_ILLEGAL_PARAM
以下错误情况之一:
- 备份文件中的增量备份顺序错乱。
- 备份文件中未找到标签。
- 未提供备份加密密钥。
MCO_E_DISK_SEEK
在备份文件中设置位置失败。
示例
{
mco_db_h con;
MCO_RET rc;
char * filename = “backup.bak”;
char * label = “a label”;
/* connect to a database */
rc = mco_db_connect( db_name, &con );
/* restore the database */
rc = mco_backup_verify( con, filename, label, 0, 0);
}
文件
- 头文件:
mco.h
- 源文件:
mcoabst.c
- 库:
libmcolib.a