Purpose
You can use this statement to clear expired backup data.
Set the expiration time backup_recovery_window before you use this statement to clear expired backup data. backup_recovery_window specifies the time window in which backup data can be restored, counting from now on. This parameter is used to check whether a backup set has expired. The default value is 0, indicating that the system does not check whether the backup set has expired. We recommend that you set it to 7d, meaning that the backup data is retained for one week. In this way, you can restore the backup sets created in the last 7 days and other backup sets are deleted. If automatic backup clearing is enabled, when the backup expires, the system automatically clears it.
For more information about backup_recovery_window, see "System parameters" in the OceanBase Database Reference Guide.
Syntax
ALTER SYSTEM DELETE OBSOLETE BACKUP;
Examples
Set the expiration time of backup data to one week, after which the backup data will be cleared.
obclient> ALTER SYSTEM SET backup_recovery_window = '7d';
obclient> ALTER SYSTEM DELETE OBSOLETE BACKUP;