OceanBase Database allows you to validate a backup set or log archive piece in a specified path. This method is suitable for validating cross-cluster backups or cold backups.
Limitations and considerations
Since verification tasks frequently access backup media to read data, which may interfere with backup tasks, it is recommended to execute verification tasks when no backup tasks are running and the system is under low load.
When specifying the verification level for backup verification:
For backup sets and log archive pieces from versions earlier than V4.6.0, Basic verification is not supported, which means file integrity verification is not supported.
For backup sets from versions earlier than V4.3.4, Physical verification is not supported, which means physical data correctness and logical consistency verification are not supported.
If the specified backup set for verification includes an incremental backup set, under the Physical verification level, the specified path must contain the full backup set that the incremental backup set depends on. Otherwise, the verification will fail.
Validate a backup set at a specified path
Validate a backup set in the specified path of a user tenant
Log in to the
systenant of the cluster as therootuser.The following example shows how to connect to the database. Please replace the actual environment variables with the correct values.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AExecute the following command to validate the backup set in the specified path of a user tenant.
The statement is as follows:
ALTER SYSTEM VALIDATE BACKUPSET [= 'backup_set_id[,backup_set_id,...]'] DATA_BACKUP_DEST = 'data_backup_path' [LEVEL = { 'basic' | 'physical' }] TENANT = tenant_name;The parameters in the statement are described as follows:
BACKUPSET: specifies the backup set to be validated. You can validate all backup sets in the backup path specified by the user tenant or a specified list of backup sets. If you specify a list of backup sets, separate thebackup_set_idvalues of the backup sets with commas (,). If you do not specify thebackup_set_idvalue, all backup sets in the backup path specified by the user tenant are validated by default.In cross-cluster or cold backup scenarios, you can obtain the
backup_set_idvalue of a backup set from the file name in the backup directory. For more information about the backup directory structure, see Data backup directory in Overview of physical backup and restore.Notice
If you do not specify
backup_set_id, the system will validate all backup sets in the current backup path, which will generate a large number of validation tasks and take a long time. If you do not need to validate all backup sets, we recommend that you specifybackup_set_idin the validation command.DATA_BACKUP_DEST: specifies the path where the backup set is stored.Notice
OceanBase Database does not support specifying multiple paths in a single command. Therefore, when you specify
backup_set_idto validate an incremental backup set, an error may occur because the incremental backup set depends on other backup sets. The error code is 9159.LEVEL: an optional parameter that specifies the validation level. The default value isphysical. The options are as follows:basic: validates only the integrity of the file list.physical: validates the correctness and logical consistency of the physical data.
TENANT: specifies the user tenant to execute the validation task.
Here are some examples:
The
systenant validates all backup sets in the specified backup path of themysqltenantuser tenant in Basic mode.obclient(root@sys)[(none)]> ALTER SYSTEM VALIDATE BACKUPSET DATA_BACKUP_DEST = 'file:///data/nfs/backup/data' LEVEL = 'basic' TENANT = mysqltenant;The
systenant validates the backup sets withbackup_set_idvalues of 1 and 2 in the specified backup path of themysqltenantuser tenant in Physical mode.obclient(root@sys)[(none)]> ALTER SYSTEM VALIDATE BACKUPSET = '1,2' DATA_BACKUP_DEST = 'file:///data/nfs/backup/data' LEVEL = 'physical' TENANT = mysqltenant;
After the statement is successfully executed, you can view the status, progress, and execution result of the validation task by querying the
CDB_OB_BACKUP_VALIDATE_JOBS,CDB_OB_BACKUP_VALIDATE_TASKS,CDB_OB_BACKUP_VALIDATE_JOB_HISTORY, andCDB_OB_BACKUP_VALIDATE_TASK_HISTORYviews.For more information about how to view the backup validation progress, see View the backup validation progress.
For more information about how to view the backup validation result, see View the backup validation result.
Validate a backup set in the specified path of the current tenant
Log in to the database as the tenant administrator of the user tenant.
Note
The administrator user of a MySQL tenant is
root, and the administrator user of an Oracle tenant isSYS.The following example shows how to connect to the database. Please replace the parameters with those in your actual environment.
obclient -h10.xx.xx.xx -P2883 -uroot@mysql001#obdemo -p***** -AExecute the following statement to validate the backup set in the specified path.
The statement is as follows:
ALTER SYSTEM VALIDATE BACKUPSET [= 'backup_set_id[,backup_set_id,...]'] DATA_BACKUP_DEST = 'data_backup_path' [LEVEL = { 'basic' | 'physical' }];The parameters in the statement are described as follows:
BACKUPSET: specifies the backup set to be validated. You can validate all backup sets in the specified backup path of the tenant or a specified list of backup sets. If you specify a list of backup sets, separate thebackup_set_idvalues of the backup sets with commas. If you do not specify thebackup_set_idvalue, all backup sets in the specified backup path of the tenant are validated by default.In a cross-cluster or cold backup scenario, you can obtain the
backup_set_idvalue of a backup set from the filename in the backup directory. For more information about the backup directory structure, see Data backup directory in Overview of physical backup and restore.Notice
If you do not specify
backup_set_id, the system will validate all backup sets in the current backup path, which will generate a large number of validation tasks and take a long time. If you do not need to validate all backup sets, we recommend that you specifybackup_set_idin the validation command.DATA_BACKUP_DEST: specifies the storage path of the backup set.Notice
OceanBase Database does not support specifying multiple paths in a single statement. Therefore, when you specify
backup_set_idto validate an incremental backup set in the specified path, an error may occur because the incremental backup set depends on other backup sets. The error code is 9159.LEVEL: an optional parameter that specifies the validation level. If you do not specify this parameter, the default value isphysical. The parameter can take the following values:basic: validates only the completeness of the file list.physical: validates the correctness and logical consistency of the physical data.
Here are some examples:
Validate all backup sets in the specified backup path of the current tenant by using the basic validation level.
obclient> ALTER SYSTEM VALIDATE BACKUPSET DATA_BACKUP_DEST = 'file:///data/nfs/backup/data' LEVEL = 'basic';Validate the backup sets with
backup_set_idvalues of 1 and 2 in the specified backup path of the current tenant by using the physical validation level.obclient> ALTER SYSTEM VALIDATE BACKUPSET = '1,2' DATA_BACKUP_DEST = 'file:///data/nfs/backup/data' LEVEL = 'physical';
After the statement is successfully executed, you can query the
DBA_OB_BACKUP_VALIDATE_JOBS,DBA_OB_BACKUP_VALIDATE_TASKS,DBA_OB_BACKUP_VALIDATE_JOB_HISTORY, andDBA_OB_BACKUP_VALIDATE_TASK_HISTORYviews to view the status, progress, and execution result of the validation task.For more information about how to view the validation progress, see View the backup validation process.
For more information about how to view the validation result, see View the backup validation history.
Validate the log archive piece in a specified path
Validate the log archive piece in a specified path of a user tenant from the sys tenant
Log in to the
systenant of the cluster as therootuser.The following example shows how to connect to the database. Replace the actual environment variables.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AExecute the following command to validate the log archive piece in the specified path of the user tenant.
The statement is as follows:
ALTER SYSTEM VALIDATE ARCHIVELOG_PIECE [= 'piece_id[,piece_id,...]'] LOG_ARCHIVE_DEST = 'log_archive_path' [LEVEL = { 'basic' | 'physical' }] TENANT = tenant_name;The parameters in the statement are described as follows:
ARCHIVELOG_PIECE: specifies the log archive piece to be validated. You can specify the log archive piece in the specified archive path of the tenant or the specified list of log archive pieces. If you specify the list of log archive pieces, separate thepiece_idvalues with commas. If you do not specifypiece_id, the system validates all log archive pieces in the archive path specified by the tenant.In a cross-cluster or cold backup scenario, you can obtain the
piece_idof the log archive piece from the file name in the archive directory. For more information about the archive directory structure, see Log archive directory in Overview of physical backup and restore.Notice
If you do not specify
piece_id, the system validates all log archive pieces in the specified archive path, which generates a large number of validation tasks and takes a long time. If you do not need to validate all log archive pieces, we recommend that you specifypiece_idin the validation command.LOG_ARCHIVE_DEST: specifies the path where the log archive piece is stored.LEVEL: an optional parameter that specifies the validation level. If you do not specify this parameter, the default value isphysical. The following table describes the validation levels.basicvalidation: only checks the integrity of the file list.physicalvalidation: checks the correctness and logical consistency of the physical data.
TENANT: specifies the user tenant to be validated.
Here are some examples:
Validate all log archive pieces in the specified archive path of the sys tenant in basic mode.
obclient(root@sys)[(none)]> ALTER SYSTEM VALIDATE ARCHIVELOG_PIECE LOG_ARCHIVE_DEST = 'file:///data/nfs/backup/archive' LEVEL = 'basic' TENANT = tenant1;Validate the log archive pieces with
piece_idvalues of 1 and 2 in the specified archive path of the sys tenant in physical mode.obclient(root@sys)[(none)]> ALTER SYSTEM VALIDATE ARCHIVELOG_PIECE = '1,2' LOG_ARCHIVE_DEST = 'file:///data/nfs/backup/archive' LEVEL = 'physical' TENANT = tenant1;
After the statement is successfully executed, you can query the status, progress, and execution result of the validation task from the
CDB_OB_BACKUP_VALIDATE_JOBS,CDB_OB_BACKUP_VALIDATE_TASKS,CDB_OB_BACKUP_VALIDATE_JOB_HISTORY, andCDB_OB_BACKUP_VALIDATE_TASK_HISTORYviews.For more information about how to view the backup validation progress, see View the backup validation progress.
For more information about how to view the backup validation result, see View the backup validation result.
Validate the log archive piece in a specified path of a user tenant from the user tenant
Log in to the database as the administrator of the user tenant.
Note
The administrator of a MySQL tenant is the
rootuser. The administrator of an Oracle tenant is theSYSuser.The following example shows how to connect to the database. Replace the actual environment variables.
obclient -h10.xx.xx.xx -P2883 -uroot@mysql001#obdemo -p***** -AExecute the following command to validate the log archive piece in the specified path of the user tenant.
The statement is as follows:
ALTER SYSTEM VALIDATE ARCHIVELOG_PIECE [= 'piece_id[,piece_id,...]'] LOG_ARCHIVE_DEST = 'log_archive_path' [LEVEL = { 'basic' | 'physical' }];The parameters in the statement are described as follows:
ARCHIVELOG_PIECE: specifies the log archive piece to be validated. You can specify the log archive piece in the current archive path of the tenant or the specified list of log archive pieces. If you specify the list of log archive pieces, separate thepiece_idvalues with commas. If you do not specifypiece_id, the system validates all log archive pieces in the current archive path of the tenant.In a cross-cluster or cold backup scenario, you can obtain the
piece_idof the log archive piece from the file name in the archive directory. For more information about the archive directory structure, see Log archive directory in Overview of physical backup and restore.Notice
If you do not specify
piece_id, the system validates all log archive pieces in the specified archive path, which generates a large number of validation tasks and takes a long time. If you do not need to validate all log archive pieces, we recommend that you specifypiece_idin the validation command.LOG_ARCHIVE_DEST: specifies the path where the log archive piece is stored.LEVEL: an optional parameter that specifies the validation level. If you do not specify this parameter, the default value isphysical. The following table describes the validation levels.basicvalidation: only checks the integrity of the file list.physicalvalidation: checks the correctness and logical consistency of the physical data.
Here are some examples:
Validate all log archive pieces in the specified archive path of the user tenant in basic mode.
obclient> ALTER SYSTEM VALIDATE ARCHIVELOG_PIECE LOG_ARCHIVE_DEST = 'file:///data/nfs/backup/archive' LEVEL = 'basic';Validate the log archive pieces with
piece_idvalues of 1 and 2 in the specified archive path of the user tenant in physical mode.obclient> ALTER SYSTEM VALIDATE ARCHIVELOG_PIECE = '1,2' LOG_ARCHIVE_DEST = 'file:///data/nfs/backup/archive' LEVEL = 'physical';
After the statement is successfully executed, you can query the status, progress, and execution result of the validation task from the
DBA_OB_BACKUP_VALIDATE_JOBS,DBA_OB_BACKUP_VALIDATE_TASKS,DBA_OB_BACKUP_VALIDATE_JOB_HISTORY, andDBA_OB_BACKUP_VALIDATE_TASK_HISTORYviews.For more information about how to view the backup validation progress, see View the backup validation progress.
For more information about how to view the backup validation result, see View the backup validation result.
