Backup cleanup can be performed automatically or manually. When you cancel a cleanup task:
- In automatic cleanup scenarios, to prevent the canceled task from being rescheduled, you must first delete the cleanup policy and then stop the ongoing cleanup task. If you only want to cancel the current cleanup task, you do not need to delete the cleanup policy.
- In manual cleanup scenarios, you can directly cancel the cleanup task.
Cancel an ongoing cleanup task 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***** -AExecute the following statement to stop the ongoing cleanup task of the specified tenant.
obclient [(none)]> ALTER SYSTEM CANCEL DELETE BACKUP TENANT tenant_name_list;Here,
TENANTspecifies the name of the user tenant whose cleanup task you want to cancel. You can specify multiple user tenant names. Only the cleanup tasks running in the specified tenants are canceled.Here is an example of canceling the ongoing cleanup task in the
tenant1tenant from the sys tenant:obclient [(none)]> ALTER SYSTEM CANCEL DELETE BACKUP TENANT tenant1;If you do not specify the
TENANTparameter, the ongoing cleanup tasks in all user tenants are canceled.obclient [(none)]> ALTER SYSTEM CANCEL DELETE BACKUP;Check whether the cleanup task has stopped.
Check whether the cleanup task is running.
obclient(root@sys)[(none)]> SELECT * FROM oceanbase.CDB_OB_BACKUP_DELETE_JOBS WHERE tenant_id = 1002\GThe query result is as follows:
*************************** 1. row *************************** TENANT_ID: 1002 JOB_ID: 1 INCARNATION: 1 INITIATOR_TENANT_ID: 1002 INITIATOR_JOB_ID: 7 EXECUTOR_TENANT_ID: 1002 TYPE: DELETE OBSOLETE BACKUP PARAMETER: expired_time:2025-09-12 12:09:40.060284 JOB_LEVEL: USER_TENANT START_TIMESTAMP: 2025-09-13 12:09:53.389512 END_TIMESTAMP: STATUS: CANCELING TASK_COUNT: 2 SUCCESS_TASK_COUNT: 1 RESULT: 0 COMMENT: 1 row in setAccording to the query result, if the value of
STATUSisINIT,DOING, orCANCELING, the cleanup task has not finished.If the query result is empty, no cleanup task is running in the specified tenant. You can proceed to the next step to view the cleanup task history to confirm the execution result.
View the cleanup task history.
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: 1 INCARNATION: 1 INITIATOR_TENANT_ID: 1002 INITIATOR_JOB_ID: 7 EXECUTOR_TENANT_ID: 1002 TYPE: DELETE OBSOLETE BACKUP PARAMETER: expired_time:2025-09-12 12:09:40.060284 JOB_LEVEL: USER_TENANT START_TIMESTAMP: 2025-09-13 12:09:53.389512 END_TIMESTAMP: 2025-09-13 12:10:36.829576 STATUS: CANCELED TASK_COUNT: 2 SUCCESS_TASK_COUNT: 2 RESULT: 0 COMMENT: 1 row in setIf the value of
STATUSisCOMPLETED,FAILED, orCANCELED, the cleanup task has stopped.
Cancel an ongoing cleanup task 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***** -AExecute the following statement to stop the ongoing cleanup task of the current tenant.
obclient> ALTER SYSTEM CANCEL DELETE BACKUP;Check whether the cleanup task has stopped.
Check whether the cleanup task is running.
A sample query is as follows:
obclient(root@mysql001)[(none)]> SELECT * FROM oceanbase.DBA_OB_BACKUP_DELETE_JOBS\GAccording to the query result, if the value of
STATUSisINIT,DOING, orCANCELING, the cleanup task has not finished.If the query result is empty, no cleanup task is running in the current tenant. You can proceed to the next step to view the cleanup task history to confirm the execution result.
View the cleanup task history.
A sample query is as follows:
obclient(root@mysql001)[(none)]> SELECT * FROM oceanbase.DBA_OB_BACKUP_DELETE_JOB_HISTORY\GAccording to the query result, if the value of
STATUSisCOMPLETED,FAILED, orCANCELED, the cleanup task has stopped.