OceanBase Database supports dynamically updating information such as the access_id and access_key for backup or archive paths. After setting a backup or archive path, if you change the key information for the object storage due to security or other reasons, you can use this method to update the access_id and access_key for the existing backup or archive path to ensure backup or archive operations continue normally.
Limitations
You can only update the
access_idandaccess_keyfor the object storage path.Only user tenants can update the key information for their own backup or archive paths. The system tenant cannot update the key information for backup or archive paths of specified user tenants.
Considerations
After changing the key information for the object storage path during backup or archive operations, you must promptly update the
access_idandaccess_keyfor the backup or archive path. Otherwise, the backup task may fail or the archive operation may be blocked.For physical standby database scenarios based on log archiving, after changing the key information for the object storage path, you must quickly update the
access_idandaccess_keyin the log restore path of the standby database (standby tenant). Otherwise, log synchronization may be blocked. For detailed steps on updating theaccess_idandaccess_keyin the log restore path of the standby database (standby tenant), see Set the log restore source.
Procedure
Log in to the user tenant of the cluster as the tenant administrator of the user tenant.
Note
The administrator user in MySQL-compatible mode is
root, and in Oracle-compatible mode, it isSYS.The following example shows how to connect. Use your actual environment settings when connecting to the database.
obclient -h10.xx.xx.xx -P2883 -uroot@mysql_tenant#obdemo -p***** -AExecute the following statement to update the key information for the backup or archive path.
The SQL statement is as follows:
ALTER SYSTEM {ALTER|CHANGE|MODIFY} EXTERNAL_STORAGE_DEST PATH [=] 'path' SET ACCESS_INFO = 'access_id=new_access_id&access_key=new_access_key';The parameters are described as follows:
path: Specifies the backup or archive path for which you want to change the key information. The path must be a backup or archive path already set by the current tenant, must be an object storage path, and must includehostinformation.Taking OSS as an example, the path format is as follows:
oss://oceanbase-test-bucket/backup/data?host=***.access_id=new_access_id&access_key=new_access_key: Specifies the newaccess_idandaccess_keyafter the change. Bothaccess_idandaccess_keymust be provided.
Using OSS as the backup or archive medium, assume the current user tenant has set the backup path to
oss://oceanbase-test-bucket/backup/data?host=cn-****.aliyuncs.comand the archive path tooss://oceanbase-test-bucket/backup/archive?host=cn-****.aliyuncs.comduring backup. Examples of updating the key information for the backup and archive paths are as follows:Update the key information for the backup path
obclient> ALTER SYSTEM CHANGE EXTERNAL_STORAGE_DEST PATH='oss://oceanbase-test-bucket/backup/data?host=cn-****.aliyuncs.com' SET ACCESS_INFO = 'access_id=******&access_key=******';Update the key information for the archive path
obclient> ALTER SYSTEM CHANGE EXTERNAL_STORAGE_DEST PATH='oss://oceanbase-test-bucket/backup/archive?host=cn-****.aliyuncs.com' SET ACCESS_INFO = 'access_id=******&access_key=******';
For more examples, see ALTER/CHANGE/MODIFY EXTERNAL_STORAGE_DEST.
After the modification is successful, you can query the
DBA_OB_BACKUP_STORAGE_INFOview to confirm it.MySQL-compatible modeOracle-compatible modeConfirm the
access_idandaccess_keyinformation of the backup path.obclient[oceanbase]> SELECT AUTHORIZATION FROM oceanbase.DBA_OB_BACKUP_STORAGE_INFO WHERE PATH='oss://oceanbase-test-bucket/backup/data' AND ENDPOINT = 'host=cn-****.aliyuncs.com';The query result is as follows:
+-------------------------------------+ | AUTHORIZATION | +-------------------------------------+ | access_id=******&encrypt_key=****** | +-------------------------------------+ 1 row in setConfirm the
access_idandaccess_keyinformation of the archive path.obclient[oceanbase]> SELECT AUTHORIZATION FROM oceanbase.DBA_OB_BACKUP_STORAGE_INFO WHERE PATH='oss://oceanbase-test-bucket/backup/archive' AND ENDPOINT = 'host=cn-****.aliyuncs.com';The query result is as follows:
+-------------------------------------+ | AUTHORIZATION | +-------------------------------------+ | access_id=******&encrypt_key=****** | +-------------------------------------+ 1 row in set
Confirm the
access_idandaccess_keyinformation of the backup path.obclient[SYS]> SELECT AUTHORIZATION FROM SYS.DBA_OB_BACKUP_STORAGE_INFO WHERE PATH='oss://oceanbase-test-bucket/backup/data' AND ENDPOINT = 'host=cn-****.aliyuncs.com';The query result is as follows:
+-------------------------------------+ | AUTHORIZATION | +-------------------------------------+ | access_id=******&encrypt_key=****** | +-------------------------------------+ 1 row in setConfirm the
access_idandaccess_keyinformation of the archive path.obclient[SYS]> SELECT AUTHORIZATION FROM SYS.DBA_OB_BACKUP_STORAGE_INFO WHERE PATH='oss://oceanbase-test-bucket/backup/archive' AND ENDPOINT = 'host=cn-****.aliyuncs.com';The query result is as follows:
+-------------------------------------+ | AUTHORIZATION | +-------------------------------------+ | access_id=******&encrypt_key=****** | +-------------------------------------+ 1 row in set
