All Products
Search
Document Center

ALTER SYSTEM

Last Updated: Jun 18, 2021

You can execute the ALTER SYSTEM statement to send commands to the ApsaraDB for OceanBase system to perform specified operations.

BOOTSTRAP

Description

You can use this statement to bootstrap an ApsaraDB for OceanBase cluster.

Syntax

alter_system_bootstrap_stmt:
    ALTER SYSTEM BOOTSTRAP opt_cluster_type region_zone_server_list;
    
opt_cluster_type:
    [CLUSTER cluster_role]
 
cluster_role:
    PRIMARY | STANDBY
 
region_zone_server_list:
    region_zone_server [, region_zone_server ...]

region_zone_server:
    [region] zone server

region:
    REGION [=] region_name

zone:
    ZONE [=] zone_name

server:
    SERVER [=] ip_port

ip_port:
    'STR_VALUE:INT_VALUE'

Parameters

To bootstrap the system, specify the RootService nodes. Use commas (,) to separate multiple RootService nodes.

Parameter

Description

region_name

The region where the RootService node is deployed. Specify this parameter if the cluster is deployed across zones in multiple regions.

zone_name

The zone to which the RootService node belongs.

ip_port

The IP address and port number of the RootService node.

PRIMARY | STANDBY

Specifies whether to run the primary or secondary database. Use the PRIMARY or STANDBY keyword to specify the database that is used when the system is started. By default, if you do not use PRIMARY or STANDBY, the system runs the primary database.

Examples

  • Specify a RootService node.
ALTER SYSTEM BOOTSTRAP ZONE 'zone1' SERVER '10.218.248.178:55410';
  • Separate multiple RootService nodes with commas (,).
ALTER SYSTEM BOOTSTRAP ZONE 'zone1' SERVER '172.24.65.24:55410', ZONE 'zone2' 
SERVER '172.24.65.114:55410';
  • Run a secondary database.
ALTER SYSTEM BOOTSTRAP CLUSTER STANDBY ZONE 'zone1' SERVER '10.218.248.178:55410';

JOB

Description

You can use this statement to trigger a background job. You can configure parameters to specify a job.

Syntax

alter_system_job_stmt:
    ALTER SYSTEM RUN JOB job_name
    [zone | server];

Parameters

Parameter

Description

JOB job_name

The name of the job. If special characters are included, the job name must be enclosed in single quotation marks ('). If special characters are not included, you can determine whether to use single quotation marks (') as needed. ApsaraDB for OceanBase supports the following jobs:

  • check_partition_table: Check and delete partitioned tables on an OBServer.

  • root_inspection: Trigger a self-check job on a RootService node.

zone | server

Specifies whether to run the job in a specified zone or on a specified server.

Examples

  • Trigger a self-check job on a RootService node.
ALTER SYSTEM RUN JOB "root_inspection";

MERGE

Description

You can use this statement to trigger major or minor freeze operations.

Syntax

alter_system_merge_stmt:
    ALTER SYSTEM merge_action;

merge_action:
      MAJOR FREEZE
    | MINOR FREEZE
      [tenant_list | replica] [server_list] [zone]
    | START MERGE
      zone
    | {SUSPEND | RESUME} MERGE
      [zone]
    | CLEAN MERGE ERROR

tenant_list:
    TENANT [=] (tenant_name_list)

tenant_name_list:
    tenant_name [, tenant_name ...]

replica:
    PARTITION_ID [=] 'partition_id%partition_count@table_id'

server_list:
    SERVER [=] ip_port_list

Parameters

Parameter

Description

MAJOR FREEZE

Trigger a daily major freeze operation.

MINOR FREEZE

Trigger a minor freeze operation.

START MERGE

Start a daily major freeze operation.

{SUSPEND | RESUME} MERGE

Suspend or resume a daily major freeze operation.

CLEAN MERGE ERROR

Clear errors that occur during major freeze operations.

tenant_name

The tenant on which minor freeze operations are performed.

PARTITION_ID

The partition in which minor freeze operations are performed.

SERVER

The OBServer on which minor freeze operations are performed.

zone

The zone in which major freeze operations are performed.

Examples

  • Trigger a daily major freeze operation.
OceanBase(root@oceanbase)>alter system major freeze;
Query OK, 0 rows affected (0.06 sec)

PARAMETER

Description

You can use this statement to modify configuration items.

Syntax

alter_system_parameter_stmt:
    ALTER SYSTEM [SET]
    parameter_name = expression [SCOPE = {MEMORY | SPFILE | BOTH}] [COMMENT [=} 'text']
                                                            {SERVER [=] 'ip:port' | ZONE [=] 'zone'};

Parameters

Parameter

Description

parameter_name

The name of the configuration item that you want to modify.

expression

The new value of the configuration item.

COMMENT 'text'

Add a comment about the modification. This parameter is optional. We recommend that you do not omit it.

SCOPE

The effective range of the modification. Valid values:

  • MEMORY: Only the configuration item in the memory is modified. The modification takes effect immediately but becomes invalid after the server is restarted. No configuration items support this option.

  • SPFILE: Only the configuration item in the configuration table is modified. The modification takes effect after the server is restarted.

  • BOTH: Both the configuration item in the configuration table and that in the memory are modified. The modification takes effect immediately and remains valid after the server is restarted.

The default value is BOTH. If you specify BOTH or MEMORY for a configuration item on which the modification cannot take effect immediately, the system returns an error.

SERVER

The configuration item of the specified server. This indicates that only the configuration item of the specified server is modified.

ZONE

The name of the zone. This indicates that the configuration item modification applies to the specified type of servers in the specified cluster. If you do not specify the zone name, the configuration item modification applies to the specified type of the servers in all clusters.

Note

To modify multiple system configuration items at a time, separate them with commas (,).

Execute the following statement to query system configuration items: SHOW PARAMETERS [LIKE 'pattern' | WHERE expr];

Examples

  • Modify the configuration item enable_sql_audit.
OceanBase(root@oceanbase)>show parameters like 'enable_sql_audit';
+------+----------+---------------+----------+------------------+-----------+-------+---------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+
| zone | svr_type | svr_ip        | svr_port | name             | data_type | value | info                                                                                                          | section  | scope   | source  | edit_level        |
+------+----------+---------------+----------+------------------+-----------+-------+---------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+
| z1   | observer | 11.11.111.111 |    19510 | enable_sql_audit | NULL      | True  | specifies whether SQL audit is turned on. The default value is TRUE. Value: TRUE: turned on FALSE: turned off | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
+------+----------+---------------+----------+------------------+-----------+-------+---------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+
1 rows in set (0.02 sec)

OceanBase(root@oceanbase)>alter system set enable_sql_audit = false scope = BOTH;
Query OK, 0 rows affected (0.05 sec)

OceanBase(root@oceanbase)>show parameters like 'enable_sql_audit';
+------+----------+---------------+----------+------------------+-----------+-------+---------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+
| zone | svr_type | svr_ip        | svr_port | name             | data_type | value | info                                                                                                          | section  | scope   | source  | edit_level        |
+------+----------+---------------+----------+------------------+-----------+-------+---------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+
| z1   | observer | 11.11.111.111 |    19510 | enable_sql_audit | NULL      | False | specifies whether SQL audit is turned on. The default value is TRUE. Value: TRUE: turned on FALSE: turned off | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
+------+----------+---------------+----------+------------------+-----------+-------+---------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+
1 rows in set (0.02 sec)

REFRESH

Description

You can use this statement to refresh database information, such as the schema, time zone, and caches.

Syntax

alter_system_refresh_stmt:
    ALTER SYSTEM refresh_action;

refresh_action:
      REFRESH SCHEMA
      [zone | server]
    | REFRESH TIME_ZONE_INFO
    | FLUSH cache_type CACHE
      [tenant_list] [GLOBAL]
    | FLUSH KVCACHE
      [tenant] [CACHE [=] cache_name]

cache_type:
      ALL
    | LOCATION
    | CLOG
    | ILOG
    | COLUMN_STAT
    | BLOCK_INDEX
    | BLOCK
    | ROW
    | BLOOM_FILTER
    | SCHEMA
    | PLAN

tenant:
    TENANT [=] tenant_name

cache_name:

Parameters

Parameter

Description

REFRESH SCHEMA

Refresh the schema. In normal cases, when the system executes a data definition language (DDL) statement, the RootService node notifies all OBServers to refresh the schemas. Assume that some OBServers are disconnected from the RootService node due to exceptions. In this case, you must manually refresh the schemas. You can refresh the schema for a single OBServer or refresh all the schemas in a cluster.

REFRESH TIME_ZONE_INFO

Refresh the local time zone of all servers in the cluster.

FLUSH cache_type CACHE

Clear the caches of the specified type.

FLUSH KVCACHE

Clear the KV caches.

  • If tenant and cache_name are specified, the system clears the specified KV cache under the specified tenant.

  • If only tenant is specified, the system clears all the KV cache under the specified tenant.

  • If you leave tenant and cache_name empty, the system clears all the KV cache under all tenants.

Examples

  • Refresh the schema for a single OBServer:
ALTER SYSTEM REFRESH SCHEMA SERVER='172.24.65.24:55410';
  • Refresh all schemas in a zone:
ALTER SYSTEM REFRESH SCHEMA ZONE='zone1';

REPLICA

Description

You can use this statement to migrate, replicate, or delete replicas. You can also change the replica type or switch replica roles.

Syntax

alter_system_replica_stmt:
    ALTER SYSTEM replica_action;

replica_action:
      SWITCH REPLICA
      {LEADER | FOLLOWER}
      {replica server | server [tenant_name] | zone [tenant_name]}
    | DROP REPLICA partition_id_desc
      replica server [create_timestamp] [zone] [FORCE]
    | {MOVE | COPY} REPLICA
      replica source destination
    | REPORT REPLICA partition_id_desc 
      {zone | server}
    | RECYCLE REPLICA partition_id_desc 
      {zone | server}
    | {ALTER | CHANGE | MODIFY} REPLICA  
      replica server [set] REPLICA_TYPE = replica_type

source:
    SOURCE [=] 'ip:port'

destination:
    DESTINATION [=] 'ip:port'
    
partition_id_desc
    PARTITION_ID partition_id%partition_count@table_id

partition_idx | partition_count | table_id | task_id:
    INT_VALUE

create_timestamp:
    CREATE_TIMESTAMP [=] INT_VALUE

tenant_name_list:
    tenant_name [, tenant_name ...]

replica_type:
      {FULL | F}
    | {READONLY | R}
    | {LOGONLY | L}

Parameters

Parameter

Description

SWITCH REPLICA

Select a new replica leader.

DROP REPLICA

Delete a replica. To delete a replica on the specified OBServer, specify the following parameters: PARTITION_ID, SERVER, and CREATE_TIMESTAMP.

{MOVE | COPY} REPLICA

Migrate or replicate a replica. You must specify a source OBServer, a destination OBServer, and a partition ID.

REPORT REPLICA

Report replicas. This clause requires a single OBServer or all the OBServers in a zone to report replicas.

RECYCLE REPLICA

Recycle replicas that you no longer need.

{ALTER | CHANGE | MODIFY} REPLICA

Modify the replica attributes. You can modify the type of a specified replica. The following replica types are supported: FULL, READONLY, and LOGONLY. You can set REPLICA_TYPE to the full name or abbreviation of a valid replica type, such as F, R, or L. The value is case-insensitive.

Examples

  • Migrate a replica.
ALTER SYSTEM MOVE REPLICA PARTITION_ID '0%4@1100611139403777'
SOURCE '172.24.65.24:55410'
DESTINATION '172.24.65.26:55410';
  • Delete a replica.
ALTER SYSTEM DROP REPLICA PARTITION_ID '0%4@1100611139403777'
SERVER '172.24.65.26:55410';
  • Modify the type of a replica.
ALTER SYSTEM CHANGE REPLICA PARTITION_ID '0%4@1100611139403777'
SERVER '172.24.65.26:55410';
CHANGE REPLICA_TYPE = 'L';
  • Select a new replica leader.
ALTER SYSTEM SWITCH REPLICA LEADER PARTITION_ID '0%4@1100611139403777'
SERVER '172.24.65.26:55410';

ROOTSERVICE

Description

You can use this statement to change the role of a RootService node.

Syntax

alter_system_rootservice_stmt:
    ALTER SYSTEM SWITCH ROOTSERVICE {LEADER | FOLLOWER} {zone | server};

Parameters

Parameter

Description

LEADER | FOLLOWER

Set the role of a RootService node to LEADER or FOLLOWER.

zone | server

Change the role of a specified RootService node or a RootService node in a specified zone.

Examples

  • Change the role of a RootService node in zone z1 to LEADER.
ALTER SYSTEM SWITCH ROOTSERVICE LEADER ZONE 'z1';

SERVER

Description

You can use this statement to maintain OBServers. For example, you can add, delete, start, or stop an OBServer.

Syntax

alter_system_server_stmt:
    ALTER SYSTEM server_action SERVER ip_port_list [zone];

server_action:
      ADD
    | DELETE
    | CANCEL DELETE
    | START
    | STOP
    | FORCE STOP

ip_port_list:
    ip_port [, ip_port ...]

Parameters

The following figure displays the OBServer status.

image.png

Parameter

Description

ip_port

The IP address and port number of the OBServer.

zone

If a zone is specified, the system checks whether the OBServer that you want to maintain is deployed in the specified zone.

ADD

Add an OBServer.

DELETE

Delete an OBServer.

CANCEL DELETE

Abort a DELETE operation on an OBServer.

START

Start an OBServer.

STOP

Stop an OBServer.

FORCE STOP

Forcibly stop an OBServer.

Examples

  • Add an OBServer.
ALTER SYSTEM ADD SERVER '172.24.65.113:55410' ZONE 'zone1';

Notice

  • You can execute the ALTER SYSTEM ADD SERVER or ALTER SYSTEM DELETE SERVER statement to add a server to or delete a server from the server list. Only servers on the server list can provide services.

  • When the ALTER SYSTEM DELETE SERVER statement is executed, the system selects a new replica leader and replicates replicas.

  • The ALTER SYSTEM DELETE SERVER statement is time-consuming. You can execute the ALTER SYSTEM CANCEL DELETE SERVER statement to abort this operation.

THROTTLE

Description

You can use this statement to configure throttling rules.

Syntax

alter_system_throttle_stmt:
    ALTER SYSTEM throttle_action;

throttle_action:
      ENABLE SQL THROTTLE [priority_option] [using_metric_option_list]
    | DISABLE SQL 

priority_option:
    FOR PRIORITY <= INT_VALUE

using_metric_option_list:
    USING metric_option_list

metric_option_list:
    metric_option [metric_option ...]

metric_option:
      RT = {INT_VALUE | DECIMAL_VALUE}
    | CPU = {INT_VALUE | DECIMAL_VALUE}
    | IO = INT_VALUE
    | NETWORK = {INT_VALUE | DECIMAL_VALUE}
    | QUEUE_TIME = {INT_VALUE | DECIMAL_VALUE}
    | LOGICAL_READS = {INT_VALUE | DECIMAL_VALUE}

Parameters

Parameter

Description

ENABLE SQL

Enable throttling. You can configure the parameters to enable throttling based on the specified rules and metrics.

FOR PRIORITY

Configure the priority to throttle part of the sessions.

RT

Enable throttling based on the amount of time required for executing an SQL statement.

CPU

Enable throttling based on the CPU utilization. This option is not supported.

IO

Enable throttling based on the number of I/O operations. This option is not supported.

NETWORK

Enable throttling based on the network traffic during data transmission. This option is not supported.

QUEUE_TIME

Enable throttling based on the wait time for a query in the queue.

LOGICAL_READS

Enable throttling based on the number of logical reads. This option is not supported.

DISABLE SQL

Disable throttling.

Examples

  • Assume that you want to throttle the sessions where the values for FOR PRIORITY are less than or equal to 100. Execute the following statement to throttle the sessions that wait longer than 0.1s in the queue:
alter system enable sql throttle for priority <= 100 using queue_time=0.1

UNIT

Description

You can use this statement to migrate units.

Syntax

alter_system_unit_stmt:
    ALTER SYSTEM MIGRATE
    UNIT [=] unit_id DESTINATION [=] ip_port

unit_id:
    INT_VALUE

Parameters

Parameter

Description

unit_id

The ID of the unit.

ip_port

The server IP address to which the unit is migrated.

Examples

  • Migrate unit 1001 to 11.11.111.111:19510.
OceanBase(root@oceanbase)>alter system migrate unit = 1001 destination = '11.11.111.111:19510';
Query OK, 0 rows affected (0.05 sec)

ZONE

Description

You can use this statement to maintain zones. For example, you can add, delete, activate, or deactivate zones.

Syntax

alter_system_zone_stmt:
      ADD ZONE zone_name
      [zone_option_list]
    | {ALTER | CHANGE | MODIFY} ZONE zone_name
      [SET] zone_option_list
    | {DELETE | START | STOP | FORCE STOP} ZONE zone_name

zone_option_list:
    zone_option [, zone_option ...]

zone_option:
      region
    | idc
    | ZONE_TYPE {READONLY | READWRITE}

idc:
    STR_VALUE

Parameters

Parameter

Description

ADD ZONE

Add a zone.

{ALTER | CHANGE | MODIFY} ZONE

Modify the region property for a zone.

DELETE ZONE

Delete a zone. Before you delete a zone, ensure that no servers are available in the zone.

START | STOP

Activate or deactivate a zone.

Examples

  • Delete a zone.
OceanBase(root@oceanbase)>alter system delete zone 'z1';
ERROR 4668 (HY000): The zone is not empty and can not be deleted. You should delete the servers of the zone. There are 1 servers alive and 0 not alive.

CLUSTER

Description

You can execute this statement to manage clusters. For example, you can add or delete a cluster, or modify cluster attributes.

Syntax

ALTER SYSTEM  cluster_action cluster_name CLUSTER_ID INTNUM;
cluster_action:
    ADD CLUSTER
    | REMOVE CLUSTER
    | ENABLE CLUSTER SYNCHRONIZATION
    | DISABLE CLUSTER SYNCHRONIZATION

Parameters

Parameter

Description

ADD CLUSTER

Add a secondary database.

REMOVE CLUSTER

Delete an existing secondary database.

ENABLE CLUSTER SYNCHRONIZATION

Enable data synchronization for a secondary database.

DISABLE CLUSTER SYNCHRONIZATION

Disable data synchronization for a secondary database.

Examples

  • Add a secondary database.
ALTER SYSTEM ADD CLUSTER 'ob1.test' cluster_id = 1;

SWITCHOVER

Description

You can execute this statement to switch cluster roles. For example, you can switch a primary cluster to the secondary role, or switch a secondary cluster to the primary role.

Syntax

ALTER SYSTEM commit_switchover_clause;

commit_switchover_clause:
    COMMIT TO SWITCHOVER TO PRIMARY
    | COMMIT TO SWITCHOVER TO PHYSICAL STANDBY
    | ACTIVATE PHYSICAL STANDBY CLUSTER
    | CONVERT TO PHYSICAL STANDBY   

Parameters

Parameter

Description

COMMIT TO SWITCHOVER TO PRIMARY

Switch a secondary cluster to the primary role. Execute this statement on a secondary cluster. Before you execute this statement, ensure that the original primary cluster is switched to the secondary role, and no another primary cluster exists.

COMMIT TO SWITCHOVER TO PHYSICAL STANDBY

Switch a primary cluster to the secondary role. Execute this statement on the primary cluster. Before you execute this statement, ensure that at least a secondary cluster is synchronized with the primary cluster. After you switch a primary cluster to the secondary role, you can also switch the cluster to the primary role again.

ACTIVATE PHYSICAL STANDBY CLUSTER

Switch a secondary cluster to the primary role if the primary cluster becomes faulty.

CONVERT TO PHYSICAL STANDBY

Switch a primary database to the secondary role.

Examples

  • Switch a primary database to the secondary role.
ALTER SYSTEM COMMIT TO SWITCHOVER TO PHYSICAL STANDBY;
  • Switch a secondary database to the primary role.
ALTER SYSTEM COMMIT TO SWITCHOVER TO PRIMARY;
  • The primary cluster becomes faulty. Switch a secondary cluster to the primary role.
ALTER SYSTEM ACTIVATE PHYSICAL STANDBY CLUSTER;
  • Restart the old primary database and switch it to the secondary role.
ALTER SYSTEM CONVERT TO PHYSICAL STANDBY;

BALANCE TASK

Description

You can use this statement to clear load balancing tasks that are not being scheduled.

Syntax

ALTER SYSTEM REMOVE BALANCE TASK opt_tenant_list opt_zone_list opt_balance_task_type;

opt_tenant_list
    TENANT [=] name,name_list
    
opt_zone_list
    ZONE [=] zone_name, zone_list
    
opt_balance_task_type
    ALL
    | MANUAL
    | AUTO

Parameters

Parameter

Description

opt_tenant_list

The tenants. If you leave this parameter empty, the tasks under all tenants are cleared.

opt_zone_list

The zones. This parameter is optional.

opt_balance_task_type

The type of the tasks to be cleared. Valid values:

  • ALL: all tasks.

  • AUTO: tasks that are automatically generated.

  • MANUAL: tasks that are manually generated.

Examples

  • Clear the tasks that are not being scheduled under all tenants.
ALTER SYSTEM REMOVE BALANCE TASK;

CANCEL MIGRATE UNIT

Description

You can use this statement to cancel the migration of units.

Syntax

ALTER SYSTEM CANCEL MIGRATE UNIT unit_id;

Parameters

Parameter

Description

unit_id

The ID of the unit that is being migrated.

Examples

  • Cancel the migration of unit 1001.
ALTER SYSTEM CANCEL MIGRATE UNIT 1001;

RESTORE

Description

You can use this statement to restore tenant data.

Syntax

alter system restore dest_tenant from source_tenant at 'uri' until 'timestamp' with 'restore_option';

Parameters

Parameter

Description

dest_tenant

The name of the new tenant to which the data is restored.

source_tenant

The name of the original tenant.

uri

The path from which the tenant data is restored.

timestamp

The timestamp to which the tenant data is restored. The value must be greater than or equal to START_TIME of baseline backup data in CDB_OB_BACKUP_SET_DETAILS, and less than or equal to MAX_NEXT_TIME of backup logs in CDB_OB_BACKUP_ARCHIVELOG_SUMMARY.

restore_option

The options for restoration. Valid values:

  • backup_cluster_name: the name of the source cluster. This parameter is required.

  • backup_cluster_id: the ID of the source cluster. This parameter is required.

  • pool_list: the resource pool of the user. This parameter is required.

  • locality: the locality of the tenant. This parameter is optional.

  • kms_encrypt: This parameter is optional. If you set kms_encrypt to true, specify kms_encrypt_info during restoration.

Examples

  • Restore the tenant data.
alter system restore restored_trade from trade 
    at 'oss://antsys-oceanbasebackup/backup_rd/20200323? host=cn-hangzhou-alipay-b.oss-cdn.aliyun-inc.com&access_id=xxx&access_key=xxx'
  until ' 2020-03-23 08:59:45'
  with 'backup_cluster_name=ob20daily.backup&backup_cluster_id=1&pool_list=restore_pool';
 
alter system restore restored_trade from trade 
  at 'file:///data/nfs/physical_backup_test/20200520'
  until '2020-05-21 09:39:54.071670' 
  with 'backup_cluster_name=ob20daily.backup&backup_cluster_id=1&pool_list=restore_pool&locality=F@z1,F@z2,F@z3';

CHANGE TENANT

Description

You can use this statement to switch to another tenant.

Syntax

ALTER SYSTEM CHANGE TENANT tenant_name;

ALTER SYSTEM CHANGE TENANT TENANT_ID [=] INTNUM; 

Parameters

Parameter

Description

tenant_name

The name of the tenant that you want to switch to.

TENANT_ID

The ID of the tenant that you want to switch to.

Examples

  • Switch to the tenant whose ID is 1001.
ALTER SYSTEM CHANGE TENANT TENANT_ID = 1001;

Notes

  1. Log on to the database as a system tenant. A general tenant cannot execute this statement.
  2. Execute this statement on an OBServer that is running properly. If an OBServer is disconnected, execute this statement again after the OBServer is recovered.
  3. You cannot switch to another tenant when transactions are being processed.
  4. If you switch to a non-system tenant, you cannot execute data definition language (DDL) statements.

BACKUP

Description

You can use this statement to trigger data backup.

Syntax

Specify a path to store the backup data: alter system set backup_dest = <backup_uri>
Enable log archiving: alter system archivelog
Disable log archiving: alter system noarchivelog
Back up baseline data for a cluster: alter system backup database;
Cancel the current backup task: alter system cancel backup

Parameters

Parameter

Description

backup_uri

The path to store the backup data. You can specify an Object Storage Service (OSS) path or a file system. For more information about the formats, see Examples.

Examples

  • Set the path to store the backup data.
alter system set backup_dest='oss://antsys-oceanbasebackup/backup_dir? host=xxx&access_id=xxx&access_key=xxx';
alter system set backup_dest='file:///data/nfs/physical_backup_dir';

Notes

Log on to the database as a system tenant. A general tenant cannot execute this statement.