After a cleanup policy is set, if you want to perform an expired backup cleanup as soon as possible, you can immediately trigger an expired cleanup task manually. After the cleanup is manually triggered, the system performs the cleanup based on the cleanup policy configured for the tenant.
Prerequisites
Make sure that an automatic cleanup policy is set for the current tenant. For more information about how to set and verify an automatic cleanup policy, see Automatically clean up expired backups.
Trigger expired backup cleanup for a specified user tenant from 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 manually trigger an expired backup cleanup:
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 is triggered for all user tenants by default.Here are some examples:
Trigger an expired backup cleanup for the
mysql001tenant from the sys tenant.obclient(root@sys)[(none)]> ALTER SYSTEM DELETE OBSOLETE BACKUP TENANT mysql001;Trigger an expired backup cleanup for all user tenants from the sys tenant.
obclient(root@sys)[(none)]> ALTER SYSTEM DELETE OBSOLETE BACKUP;
Trigger expired backup cleanup for the current tenant from 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 manually trigger an expired backup cleanup for the current tenant.
obclient> ALTER SYSTEM DELETE OBSOLETE BACKUP;