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 the normal execution of backups or archiving.
Limitations
For V4.3.5, changing the key information for a backup or archive path is supported starting from V4.3.5 BP2.
Only the
access_idandaccess_keyfor the object storage path can be changed.Only user tenants can change the key information for their own backup or archive paths. The system tenant cannot change the key information for a backup or archive path of a specified user tenant.
Considerations
After changing the key information for the object storage path during backup or archiving, you must promptly update the
access_idandaccess_keyfor the backup or archive path. Otherwise, it may cause the backup task to fail or the archiving process to stop progressing.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, it may prevent log synchronization from proceeding. 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 is an example connection string. Please adjust it according to your actual environment 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.
Taking OSS as the backup or archive medium, for example, 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 changing the key information for the backup and archive paths are as follows:Change 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=******';Change the key information of 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_keyof 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_keyof 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_keyof 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_keyof 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
