After a cleanup strategy is configured and automatic cleanup is triggered, you can query the execution progress of cleanup jobs.
Query the cleanup job progress from the sys tenant
Log in to the
systenant of the cluster as therootuser.The connection example is as follows. Connect to the database based on your actual environment.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AQuery the cleanup job progress.
Query the progress of Job-level cleanup jobs.
obclient(root@sys)[(none)]> SELECT * FROM oceanbase.CDB_OB_BACKUP_DELETE_JOBS\GThe query result is as follows:
*************************** 1. row *************************** TENANT_ID: 1002 JOB_ID: 7 INCARNATION: 1 INITIATOR_TENANT_ID: 1002 INITIATOR_JOB_ID: 7 EXECUTOR_TENANT_ID: 1002 TYPE: DELETE OBSOLETE BACKUP PARAMETER: expired_time:2025-09-10 12:09:40.060284 JOB_LEVEL: USER_TENANT START_TIMESTAMP: 2025-09-11 12:09:53.389512 END_TIMESTAMP: STATUS: DOING TASK_COUNT: 2 SUCCESS_TASK_COUNT: 1 RESULT: 0 COMMENT: 1 row in setAs shown in the query result, the user tenant with the ID
1002initiated a cleanup job for expired backup data at2025-09-11 12:09:53.389512, and the expiration time point for cleanup judgment is2022-05-31 12:09:40.060284. Therefore, the value of therecovery_windowparameter in the cleanup strategy of this tenant is1d. The value ofTASK_COUNTis2, indicating that twobackup_set/backup_piecesubtasks are being executed in the job. The value ofSUCCESS_TASK_COUNTis1, indicating that one task has been completed, and the completion rate of the current job is 50% (SUCCESS_TASK_COUNT/TASK_COUNT).Based on the query result, further query the progress of the
backup_set/backup_piececleanup.obclient(root@sys)[(none)]> SELECT * FROM oceanbase.CDB_OB_BACKUP_DELETE_TASKS\GThe query result is as follows:
*************************** 1. row *************************** TENANT_ID: 1002 TASK_ID: 4 INCARNATION: 1 JOB_ID: 7 TASK_TYPE: BACKUP SET ID: 1 ROUND_ID: 0 DEST_ID: 1002 START_TIMESTAMP: 2025-09-11 12:09:50.800772 END_TIMESTAMP: 2025-09-11 12:09:54.954691 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: 5 INCARNATION: 1 JOB_ID: 7 TASK_TYPE: BACKUP PIECE ID: 1 ROUND_ID: 1 DEST_ID: 1001 START_TIMESTAMP: 2025-09-11 12:09:50.968413 END_TIMESTAMP: STATUS: DOING TOTAL_LS_COUNT: 2 FINISH_LS_COUNT: 1 RESULT: 0 COMMENT: PATH: file:///data/nfs/backup/archive 2 rows in setAs shown in the query result, for the user tenant with the ID
1002, the cleanup of the backup files withbackup_set_id=1in the data backup at the destinationfile:///data/nfs/backup/datahas been completed, and the task completion rate is 100% (FINISH_LS_COUNT/TOTAL_LS_COUNT). The cleanup of the backup files withround_id=1/backup_piece_id=1in the log archive at the destinationfile:///data/nfs/backup/archiveis in progress, and the task completion rate is 50% (FINISH_LS_COUNT/TOTAL_LS_COUNT). You can query the information about the initiation of the cleanup jobs in the Job-level job view by usingJOB_ID.
Query the cleanup job progress from a user tenant
Log in to the database as an administrator of a user tenant.
Note
The administrator user is
rootin MySQL-compatible mode andSYSin Oracle-compatible mode.The connection example is as follows. Connect to the database based on your actual environment.
obclient -h10.xx.xx.xx -P2883 -uroot@mysql001#obdemo -p***** -AQuery the cleanup job progress.
Query the progress of Job-level cleanup jobs.
MySQL-compatible modeOracle-compatible modeThe query example in MySQL-compatible mode is as follows:
obclient(root@mysql001)[oceanbase]> SELECT * FROM oceanbase.DBA_OB_BACKUP_DELETE_JOBS\GThe query example in Oracle-compatible mode is as follows:
obclient(SYS@oracle001)[SYS]> SELECT * FROM SYS.DBA_OB_BACKUP_DELETE_JOBS\GExcept for the missing
TENANT_IDfield, all fields in theDBA_OB_BACKUP_DELETE_JOBSview correspond to those in theCDB_OB_BACKUP_DELETE_JOBSview. For more information about the query result, see Query the cleanup job progress from the sys tenant.Based on the query result, further query the progress of the
backup_set/backup_piececleanup.MySQL-compatible modeOracle-compatible modeThe query example in MySQL-compatible mode is as follows:
obclient(root@mysql001)[oceanbase]> SELECT * FROM oceanbase.DBA_OB_BACKUP_DELETE_TASKS\GThe query example in Oracle-compatible mode is as follows:
obclient(SYS@oracle001)[SYS]> SELECT * FROM SYS.DBA_OB_BACKUP_DELETE_TASKS\GExcept for the missing
TENANT_IDfield, all fields in theDBA_OB_BACKUP_DELETE_TASKSview correspond to those in theCDB_OB_BACKUP_DELETE_TASKSview. For more information about the query result, see Query the cleanup job progress from the sys tenant.
