This topic describes the obshell restore command group, which is used to restore backup files to a specified tenant, cancel a tenant's restore task, and view restore tasks. The obshell restore command group requires that an OceanBase cluster has been initialized. You can use the -h or --help option in a command to view the help information.
obshell tenant restore
Use this command to restore backup files to a specified tenant.
${home_path}/bin/obshell tenant restore <tenant_name> [flags]
# example
/home/admin/oceanbase/bin/obshell tenant restore mytenant --timestamp "2021-01-01T00:00:00.000+08:00" -z "zone1,zone2,zone3" -d '/path/to/backup/data' -a '/path/to/backup/clog' -u unit1
home_path is the installation directory of OceanBase Database. obshell is located in the bin directory of the OceanBase Database installation directory by default. tenant_name is the name of the tenant to be restored.
The following table describes the options:
| Option | Required | Data type | Default value | Description |
|---|---|---|---|---|
| -d/--data_backup_uri | Yes | string | N/A | The data backup path of the source tenant. |
| -z/--zone | No | string | N/A | The zone distribution of the tenant. If not specified, all zones in the cluster are used. |
| --unit_num | No | int | 1 | The number of units of the tenant in the target zone. The value must be smaller than the number of nodes in the target zone. |
| -u/--unit | No | string | N/A | The resource specifications of the tenant's resource pool.
NoteYou can specify the resource specifications for a zone by using |
| --replica_type | No | string | FULL | The replica type of the tenant in the target zone. Valid values include FULL (full-featured replica) and READONLY (read-only replica).
NoteYou can specify the replica type for a zone by using |
| -p/--primary_zone | No | string | RANDOM | The primary zone of the tenant, which specifies the priority of the zones that provide read and write services. For example, primary_zone ='zone1;zone2,zone3' indicates that the tenant is provided with read and write services by zone1 with the highest priority, followed by zone2 and zone3, which are of the same priority. |
| -T/--timestamp | No | string | N/A | The timestamp to which the data is restored. The value must be in the format of "2006-01-02T15:04:05.000Z07:00". |
| -S/--scn | No | int | N/A | The SCN to which the data is restored. |
| -a/--archive_log_uri | No | string | ${data_backup_uri} | The log archive path of the source tenant. If not specified, the value of -d/--data_backup_uri is used. |
| -s/--ha_high_thread_score | No | int | N/A | The number of worker threads for high-priority HA tasks. Valid values are in the range of [0,100]. |
| -c/--concurrency | No | int | N/A | The concurrency for data restoration. If not specified, the number of MAX_CPUs allocated to the tenant is used. |
| -D/--decryption | No | string | N/A | The password for restoring the backup. This option is required only when a password is specified during data backup. |
| -k/--kms_encrypt_info | No | string | N/A | The encryption information. This option is required only when the data is encrypted or the original key management service can be accessed during restoration. |
| -y/--yes | No | N/A | N/A | Specifies whether to skip the confirmation prompt. No value needs to be specified. |
obshell restore cancel
You can use this command to cancel a restore task for a specified tenant.
${home_path}/bin/obshell restore cancel <tenant_name> [-y]
# example
/home/admin/oceanbase/bin/obshell restore cancel tenant1
home_path is the installation directory of OceanBase Database, and obshell is located in the bin directory of the installation directory by default. tenant_name is the name of the tenant for which the restore task is to be canceled.
You can use the -y or --yes option to specify whether to skip the confirmation prompt. This option does not require a value.
obshell restore show
You can use this command to view restore tasks for a tenant.
${home_path}/bin/obshell restore show <tenant_name> [-d]
# example
/home/admin/oceanbase/bin/obshell restore show tenant1
home_path is the installation directory of OceanBase Database, and obshell is located in the bin directory of the installation directory by default. tenant_name is the name of the tenant for which the restore tasks are to be viewed.
You can use the -d or --show_detail option to specify whether to display detailed information about restore tasks. This option does not require a value.