After a cleanup policy is successfully configured and automatic cleanup is triggered, when a cleanup task is completed, you can query the history views to view the execution result of the cleanup task.
View cleanup task history in the sys tenant
Log in to the
systenant of the cluster as therootuser.Here is an example of how to connect to the database. Use the actual environment settings when you connect to the database.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AView the cleanup task history.
View the job history.
The job history records information related to the initiation of cleanup tasks.
obclient(root@sys)[(none)]> SELECT * FROM oceanbase.CDB_OB_BACKUP_DELETE_JOB_HISTORY WHERE TENANT_ID=1002\GA sample 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:s3://oceanbase-test-bucket/backup/data?host=obs.****.myhuaweicloud.com 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 setAccording to the query result, the user tenant with the tenant ID
1002has initiated four cleanup tasks:The first row shows that this tenant initiated a cleanup task to delete specified backup sets at
2025-09-15 14:06:55.225984. Thebackup_set_idof the backup sets to be deleted is 1 and 2. The task completed at2025-09-15 14:07:13.253627. TheRESULTis-9045, indicating the task failed. The failure reason indicated by theCOMMENTcolumn is that an automatic cleanup policy is configured for the current tenant. After an automatic cleanup policy is configured, manual cleanup is not supported.The second row shows that this tenant initiated a cleanup task for expired backups at
2025-09-15 14:30:13.372683. The backup expired at2025-09-14 14:30:13.309380. The task completed at2025-09-15 14:30:13.407852. The subtask success rate under the job (TASK_COUNT/SUCCESS_TASK_COUNT) is 100%. ARESULTof0indicates the task succeeded.The third row shows that this tenant initiated a cleanup task to delete specified backup sets at
2025-09-15 14:44:09.511412. Thebackup_set_idof the backup sets to be deleted is 1 and 2. The task completed at2025-09-15 14:44:47.328929. ARESULTof0indicates the task succeeded.The fourth row shows that this tenant initiated a cleanup task to clear a specified backup path at
2025-09-15 14:47:45.835726. The backup path to be cleared iss3://oceanbase-test-bucket/backup/data?host=obs.****.myhuaweicloud.com. The task completed at2025-09-15 14:48:19.354828. ARESULTof0indicates the task succeeded.The fifth row shows that this tenant initiated a cleanup task to delete a specified log archive piece at
2025-09-16 13:50:43.315505. The ID of the log archive piece to be deleted is 1. The task completed at2025-09-16 13:51:27.427522. ARESULTof0indicates the task succeeded.
View the task history.
The task history records the details of the cleaned-up
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_TASK_COUNT: 2 FINISH_TASK_COUNT: 2 RESULT: 0 COMMENT: PATH: s3://oceanbase-test-bucket/backup/data?host=obs.****.myhuaweicloud.com *************************** 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_TASK_COUNT: 2 FINISH_TASK_COUNT: 2 RESULT: 0 COMMENT: PATH: s3://oceanbase-test-bucket/backup/data?host=obs.****.myhuaweicloud.com *************************** 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_TASK_COUNT: 2 FINISH_TASK_COUNT: 2 RESULT: 0 COMMENT: PATH: s3://oceanbase-test-bucket/backup/data?host=obs.****.myhuaweicloud.com *************************** 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_TASK_COUNT: 2 FINISH_TASK_COUNT: 2 RESULT: 0 COMMENT: PATH: s3://oceanbase-test-bucket/backup/archive?host=obs.****.myhuaweicloud.comAccording to the query result, the user tenant with the tenant ID
1002has successfully cleaned up the backup files withbackup_set_id=1,backup_set_id=2, andbackup_set_id=3in the destinations3://oceanbase-test-bucket/backup/data?host=obs.****.myhuaweicloud.com. It has also successfully cleaned up the log archive backup file withround_id=1/backup_piece_id=1in the archive destinations3://oceanbase-test-bucket/backup/archive?host=obs.****.myhuaweicloud.com. You can view information related to the initiation of cleanup tasks in the job-level task view by using theJOB_ID.
View cleanup task history in a user tenant
Log in to the database as a tenant administrator.
Note
The administrator user of a user tenant is the
rootuser.Here is an example of how to connect to the database. Use the actual environment settings when you connect to the database.
obclient -h10.xx.xx.xx -P2883 -uroot@mysql001#obdemo -p***** -AView the cleanup task history.
View the job history.
The job history records information related to the initiation of cleanup tasks.
A sample query is as follows:
obclient(root@mysql001)[oceanbase]> SELECT * FROM oceanbase.DBA_OB_BACKUP_DELETE_JOB_HISTORY\GExcept for the absence of the
TENANT_IDcolumn, all columns in theDBA_OB_BACKUP_DELETE_JOB_HISTORYview correspond to those in theCDB_OB_BACKUP_DELETE_JOB_HISTORYview. For more information about the query result, see View cleanup task history in the sys tenant.View the task history.
The task history records the details of the cleaned-up
backup_set/backup_piece.A sample query is as follows:
obclient(root@mysql001)[oceanbase]> SELECT * FROM oceanbase.DBA_OB_BACKUP_DELETE_TASK_HISTORY\GExcept for the absence of the
TENANT_IDcolumn, all columns in theDBA_OB_BACKUP_DELETE_TASK_HISTORYview correspond to those in theCDB_OB_BACKUP_DELETE_TASK_HISTORYview. For more information about the query result, see View cleanup task history in the sys tenant.