Purpose
Before backing up data, if the original tenant has transparent encryption configured, you must use the ALTER SYSTEM BACKUP KEY statement to back up the source tenant's backup key.
Limitations and considerations
After backing up the tenant key, if key rotation is triggered again for the source tenant before data restoration, you must back up the source tenant's key again.
Privilege requirements
This statement must be executed by the root user of the sys tenant (root@sys) or the administrator user of a user tenant (root user).
Syntax
ALTER SYSTEM BACKUP KEY [TENANT [=] {tenant_name[, tenant_name]...}] TO 'backup_key_path' [ENCRYPTED BY 'password'];
Parameters
Parameter |
Description |
|---|---|
| tenant_name | The system tenant specifies the tenant name for which to back up the key. Multiple tenant names can be specified, separated by commas (,). If the system tenant does not specify a tenant, it means backing up the keys for all user tenants in the cluster.
NoticeOnly the system tenant can execute this command with the |
| backup_key_path | Specify the path for backing up the key. This path is user-defined and must not be the same as the path used for data backup or log archiving. |
| password | Specifies the encryption password for the backup key path. If not specified, the backup path is not encrypted by default. |
Examples
The system tenant will
The system tenant backs up the tenant
mysql_tenantkey to the pathfile:///data_backup_dest/keyand sets an encryption password.obclient [oceanbase]> ALTER SYSTEM BACKUP KEY TENANT = mysql_tenant TO 'file:///data_backup_dest/key' ENCRYPTED BY '******';The
mysql_tenanttenant backs up its own tenant key to the pathfile:///data_backup_dest/key.obclient [oceanbase]> ALTER SYSTEM BACKUP KEY TO 'file:///data_backup_dest/key';