After you replace a backup or archive path, you can clear the replaced backup or archive path that is no longer in use. Clearing a data backup or archive path means clearing all backup sets or log archive pieces in that path.
Limitations
Only a replaced backup or archive path can be cleared. You cannot clear the backup or archive path currently in use.
An old path that is being cleared cannot be reset as a backup or archive path.
Clear a backup path
Clear the backup path of 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***** -AQuery tenant information to obtain the tenant's
TENANT_ID.This topic uses the
mysql001tenant as an example. A sample query is as follows:obclient(root@sys)[(none)]> SELECT TENANT_ID, TENANT_NAME, TENANT_TYPE FROM oceanbase.DBA_OB_TENANTS WHERE TENANT_NAME = 'mysql001';The query result is as follows:
+-----------+-------------+-------------+ | TENANT_ID | TENANT_NAME | TENANT_TYPE | +-----------+-------------+-------------+ | 1002 | mysql001 | USER | +-----------+-------------+-------------+ 1 row in setAccording to the query result, the
TENANT_IDof this tenant is 1002.Obtain the backup path to be cleared.
Query all backup paths in the specified tenant.
obclient(root@sys)[(none)]> SELECT TENANT_ID, PATH, DEST_TYPE, STATUS FROM oceanbase.CDB_OB_BACKUP_STORAGE_INFO WHERE TENANT_ID = 1002 AND DEST_TYPE = 'backup_data';The query result is as follows:
+-----------+-------------------------------+-------------+--------+ | TENANT_ID | PATH | DEST_TYPE | STATUS | +-----------+-------------------------------+-------------+--------+ | 1002 | s3://oceanbase-test-bucket/backup/data2?host=obs.****.myhuaweicloud.com | backup_data | NORMAL | | 1002 | s3://oceanbase-test-bucket/backup/data1?host=obs.****.myhuaweicloud.com | backup_data | NORMAL | +-----------+-------------------------------+-------------+--------+ 2 rows in setAccording to the query result, there are two backup paths in this tenant.
Query the backup path currently in use by the specified tenant.
obclient(root@sys)[(none)]> SELECT * FROM oceanbase.CDB_OB_BACKUP_PARAMETER WHERE TENANT_ID = 1002;The query result is as follows:
+-----------+------------------+-------------------------------+ | TENANT_ID | NAME | VALUE | +-----------+------------------+-------------------------------+ | 1002 | data_backup_dest | s3://oceanbase-test-bucket/backup/data2?host=obs.****.myhuaweicloud.com | +-----------+------------------+-------------------------------+ 1 row in setAccording to the query result, the currently in-use backup path is
s3://oceanbase-test-bucket/backup/data2?host=obs.****.myhuaweicloud.com. Therefore, the backup paths3://oceanbase-test-bucket/backup/data1?host=obs.****.myhuaweicloud.comto be cleared is not currently in use and can be cleared.
Execute the following statement to clear the specified backup path:
ALTER SYSTEM DELETE BACKUP ALL DATA_BACKUP_DEST [=] 'data_backup_path' TENANT [=] tenant_name;The parameters in the statement are described as follows:
data_backup_path: the data backup path to be cleared.tenant_name: the user tenant for which the backup path is to be cleared.
Here is an example:
The system tenant clears the S3 backup path
s3://oceanbase-test-bucket/backup/data1?host=obs.****.myhuaweicloud.comof themysql001tenant.obclient(root@sys)[(none)]> ALTER SYSTEM DELETE BACKUP ALL DATA_BACKUP_DEST ='s3://oceanbase-test-bucket/backup/data1?host=obs.****.myhuaweicloud.com' TENANT = mysql001;After the statement is successfully executed, you can query the view to view the path being cleared.
obclient(root@sys)[(none)]> SELECT TENANT_ID, PATH, DEST_TYPE, STATUS FROM oceanbase.CDB_OB_BACKUP_STORAGE_INFO WHERE TENANT_ID = 1002 AND PATH = 's3://oceanbase-test-bucket/backup/data1?host=obs.****.myhuaweicloud.com';A sample query result is as follows:
+-----------+-------------------------------+-------------+----------+ | TENANT_ID | PATH | DEST_TYPE | STATUS | +-----------+-------------------------------+-------------+----------+ | 1002 | s3://oceanbase-test-bucket/backup/data1?host=obs.****.myhuaweicloud.com | backup_data | DELETING | +-----------+-------------------------------+-------------+----------+ 1 row in setAccording to the query result, during the path clearing process, you can see the value of the
STATUSfield for the corresponding path change toDELETING. Once the clearing is complete, the corresponding row will be deleted.
Clear the backup path in 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***** -AObtain the backup path to be cleared.
View all backup paths in the current tenant.
A sample query is as follows:
obclient(root@mysql001)[(none)]> SELECT PATH, DEST_TYPE, STATUS FROM oceanbase.DBA_OB_BACKUP_STORAGE_INFO WHERE DEST_TYPE = 'backup_data';A sample query result is as follows:
+-------------------------------+-------------+--------+ | PATH | DEST_TYPE | STATUS | +-------------------------------+-------------+--------+ | s3://oceanbase-test-bucket/backup/data2?host=obs.****.myhuaweicloud.com | backup_data | NORMAL | | s3://oceanbase-test-bucket/backup/data1?host=obs.****.myhuaweicloud.com | backup_data | NORMAL | +-------------------------------+-------------+--------+ 2 rows in setAccording to the query result, there are two backup paths in this tenant.
View the backup path currently used by the tenant.
A sample query is as follows:
obclient(root@mysql001)[(none)]> SELECT * FROM oceanbase.DBA_OB_BACKUP_PARAMETER;A sample query result is as follows:
+------------------+-------------------------------+ | NAME | VALUE | +------------------+-------------------------------+ | data_backup_dest | s3://oceanbase-test-bucket/backup/data2?host=obs.****.myhuaweicloud.com | +------------------+-------------------------------+ 1 row in setAccording to the query result, the currently in-use backup path is
s3://oceanbase-test-bucket/backup/data2?host=obs.****.myhuaweicloud.com. Therefore, the backup path to be cleared,s3://oceanbase-test-bucket/backup/data1?host=obs.****.myhuaweicloud.com, is not the current backup path and can be cleared.
Execute the following statement to clear the specified backup path:
ALTER SYSTEM DELETE BACKUP ALL DATA_BACKUP_DEST [=] 'data_backup_path';Here,
data_backup_pathspecifies the data backup path to be cleared.Here is an example:
A user tenant clears its own S3 backup path
s3://oceanbase-test-bucket/backup/data1?host=obs.****.myhuaweicloud.com.obclient> ALTER SYSTEM DELETE BACKUP ALL DATA_BACKUP_DEST ='s3://oceanbase-test-bucket/backup/data1?host=obs.****.myhuaweicloud.com';After the statement is successfully executed, you can query the view to view the path being cleared.
A sample query is as follows:
obclient(root@mysql001)[(none)]> SELECT PATH, DEST_TYPE, STATUS FROM oceanbase.DBA_OB_BACKUP_STORAGE_INFO WHERE PATH = 's3://oceanbase-test-bucket/backup/data1?host=obs.****.myhuaweicloud.com';A sample query result is as follows:
+-------------------------------+-------------+----------+ | PATH | DEST_TYPE | STATUS | +-------------------------------+-------------+----------+ | s3://oceanbase-test-bucket/backup/data1?host=obs.****.myhuaweicloud.com | backup_data | DELETING | +-------------------------------+-------------+----------+ 1 row in setAccording to the query result, during the path clearing process, the value of the
STATUScolumn for the corresponding path changes toDELETING. After the clearing is complete, the corresponding row is deleted.
Clear an archive path
Clear the archive path of a specified user tenant in 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***** -AQuery tenant information to obtain the tenant's
TENANT_ID.This topic uses the
mysql001tenant as an example. A sample query is as follows:obclient(root@sys)[(none)]> SELECT TENANT_ID, TENANT_NAME, TENANT_TYPE FROM oceanbase.DBA_OB_TENANTS WHERE TENANT_NAME = 'mysql001';The query result is as follows:
+-----------+-------------+-------------+ | TENANT_ID | TENANT_NAME | TENANT_TYPE | +-----------+-------------+-------------+ | 1002 | mysql001 | USER | +-----------+-------------+-------------+ 1 row in setAccording to the query result, the tenant's
TENANT_IDis 1002.Obtain the archive path to be cleared.
Query all archive paths of the specified tenant.
obclient(root@sys)[(none)]> SELECT TENANT_ID, PATH, DEST_TYPE, STATUS FROM oceanbase.CDB_OB_BACKUP_STORAGE_INFO WHERE TENANT_ID = 1002 AND DEST_TYPE = 'archive_log';A sample query result is as follows:
+-----------+----------------------------------+-------------+---------+ | TENANT_ID | PATH | DEST_TYPE | STATUS | +-----------+----------------------------------+-------------+---------+ | 1002 | s3://oceanbase-test-bucket/backup/archive2?host=obs.****.myhuaweicloud.com | archive_log | NORMAL | | 1002 | s3://oceanbase-test-bucket/backup/archive1?host=obs.****.myhuaweicloud.com | archive_log | NORMAL | +-----------+----------------------------------+-------------+---------+ 1 row in setAccording to the query result, there are two archive paths in this tenant.
Query the archive path currently in use by the specified tenant.
obclient(root@sys)[(none)]> SELECT TENANT_ID, NAME, VALUE FROM oceanbase.CDB_OB_ARCHIVE_DEST WHERE TENANT_ID = tenant_id AND NAME = 'path';A sample query result is as follows:
+-----------+------+------------------------------------+ | TENANT_ID | NAME | VALUE | +-----------+------+------------------------------------+ | 1002 | path | s3://oceanbase-test-bucket/backup/archive2?host=obs.****.myhuaweicloud.com | +-----------+------+------------------------------------+ 1 row in setAccording to the query result, the archive path currently in use is
s3://oceanbase-test-bucket/backup/archive2?host=obs.****.myhuaweicloud.com. The path to be cleared,s3://oceanbase-test-bucket/backup/archive1?host=obs.****.myhuaweicloud.com, is not currently in use and can be cleared.
Execute the following statement to clear the specified archive path:
ALTER SYSTEM DELETE BACKUP ALL LOG_ARCHIVE_DEST [=] 'log_archive_path' TENANT [=] tenant_name;The parameters in the statement are described as follows:
log_archive_path: the archive path to be cleared.tenant_name: the user tenant for which the archive path is to be cleared.
Here is an example:
The system tenant clears the S3 archive path
s3://oceanbase-test-bucket/backup/archive1?host=obs.****.myhuaweicloud.comof themysql001tenant.obclient(root@sys)[(none)]> ALTER SYSTEM DELETE BACKUP ALL LOG_ARCHIVE_DEST ='s3://oceanbase-test-bucket/backup/archive1?host=obs.****.myhuaweicloud.com' TENANT = mysql001;After the statement is successfully executed, you can query the view to view the path being cleared.
obclient(root@sys)[(none)]> SELECT TENANT_ID, PATH, DEST_TYPE, STATUS FROM oceanbase.CDB_OB_BACKUP_STORAGE_INFO WHERE TENANT_ID = 1002 AND PATH = 's3://oceanbase-test-bucket/backup/archive1?host=obs.****.myhuaweicloud.com';A sample query result is as follows:
+-----------+----------------------------------+-------------+-----------+ | TENANT_ID | PATH | DEST_TYPE | STATUS | +-----------+----------------------------------+-------------+-----------+ | 1002 | s3://oceanbase-test-bucket/backup/archive1?host=obs.****.myhuaweicloud.com | archive_log | DELETING | +-----------+----------------------------------+-------------+-----------+ 1 row in setAccording to the query result, during the path clearing process, the value of the
STATUScolumn for the corresponding path changes toDELETING. After the clearing is complete, the corresponding row is deleted.
Clear the archive path in 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***** -AObtain the archive path to be cleared.
View all archive paths in the current tenant.
A sample query is as follows:
obclient(root@mysql001)[(none)]> SELECT PATH, DEST_TYPE, STATUS FROM oceanbase.DBA_OB_BACKUP_STORAGE_INFO WHERE DEST_TYPE = 'archive_log';A sample query result is as follows:
+----------------------------------+-------------+---------+ | PATH | DEST_TYPE | STATUS | +----------------------------------+-------------+---------+ | s3://oceanbase-test-bucket/backup/archive2?host=obs.****.myhuaweicloud.com | archive_log | NORMAL | | s3://oceanbase-test-bucket/backup/archive1?host=obs.****.myhuaweicloud.com | archive_log | NORMAL | +----------------------------------+-------------+---------+ 2 rows in setView the archive path currently used by the tenant.
A sample query is as follows:
obclient(root@mysql001)[(none)]> SELECT NAME, VALUE FROM oceanbase.DBA_OB_ARCHIVE_DEST WHERE NAME = 'path';A sample query result is as follows:
+------+------------------------------------+ | NAME | VALUE | +------+------------------------------------+ | path | s3://oceanbase-test-bucket/backup/archive2?host=obs.****.myhuaweicloud.com | +------+------------------------------------+ 1 row in setAccording to the query result, the archive path to be cleared is not the archive path currently used, so it can be cleared.
Execute the following statement to clear the specified archive path:
ALTER SYSTEM DELETE BACKUP ALL LOG_ARCHIVE_DEST [=] 'log_archive_path';Here,
log_archive_pathspecifies the archive path to be cleared.Here is an example:
A user tenant clears its own S3 archive path
s3://oceanbase-test-bucket/backup/archive1?host=obs.****.myhuaweicloud.com.obclient> ALTER SYSTEM DELETE BACKUP ALL LOG_ARCHIVE_DEST ='s3://oceanbase-test-bucket/backup/archive1?host=obs.****.myhuaweicloud.com';After the statement is successfully executed, you can query the view to view the path being cleared.
A sample query is as follows:
obclient(root@mysql001)[(none)]> SELECT PATH, DEST_TYPE, STATUS FROM oceanbase.DBA_OB_BACKUP_STORAGE_INFO WHERE PATH = 's3://oceanbase-test-bucket/backup/archive1?host=obs.****.myhuaweicloud.com';A sample query result is as follows:
+----------------------------------+-------------+-----------+ | PATH | DEST_TYPE | STATUS | +----------------------------------+-------------+-----------+ | s3://oceanbase-test-bucket/backup/archive1?host=obs.****.myhuaweicloud.com | archive_log | DELETING | +----------------------------------+-------------+-----------+ 1 row in setAccording to the query result, during the path clearing process, the value of the
STATUScolumn for the corresponding path changes toDELETING. After the clearing is complete, the corresponding row is deleted.