After setting up a cleanup strategy, if you want to initiate an immediate cleanup of expired backups, you can manually trigger a cleanup task. Once manually triggered, the system will perform the cleanup based on the tenant's configured cleanup strategy.
Prerequisites
Make sure that the current tenant has an automatic cleanup strategy set up. For details on how to set up and verify an automatic cleanup strategy, see Automatically clean up expired backups.
Trigger the cleanup of expired backups for a specified user tenant from the system tenant
Log in to the cluster as the
rootuser of thesystenant.Here is an example of how to connect to the database, please adjust according to your actual environment.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AExecute the following command to manually trigger the cleanup of expired backups.
The syntax is as follows:
ALTER SYSTEM DELETE OBSOLETE BACKUP [TENANT [=] tenant_name];Here,
TENANT [=] tenant_namespecifies the user tenant for which you want to trigger the cleanup. If you do not specify a tenant, the cleanup will be triggered for all user tenants by default.Here are some examples:
Trigger the cleanup of expired backups for the
mysql001tenant from the system tenant.obclient(root@sys)[(none)]> ALTER SYSTEM DELETE OBSOLETE BACKUP TENANT mysql001;Trigger the cleanup of expired backups for all user tenants from the system tenant.
obclient(root@sys)[(none)]> ALTER SYSTEM DELETE OBSOLETE BACKUP;
Trigger the cleanup of expired backups for your tenant as a tenant administrator
Log in to the database as the tenant administrator.
Note
For MySQL-compatible tenants, the administrator is the
rootuser. For Oracle-compatible tenants, the administrator is theSYSuser.Here is an example of how to connect to the database, please adjust according to your actual environment.
obclient -h10.xx.xx.xx -P2883 -uroot@mysql001#obdemo -p***** -AExecute the following command to manually trigger the cleanup of expired backups for your tenant.
obclient> ALTER SYSTEM DELETE OBSOLETE BACKUP;