In the current version, you can stop only automatic backup cleanup jobs. To stop an automatic backup cleanup job, delete the cleanup strategy first and then stop the automatic backup cleanup job so that the job will not be scheduled again. To cancel an ongoing cleanup job, you do not need to delete the cleanup strategy.
Delete a cleanup strategy
Considerations
If you delete all cleanup strategies for a tenant, automatic cleanup is disabled for the tenant.
Deleting a cleanup strategy does not affect ongoing cleanup jobs. When the system schedules automatic cleanup the next time, no cleanup job will be generated for the deleted cleanup strategy.
Delete a cleanup strategy of a user tenant from the sys tenant
Log on to the
systenant of the cluster as therootuser.Execute the following statement to delete a cleanup strategy:
obclient [(none)]> ALTER SYSTEM DROP DELETE BACKUP POLICY policy_name TENANT tenant_name;where
POLICYspecifies the name of the cleanup strategy to be deleted. You can query theCDB_OB_BACKUP_DELETE_POLICYview for the strategy.TENANTspecifies the name of a user tenant. To delete a cleanup strategy of a user tenant from the sys tenant, you must specify the name of the user tenant.
To delete the cleanup strategy named
defaultfor theMySQLtenant from the sys tenant, execute the following statement:obclient [(none)]> ALTER SYSTEM DROP DELETE BACKUP POLICY 'default' TENANT MySQL;
Delete a cleanup strategy in a user tenant
Log on to the database as a tenant administrator.
Note
The administrator user of a MySQL user tenant is
rootand that of an Oracle user tenant isSYS.Execute the following statement to delete a cleanup strategy:
obclient [(none)]> ALTER SYSTEM DROP DELETE BACKUP POLICY policy_name;Here,
POLICYspecifies the name of the cleanup strategy to be deleted. You can query theoceanbase.DBA_OB_BACKUP_DELETE_POLICYorsys.DBA_OB_BACKUP_DELETE_POLICYview for the cleanup strategies configured for the current tenant.To delete the cleanup strategy named
defaultfor the current tenant, execute the following statement:obclient [(none)]> ALTER SYSTEM DROP DELETE BACKUP POLICY 'default';
Check whether a cleanup strategy has been deleted
After you delete a cleanup strategy, you can query views to check whether the cleanup strategy has been deleted.
Log on to the database as an administrator of the sys tenant or a user tenant.
Check whether the cleanup strategy has been deleted.
In the sys tenant, query the
oceanbase.CDB_OB_BACKUP_DELETE_POLICYview to check whether the cleanup strategy of the specified tenant has been deleted.Here is an example:
obclient [(none)]> SELECT * FROM oceanbase.CDB_OB_BACKUP_DELETE_POLICY WHERE tenant_id = 1002; Empty setIn a user tenant, query the
oceanbase.DBA_OB_BACKUP_DELETE_POLICYorsys.DBA_OB_BACKUP_DELETE_POLICYview to check whether the cleanup strategy of the current tenant has been deleted.MySQL tenant
obclient [(none)]> SELECT * FROM oceanbase.DBA_OB_BACKUP_DELETE_POLICY;Oracle tenant
obclient [SYS]> SELECT * FROM sys.DBA_OB_BACKUP_DELETE_POLICY;
If the cleanup strategy of the tenant does not exist in the view, the cleanup strategy has been deleted.
What to do next
After you delete the cleanup strategy, set a new cleanup strategy as soon as possible. Otherwise, backup files can use up the disk space, affecting subsequent backup operations. For more information about how to set a cleanup strategy, see Automatically clean up expired backup data.
Cancel cleanup jobs
Cancel the ongoing cleanup jobs of a user tenant
Log on to the database as a tenant administrator.
Execute the following statement to stop the ongoing cleanup jobs of the current tenant:
obclient [(none)]> ALTER SYSTEM CANCEL DELETE BACKUP;
Cancel ongoing cleanup jobs from the sys tenant
Log on to the
systenant of the cluster as therootuser.Execute the following statement to stop the ongoing cleanup jobs of a specified tenant:
obclient [(none)]> ALTER SYSTEM CANCEL DELETE BACKUP TENANT tenant_name_list;Here,
TENANTspecifies the name of the user tenant whose cleanup jobs are to be canceled. You can specify multiple user tenant names. The ongoing cleanup jobs of the specified user tenant will be canceled.To cancel the ongoing cleanup jobs of the
MySQLandOracletenants from the sys tenant, execute the following statement:obclient [(none)]> ALTER SYSTEM CANCEL DELETE BACKUP TENANT MySQL, Oracle;If you do not specify
TENANT, the ongoing cleanup jobs of all user tenants are canceled.obclient [(none)]> ALTER SYSTEM CANCEL DELETE BACKUP;
Check whether a cleanup job has been stopped
After you stop a cleanup job, you can query views to check whether the cleanup job has been stopped.
Log on to the database as an administrator of the sys tenant or a user tenant.
Check whether the cleanup job has been stopped.
Query whether the cleanup job is ongoing.
You can query the
oceanbase.CDB_OB_BACKUP_DELETE_JOBSview from the sys tenant to view the execution status of the cleanup jobs of all tenants. You can query theoceanbase.DBA_OB_BACKUP_DELETE_JOBSorsys.DBA_OB_BACKUP_DELETE_JOBSview in the current user tenant to check the execution status of its cleanup jobs.To query the execution status of the cleanup jobs of a specified user tenant from the sys tenant, execute the following statement:
obclient [(none)]> SELECT * FROM oceanbase.CDB_OB_BACKUP_DELETE_JOBS WHERE tenant_id = 1002\G *************************** 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: 2022-05-31 12:09:40.060284 JOB_LEVEL: USER_TENANT START_TIMESTAMP: 2022-06-01 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
STATUSisINIT,DOING, orCANCELING, the corresponding cleanup job is still ongoing.If you cannot query the ongoing cleanup jobs of a user tenant in the preceding views, you can query the history of cleanup jobs to verify the execution result of a cleanup job.
obclient [(none)]> SELECT * FROM oceanbase.CDB_OB_BACKUP_DELETE_JOBS where tenant_id = 1002; Empty setQuery historical cleanup jobs.
You can query the
oceanbase.CDB_OB_BACKUP_DELETE_JOB_HISTORYview from the sys tenant for the historical cleanup jobs of all tenants. You can query theoceanbase.DBA_OB_BACKUP_DELETE_JOB_HISTORYview from a MySQL tenant or thesys.DBA_OB_BACKUP_DELETE_JOB_HISTORYview from an Oracle tenant for the historical cleanup jobs of the current tenant.To query the historical cleanup jobs of a specified user tenant from the sys tenant, execute the following statement:
obclient [(none)]> SELECT * FROM oceanbase.CDB_OB_BACKUP_DELETE_JOB_HISTORY where tenant_id = 1002\G *************************** 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: 2022-05-31 12:09:40.060284 JOB_LEVEL: USER_TENANT START_TIMESTAMP: 2022-06-01 12:09:53.389512 END_TIMESTAMP: 2022-06-01 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 corresponding cleanup job has been stopped.