The DELETE OBSOLETE BACKUP statement is used to manually trigger the cleanup of expired backups.
Limitations
When the
systenant executes theDELETE OBSOLETE BACKUPstatement, if a user tenant is specified, the specified user tenant must have a cleanup strategy set. If no user tenant is specified, all user tenants must have automatic cleanup strategies set.When a user tenant executes the
DELETE OBSOLETE BACKUPstatement, the current user tenant must have an automatic cleanup strategy set.
For information about setting an automatic cleanup strategy, see DELETE BACKUP POLICY.
Privilege requirements
The statement must be executed by the root user of the sys tenant (root@sys) or the administrator of each tenant. Specifically:
- In MySQL-compatible mode, the default administrator is the
rootuser. - In Oracle-compatible mode, the default administrator is the
SYSuser.
Syntax
ALTER SYSTEM DELETE OBSOLETE BACKUP [TENANT [=] tenant_name];
Parameters
| Parameter | Description |
|---|---|
| tenant_name | Specifies which user tenant's backup or archive to trigger the cleanup for. In the system tenant, if no user tenant is specified, the cleanup is triggered for all user tenants by default. |
Examples
System tenant
The system tenant triggers the cleanup of expired backups for the
mysql001tenant.obclient(root@sys)[(none)]> ALTER SYSTEM DELETE OBSOLETE BACKUP TENANT mysql001;The system tenant triggers the cleanup of expired backups for all user tenants.
obclient(root@sys)[(none)]> ALTER SYSTEM DELETE OBSOLETE BACKUP;
User tenant
In a user tenant, the cleanup of expired backups for the current tenant is triggered.
obclient> ALTER SYSTEM DELETE OBSOLETE BACKUP;