Parameters related to table restore

2024-06-28 05:30:29  Updated

This topic describes the parameters in table restore statements.

Syntax

  • Restore tables

    ALTER SYSTEM
    RECOVER TABLE table_name_list
    TO [TENANT [=]] dest_tenant_name
    FROM uri
    [UNTIL {TIME='timestamp'} | {SCN=scn} ]
    WITH 'restore_option'
    [WITH KEY FROM 'backup_key_path' ENCRYPTED BY 'password']
    [REMAP TABLE remap_table_name_list]
    [REMAP TABLEGROUP remap_tablegroup_list]
    [REMAP TABLESPACE remap_tablespace_list];
    
  • Cancel an ongoing table restore

    ALTER SYSTEM CANCEL RECOVER TABLE dest_tenant_name;
    

Parameters

Parameter Description
table_name_list The list of tables to be restored, in the format of database_name.table_name1,database_name.table_name2,…, where the table names are separated with commas (,).
When you specify database_name and table_name, take note of the following considerations:
  • The specified names must be identical to the actual names stored in the system.
    • For an Oracle tenant, the value of database_name is the username of the table owner. By default, both database_name and table_name are case-insensitive and are persisted to the internal table in uppercase.
    • For a MySQL tenant, the value of database_name is the name of the database to which the table belongs. The case sensitivity of database_name and table_name depends on the lower_case_table_names variable that is specified when the source tenant is created.
      The lower_case_table_names variable specifies whether database names and table names in a tenant are case-sensitive. If the variable is not specified when the tenant is created, the database names and table names are stored in lowercase by default and are case-insensitive in queries. For more information about the lower_case_table_names variable, see lower_case_table_names.
  • If the value of database_name or table_name contains special characters, enclose the value in backticks (``).
  • If you want to restore all tables in a database, specify table_name_list in the format of database_name.*.
  • If you want to restore all user tables in a tenant, specify table_name_list in the format of *.*.
dest_tenant_name The name of the destination tenant to which the table is to be restored. You can restore a table only to a user tenant, but not to the sys tenant or a meta tenant.
uri The data backup path and the log archive path, which are the same as those in the tenant physical restore command. If the data backup is initiated by using PLUS ARCHIVELOG, you need to specify only one path. Otherwise, the value must contain at least one data backup path and one log archive path, for example, 'file:///backup/archive, file:///backup/data'.
{TIME=‘timestamp’} | {SCN=scn} The inclusive timestamp or SCN up to which the table is restored. To restore to a specified TIME or SCN value, join the parameter name and value with an equal sign (=). By default, if you do not specify the UNTIL clause, the table is restored to the latest timestamp.
restore_option The restore options, including pool_list, locality, primary_zone, and concurrency. Separate the options with ampersands (&). We recommend that you set locality and primary_zone to the same values as those of the source tenant.
  • pool_list: required. The resource pool of the tenant. Multiple resource pools must be separated with commas (,).
  • locality: optional. The locality of replicas of the auxiliary tenant, which must match the zone information of pool_list of the cluster where the auxiliary tenant is located. By default, if this parameter is not specified, a full-featured replica is set for each zone in zone_list of the resource pool.
    Example: locality='F@z1,F@z2,F@z3'
  • primary_zone: optional. The preferred position of the leader of the auxiliary tenant, which must match the settings of pool_list and locality. In other words, the value of this parameter must match the zone information and meet the constraint that the primary region has at least two Paxos members. If this parameter is not specified, the system randomly distributes leaders in the zones specified by zone_list of locality.
    Example: primary_zone='z1'
  • concurrency: optional. The degree of parallelism (DOP) for data restore. If concurrency is not specified, the MAX_CPU value assigned to the tenant is used as the default value.
    Example: concurrency=50
WITH KEY FROM ‘backup_key_path’ ENCRYPTED BY ‘password’ The key backup information of the encrypted tenant. You need to specify the key backup information for a tenant restore only when the tenant is configured with transparent encryption. The parameters are described as follows:
  • backup_key_path: the backup path of the key.
  • password: the password that you set when you backed up the key.
remap_table_name_list The new name of the restored table. You can perform any of the following operations: rename the table without changing the database to which the table belongs; restore the table to another database without changing the table name; rename the table and restore the table to another database. Use a colon (:) to join the source object and the renamed object. The syntax varies with the operation that you perform:
  • To rename the student table as student2 without changing the database to which the table belongs, use the following syntax: REMAP TABLE school.student:student2.
    By default, if you do not change the database to which the table belongs when you restore the table to the destination tenant, the system will restore the table to the database with the same name as the destination tenant. If the database with the same name does not exist, the table fails to be restored.
  • To change the database to which the table belongs from school to college without changing the table name, use the following syntax: REMAP TABLE school.student:college.student.
  • To rename the student table as student2 and change the database to which the table belongs from school to college, use the following syntax: REMAP TABLE school.student:college.student2.
  • To restore all tables in the school database to the college database, use the following syntax: REMAP TABLE school.*:college.*
remap_tablegroup_list The table group to which the restored table belongs. By default, if the source table is bound to a table group, the system restores the table to a table group with the same name in the destination tenant. If the table group with the same name does not exist, the table fails to be restored. If the destination tenant has other table groups, you can execute this statement to restore the table to another table group. Use a colon (:) to join the source object and the renamed object.
For example, to restore all tables in the source table group tg1 to the newtg1 table group in the destination tenant, use the following syntax: REMAP TABLEGROUP tg1:newtg1.
remap_tablespace_list The tablespace to which the restored table belongs. A tablespace is a logical unit in OceanBase Database mainly used for data encryption. By default, if the source table is bound to a tablespace, the system restores the table to the tablespace with the same name in the destination tenant. If the tablespace with the same name does not exist, the table fails to be restored. If the destination tenant has other tablespaces, you can execute this statement to restore the table to another tablespace. Use a colon (:) to join the source object and the renamed object.
For example, to restore all tables in the source tablespace ts1 to the newts1 tablespace in the destination tenant, use the following syntax: REMAP TABLESPACE ts1:newts1.

Contact Us