Purpose
The ALTER SYSTEM RESTORE statement is used to restore backup data for a tenant.
Limitations and considerations
Physical restore in OceanBase AI Database can be performed within the same cluster or across different clusters.
Before using the
ALTER SYSTEM RESTOREstatement to perform physical restore, please confirm the version of the backup data to be restored. For restrictions on restore versions, see [Preparations before restore].Before you use the
ALTER SYSTEM RESTOREstatement to perform physical restore, make sure that the resources required for the tenant to be restored have been created. For specific operations on creating the required resources for the tenant to be restored, see Prepare for restore.A tenant restored by using the
ALTER SYSTEM RESTOREstatement is a standby tenant by default. To convert it into a primary tenant to provide services, you must execute theALTER SYSTEM ACTIVATE STANDBYstatement. For more information about theALTER SYSTEM ACTIVATE STANDBYstatement, see ACTIVATE STANDBY.
Privilege requirements
Only the root user of the sys tenant (root@sys) can execute the ALTER SYSTEM RESTORE statement.
Syntax
ALTER SYSTEM
RESTORE dest_tenant_name
FROM uri
[ UNTIL {TIME='timestamp' | SCN=scn} ]
WITH 'restore_option'
[WITH KEY FROM 'backup_key_path' ENCRYPTED BY 'password']
[DESCRIPTION [=] 'description'];
restore_option:
pool_list=pool_name[&locality=locality][&primary_zone=zone_name][&concurrency=int_num][&kms_encrypt={true | false}][&method={full | quick}]
Parameters
Parameters |
Description |
|---|---|
| dest_tenant_name | Specifies the name of the tenant to be restored. |
| uri | Specify the data backup path set during backup. backup_data_dest Log Archiving Path log_archive_dest This value must contain at least one data backup path and one log archive path, separated by commas (,). Currently, OceanBase AI Database supports the following archive destination media: NFS, Azure Blob, AWS S3, and object storage compatible with the S3 protocol, such as Huawei OBS, Google GCS, and Tencent Cloud COS. For uri path examples, see SET LOG_ARCHIVE_DEST or SET DATA_BACKUP_DEST. |
| TIME='timestamp' \ | SCN=scn | Specifies the end point of recovery. The data is restored to this point, including all data at this point. When you specify TIME or SCN for recovery, you must use = to connect to the specified value. If the UNTIL clause is not specified, the database is restored to the latest point by default. The timestamp option supports only the YYYY-MM-DD HH24:MI:SS.FF format, which is accurate to nanoseconds. For more information about how to select the values of timestamp and scn, see Physical restore parameters. |
| restore_option | Supported pool_list, locality, primary_zone, concurrency, kms_encrypt, method and other parameters. These parameters are separated by & Separation. When specifying the locality and primary_zone, it is recommended to keep them as homogeneous as possible with those of the source tenant. If they are not homogeneous, load balancing operations may occur after the tenant recovers and is activated as the primary tenant, affecting performance.
|
| WITH KEY FROM 'backup_key_path' ENCRYPTED BY 'password' | Specifies the key backup information for the encrypted tenant. You only need to specify the key backup information during recovery if transparent encryption is configured for the source tenant. The parameters are as follows:
|
| description | Optional. The description specified by the user. |
Examples
Restore tenant
mysqlfrom the NFS data backup path and NFS log archive path to the specified timestamp2022-06-01 00:00:00. Specify the resource pool asrestore_pool, the replica locality asF@z1,F@z2,F@z3, and setprimary_zonetoz1for a full restore.obclient [oceanbase]> ALTER SYSTEM RESTORE mysql FROM 'file:///data/nfs/backup/data,file:///data/nfs/backup/archive' UNTIL TIME='2022-06-01 00:00:00' WITH 'pool_list=restore_pool&locality=F@z1,F@z2,F@z3&primary_zone=z1';Restore the tenant
mysqlfrom the NFS data backup path and NFS log archive path to the current latest archive point. Specify the resource pool asrestore_pooland set the data restore concurrency toconcurrency50, using a full restore method.obclient [oceanbase]> ALTER SYSTEM RESTORE mysql FROM 'file:///data/nfs/backup/data,file:///data/nfs/backup/archive' WITH 'pool_list=restore_pool&concurrency=50';Restore tenant
mysqlto a specified SCN from the NFS data backup path and NFS log archive path, specifying the resource pool asrestore_pool, using a quick restore method.obclient [oceanbase]> ALTER SYSTEM RESTORE mysql FROM 'file:///data/nfs/backup/data,file:///data/nfs/backup/archive' UNTIL SCN=1658285759724047000 WITH 'pool_list=restore_pool&method=quick';Restore the tenant
mysqlfrom the S3 backup path and S3 log archive path to the specified timestamp2024-01-15 00:00:00, specifying the resource pool asrestore_pool.obclient [oceanbase]> ALTER SYSTEM RESTORE mysql FROM 's3://oceanbase-test-bucket/backup/data?host=s3.<region>.amazonaws.com&access_id=***&access_key=***&s3_region=***, s3://oceanbase-test-bucket/backup/archive?host=s3.<region>.amazonaws.com&access_id=***&access_key=***&s3_region=***' UNTIL TIME='2024-01-15 00:00:00' WITH 'pool_list=restore_pool';s3_regionindicates the region where the S3 bucket is located.
Restore the tenant
mysqlfrom the OBS backup path and log archive path to the specified timestamp2023-06-01 00:00:00, designate the resource pool asrestore_pool, and perform a full restore.obclient> ALTER SYSTEM RESTORE mysql FROM 's3://oceanbase-test-bucket/backup/data/?host=obs.***.myhuaweicloud.com&access_id=***&access_key=***,s3://oceanbase-test-bucket/backup/archive/?host=obs.***.myhuaweicloud.com&access_id=***&access_key=***' UNTIL TIME='2023-06-01 00:00:00' WITH 'pool_list=restore_pool';Restore the tenant
mysqlfrom the GCS backup path and log archive path to the specified timestamp2023-06-01 00:00:00, specifying the resource pool asrestore_pool, and perform a full restore.obclient> ALTER SYSTEM RESTORE mysql FROM 's3://oceanbase-test-bucket/backup/data/?host=https://storage.googleapis.com&access_id=***&access_key=***,s3://oceanbase-test-bucket/backup/archive/?host=https://storage.googleapis.com&access_id=***&access_key=***' UNTIL TIME='2023-06-01 00:00:00' WITH 'pool_list=restore_pool';Restore the tenant
mysqlfrom the COS backup path and log archive path to the specified timestamp2023-06-01 00:00:00, specify the resource pool asrestore_pool, and perform a full restore.obclient> ALTER SYSTEM RESTORE mysql FROM 's3://oceanbase-test/backup/data?host=cos.ap-***x.myqcloud.com&access_id=***&access_key=***,s3://oceanbase-test/backup/archive?host=cos.ap-***x.myqcloud.com&access_id=***&access_key=***' UNTIL TIME='2023-06-01 00:00:00' WITH 'pool_list=restore_pool';