After you set a cleanup policy and the automatic cleanup is triggered, you can view the results of the cleanup tasks in the history table after the cleanup tasks are completed.
View the history of cleanup tasks as 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 with the values in your environment.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AView the history of cleanup tasks.
View the history of job-level cleanup tasks.
The job-level cleanup tasks record the information about the initiation of the cleanup tasks.
obclient(root@sys)[(none)]> SELECT * FROM oceanbase.CDB_OB_BACKUP_DELETE_JOB_HISTORY WHERE TENANT_ID=1002\GThe query result is as follows:
*************************** 1. row *************************** TENANT_ID: 1002 JOB_ID: 4 INCARNATION: 1 INITIATOR_TENANT_ID: 1002 INITIATOR_JOB_ID: 0 EXECUTOR_TENANT_ID: 1002 TYPE: DELETE BACKUPSET PARAMETER: backup_set_id:2,1 JOB_LEVEL: USER_TENANT START_TIMESTAMP: 2025-09-15 14:06:55.225984 END_TIMESTAMP: 2025-09-15 14:07:13.253627 STATUS: FAILED TASK_COUNT: 0 SUCCESS_TASK_COUNT: 0 RESULT: -9045 COMMENT: delete backup set do not allow; cannot_delete_backup_set_in_current_path_when_delete_policy_is_set *************************** 2. row *************************** TENANT_ID: 1002 JOB_ID: 6 INCARNATION: 1 INITIATOR_TENANT_ID: 1002 INITIATOR_JOB_ID: 0 EXECUTOR_TENANT_ID: 1002 TYPE: DELETE OBSOLETE BACKUP PARAMETER: expired_time:2025-09-14 14:30:13.309380 JOB_LEVEL: USER_TENANT START_TIMESTAMP: 2025-09-15 14:30:13.372683 END_TIMESTAMP: 2025-09-15 14:30:13.407852 STATUS: COMPLETED TASK_COUNT: 1 SUCCESS_TASK_COUNT: 1 RESULT: 0 COMMENT: *************************** 3. row *************************** TENANT_ID: 1002 JOB_ID: 7 INCARNATION: 1 INITIATOR_TENANT_ID: 1002 INITIATOR_JOB_ID: 0 EXECUTOR_TENANT_ID: 1002 TYPE: DELETE BACKUPSET PARAMETER: backup_set_id:2,1 JOB_LEVEL: USER_TENANT START_TIMESTAMP: 2025-09-15 14:44:09.511412 END_TIMESTAMP: 2025-09-15 14:44:47.328929 STATUS: COMPLETED TASK_COUNT: 2 SUCCESS_TASK_COUNT: 2 RESULT: 0 COMMENT: *************************** 4. row *************************** TENANT_ID: 1002 JOB_ID: 8 INCARNATION: 1 INITIATOR_TENANT_ID: 1002 INITIATOR_JOB_ID: 0 EXECUTOR_TENANT_ID: 1002 TYPE: DELETE BACKUP ALL PARAMETER: data_backup_dest:file:///data/nfs/backup/data JOB_LEVEL: USER_TENANT START_TIMESTAMP: 2025-09-15 14:47:45.835726 END_TIMESTAMP: 2025-09-15 14:48:19.354828 STATUS: COMPLETED TASK_COUNT: 1 SUCCESS_TASK_COUNT: 1 RESULT: 0 COMMENT: *************************** 5. row *************************** TENANT_ID: 1002 JOB_ID: 9 INCARNATION: 1 INITIATOR_TENANT_ID: 1002 INITIATOR_JOB_ID: 0 EXECUTOR_TENANT_ID: 1002 TYPE: DELETE ARCHIVELOG_PIECE PARAMETER: archivelog_piece_id:1 JOB_LEVEL: USER_TENANT START_TIMESTAMP: 2025-09-16 13:50:43.315505 END_TIMESTAMP: 2025-09-16 13:51:27.427522 STATUS: COMPLETED TASK_COUNT: 1 SUCCESS_TASK_COUNT: 1 RESULT: 0 COMMENT: 5 rows in setFrom the query result, you can find that the user tenant with the tenant ID of
1002initiated four cleanup tasks:The first row indicates that the tenant initiated a cleanup task to delete the backup sets with the
backup_set_idvalues of 1 and 2 at2025-09-15 14:06:55.225984. The task was completed at2025-09-15 14:07:13.253627. TheRESULTvalue of-9045indicates that the task failed. TheCOMMENTfield indicates that the tenant has set an automatic cleanup policy. After an automatic cleanup policy is set, manual cleanup is not supported.The second row indicates that the tenant initiated a cleanup task to delete the expired backups at
2025-09-15 14:30:13.372683. The expiration time of the backups is2025-09-14 14:30:13.309380. The task was completed at2025-09-15 14:30:13.407852. TheRESULTvalue of0indicates that the task succeeded. The success rate of the subtasks under the job task is 100% (TASK_COUNT/SUCCESS_TASK_COUNT).The third row indicates that the tenant initiated a cleanup task to delete the backup sets with the
backup_set_idvalues of 1 and 2 at2025-09-15 14:44:09.511412. The task was completed at2025-09-15 14:44:47.328929. TheRESULTvalue of0indicates that the task succeeded.The fourth row indicates that the tenant initiated a cleanup task to delete the backup files in the backup path of
file:///data/nfs/backup/dataat2025-09-15 14:47:45.835726. The task was completed at2025-09-15 14:48:19.354828. TheRESULTvalue of0indicates that the task succeeded.The fifth row indicates that the tenant initiated a cleanup task to delete the log archive piece with the
piece_idvalue of 1 at2025-09-16 13:50:43.315505. The task was completed at2025-09-16 13:51:27.427522. TheRESULTvalue of0indicates that the task succeeded.
View the history of task-level cleanup tasks.
The task-level cleanup tasks record the details about the cleanup of
backup_set/backup_piece.obclient(root@sys)[(none)]> SELECT * FROM oceanbase.CDB_OB_BACKUP_DELETE_TASK_HISTORY WHERE TENANT_ID=1002\GThe query result is as follows:
*************************** 1. row *************************** TENANT_ID: 1002 TASK_ID: 5 INCARNATION: 1 JOB_ID: 7 TASK_TYPE: BACKUP SET ID: 2 ROUND_ID: 0 DEST_ID: 1002 START_TIMESTAMP: 2025-09-15 14:44:13.534722 END_TIMESTAMP: 2025-09-15 14:44:45.294097 STATUS: COMPLETED TOTAL_LS_COUNT: 2 FINISH_LS_COUNT: 2 RESULT: 0 COMMENT: PATH: file:///data/nfs/backup/data *************************** 2. row *************************** TENANT_ID: 1002 TASK_ID: 6 INCARNATION: 1 JOB_ID: 7 TASK_TYPE: BACKUP SET ID: 1 ROUND_ID: 0 DEST_ID: 1002 START_TIMESTAMP: 2025-09-15 14:44:13.540341 END_TIMESTAMP: 2025-09-15 14:44:47.322651 STATUS: COMPLETED TOTAL_LS_COUNT: 2 FINISH_LS_COUNT: 2 RESULT: 0 COMMENT: PATH: file:///data/nfs/backup/data *************************** 3. row *************************** TENANT_ID: 1002 TASK_ID: 7 INCARNATION: 1 JOB_ID: 8 TASK_TYPE: BACKUP SET ID: 3 ROUND_ID: 0 DEST_ID: 1002 START_TIMESTAMP: 2025-09-15 14:47:47.412430 END_TIMESTAMP: 2025-09-15 14:48:19.347954 STATUS: COMPLETED TOTAL_LS_COUNT: 2 FINISH_LS_COUNT: 2 RESULT: 0 COMMENT: PATH: file:///data/nfs/backup/data *************************** 4. row *************************** TENANT_ID: 1002 TASK_ID: 8 INCARNATION: 1 JOB_ID: 9 TASK_TYPE: BACKUP PIECE ID: 1 ROUND_ID: 1 DEST_ID: 1001 START_TIMESTAMP: 2025-09-16 13:50:55.286400 END_TIMESTAMP: 2025-09-16 13:51:27.419650 STATUS: COMPLETED TOTAL_LS_COUNT: 2 FINISH_LS_COUNT: 2 RESULT: 0 COMMENT: PATH: file:///data/nfs/backup/archive 4 rows in setFrom the query result, you can find that the backup files of the backup sets with the
backup_set_idvalues of 1, 2, and 3 in the destination path offile:///data/nfs/backup/datawere successfully deleted. The backup files of the log archive piece with theround_idvalue of 1 and thebackup_piece_idvalue of 1 in the destination path offile:///data/nfs/backup/archivewere also successfully deleted. You can view the information about the initiation of the cleanup tasks in the job task view by using theJOB_IDvalue.
View the history of cleanup tasks as a user tenant
Log in to the database as the tenant administrator of the user tenant.
Note
The administrator user of a MySQL-compatible tenant is
root, and the administrator user of an Oracle-compatible tenant isSYS.The following example shows how to connect to the database. Replace the actual environment variables with the values in your environment.
obclient -h10.xx.xx.xx -P2883 -uroot@mysql001#obdemo -p***** -AView the history of cleanup tasks.
View the history of job-level cleanup tasks.
The job-level cleanup tasks record the information about the initiation of the cleanup tasks.
MySQL-compatible modeOracle-compatible modeThe following example shows how to query the history of job-level cleanup tasks in MySQL-compatible mode:
obclient(root@mysql001)[oceanbase]> SELECT * FROM oceanbase.DBA_OB_BACKUP_DELETE_JOB_HISTORY\GThe following example shows how to query the history of job-level cleanup tasks in Oracle-compatible mode:
obclient(SYS@oracle001)[SYS]> SELECT * FROM SYS.DBA_OB_BACKUP_DELETE_JOB_HISTORY\GThe
DBA_OB_BACKUP_DELETE_JOB_HISTORYview contains all the fields of theCDB_OB_BACKUP_DELETE_JOB_HISTORYview except theTENANT_IDfield. For more information about the query result, see View the history of cleanup tasks as the sys tenant.View the history of task-level cleanup tasks.
The task-level cleanup tasks record the details about the cleanup of
backup_set/backup_piece.MySQL-compatible modeOracle-compatible modeThe following example shows how to query the history of task-level cleanup tasks in MySQL-compatible mode:
obclient(root@mysql001)[oceanbase]> SELECT * FROM oceanbase.DBA_OB_BACKUP_DELETE_TASK_HISTORY\GThe following example shows how to query the history of task-level cleanup tasks in Oracle-compatible mode:
obclient(SYS@oracle001)[SYS]> SELECT * FROM SYS.DBA_OB_BACKUP_DELETE_TASK_HISTORY\GThe
DBA_OB_BACKUP_DELETE_TASK_HISTORYview contains all the fields of theCDB_OB_BACKUP_DELETE_TASK_HISTORYview except theTENANT_IDfield. For more information about the query result, see View the history of cleanup tasks as the sys tenant.