In the current version, you can perform automatic and manual cleanup. When you cancel a cleanup task:
- In automatic cleanup scenarios, to prevent the canceled cleanup task from being rescheduled, you must first delete the cleanup policy and then stop the running cleanup task. If you only want to cancel the running cleanup task, you do not need to delete the cleanup policy.
- In manual cleanup scenarios, you can directly cancel the cleanup task.
Cancel a running cleanup task in the system tenant
Log in to the
systenant of the cluster as therootuser.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@sys#obdemo -p***** -AExecute the following statement to cancel the running cleanup task in the specified user tenant.
obclient [(none)]> ALTER SYSTEM CANCEL DELETE BACKUP TENANT tenant_name_list;The
TENANTparameter specifies the user tenant whose cleanup task you want to cancel. You can specify multiple user tenants in a list. This operation cancels only the cleanup tasks running in the specified user tenants.The system tenant cancels the cleanup tasks running in the
MySQLandOracletenants. Example:obclient [(none)]> ALTER SYSTEM CANCEL DELETE BACKUP TENANT MySQL, Oracle;If you do not specify the
TENANTparameter, the cleanup tasks running in all user tenants are canceled.obclient [(none)]> ALTER SYSTEM CANCEL DELETE BACKUP;Check whether the cleanup task has been canceled.
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 setIf the value of the
STATUScolumn isINIT,DOING, orCANCELING, the cleanup task is still running.If the query result is empty, no cleanup task is running in the specified user tenant. You can proceed to the next step to check the history of the cleanup task.
Check the history of the cleanup task.
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, it indicates that the cleanup task has been stopped.
Cancel a running backup cleanup task in a user tenant
Log in to the database as the tenant administrator of the user tenant.
Note
The administrator of a MySQL-compatible tenant is the
rootuser, and the administrator of an Oracle-compatible tenant is theSYSuser.The following example shows how to connect to the database. Replace the actual values with those in your environment.
obclient -h10.xx.xx.xx -P2883 -uroot@mysql001#obdemo -p***** -AExecute the following statement to cancel the running backup cleanup task in the current tenant.
obclient> ALTER SYSTEM CANCEL DELETE BACKUP;Check whether the backup cleanup task is canceled.
Check whether the backup cleanup task is running.
MySQL-compatible modeOracle-compatible modeIn MySQL-compatible mode, execute the following statement:
obclient(root@mysql001)[(none)]> SELECT * FROM oceanbase.DBA_OB_BACKUP_DELETE_JOBS\GIn Oracle-compatible mode, execute the following statement:
obclient(SYS@oracle001)[SYS]> SELECT * FROM SYS.DBA_OB_BACKUP_DELETE_JOBS\GIf the value of the
STATUScolumn isINIT,DOING, orCANCELING, the backup cleanup task is still running.If the query result is empty, the backup cleanup task is not running in the current tenant. You can execute the next step to view the history of the backup cleanup task to confirm the result.
View the history of the backup cleanup task.
MySQL-compatible modeOracle-compatible modeIn MySQL-compatible mode, execute the following statement:
obclient(root@mysql001)[(none)]> SELECT * FROM oceanbase.DBA_OB_BACKUP_DELETE_JOB_HISTORY\GIn Oracle-compatible mode, execute the following statement:
obclient(SYS@oracle001)[SYS]> SELECT * FROM SYS.DBA_OB_BACKUP_DELETE_JOB_HISTORY\GIf the value of the
STATUScolumn isCOMPLETED,FAILED, orCANCELED, the backup cleanup task is canceled.