Purpose
The
ALTER SYSTEM [SET] parameter_name = expressionstatement is used to modify the value of a configuration item.The
ALTER SYSTEM RESET parameter_namestatement is used to reset the value of a configuration item.
In OceanBase Database, configuration items are divided into cluster-level and tenant-level. Cluster-level configuration items apply to all nodes in the cluster, while tenant-level configuration items apply to all nodes of the current tenant. For more information about configuration items, see Overview of configuration items and system variables.
Limitations and considerations
Only the
systenant can modify or reset cluster-level configuration items. User tenants cannot modify or reset cluster-level configuration items.The effectiveness of configuration items is generally divided into dynamic effectiveness and restart effectiveness. Most configuration items are dynamically effective, meaning they take effect without the need to restart the OBServer node. Before modifying a configuration item, you can use the
SHOW PARAMETERS LIKEstatement to confirm its effectiveness. For more information about how to check the effectiveness of configuration items, see Cluster-level configuration items.
Privilege requirements
To execute the ALTER SYSTEM [SET] parameter_name = expression and ALTER SYSTEM RESET parameter_name statements, the current user must have the ALTER SYSTEM privilege. For more information about privileges in OceanBase Database, see Privilege classification in MySQL mode and Privilege classification in Oracle mode.
Syntax
Modify the value of a configuration item
ALTER SYSTEM [SET] alter_system_set_parameter_action [, alter_system_set_parameter_action...]
alter_system_set_parameter_action:
parameter_name = expression [COMMENT [=] 'text'] [SCOPE = {MEMORY | SPFILE | BOTH}] [SERVER [=] 'ip:port' | ZONE [=] 'zone_name' | TENANT [=] {sys | all_user | all | all_meta | tenant_name}]
Parameters
| Parameter | Description |
|---|---|
| parameter_name | Specifies the name of the configuration item to be modified. |
| expression | Specifies the new value of the configuration item. |
| COMMENT | Adds a comment about the modification. This parameter is optional, but it is recommended not to omit it. |
| SCOPE | Specifies the scope of the configuration item modification. The options are as follows:
The default value of SCOPE is BOTH. |
| SERVER | Specifies the OBServer node in the cluster where the configuration item value is to be modified. Only one OBServer node can be specified. |
| ZONE | Specifies the zone in the cluster where the configuration item value is to be modified. Only one zone can be specified. After specifying a zone, the modification will take effect on all OBServer nodes in the zone. You cannot specify both a zone and a server. |
| TENANT | Specifies the tenant for which the tenant-level configuration item value is to be modified. If not specified, it defaults to the current tenant. The options are as follows:
This clause is required only when the sys tenant modifies the tenant-level configuration item of a specified tenant. For a list of tenant-level configuration items, see Tenant-level configuration items. |
Reset the value of a configuration item
ALTER SYSTEM RESET parameter_name [SCOPE = {MEMORY | SPFILE | BOTH}] [TENANT [=] tenant_name];
Parameters
| Parameter | Description |
|---|---|
| parameter_name | Specifies the name of the configuration item to be reset. |
| SCOPE | Specifies the scope of the configuration item reset. The options are as follows:
The default value of SCOPE is BOTH. |
| TENANT | Specifies the tenant for which the tenant-level configuration item value is to be reset. If not specified, it defaults to the current tenant. This clause is required only when the sys tenant modifies the tenant-level configuration item of a specified tenant. For a list of tenant-level configuration items, see Tenant-level configuration items. |
Examples
Modify a configuration parameter
In the sys tenant, modify the cluster-level parameter
enable_sql_audit.obclient [oceanbase]> ALTER SYSTEM SET ENABLE_SQL_AUDIT = False SCOPE = BOTH;In the sys tenant, modify the tenant-level parameter
connection_control_max_connection_delayof the tenanttenant.obclient [oceanbase]> ALTER SYSTEM SET connection_control_max_connection_delay = 2147483646 TENANT = tenant;In the sys tenant, modify the tenant-level parameter
major_freeze_duty_timeof all tenants (including the sys tenant, user tenants, and meta tenant) in the cluster.You must execute the following commands in the sys tenant:
obclient [oceanbase]> ALTER SYSTEM SET major_freeze_duty_time='01:00' TENANT = sys;obclient [oceanbase]> ALTER SYSTEM SET major_freeze_duty_time='01:00' TENANT = all_user;obclient [oceanbase]> ALTER SYSTEM SET major_freeze_duty_time='01:00' TENANT = all_meta;In the user tenant, modify the tenant-level parameter
major_freeze_duty_time.obclient [oceanbase]> ALTER SYSTEM SET major_freeze_duty_time='01:00';In the sys tenant, reset the cluster-level parameter
enable_sql_auditto its default value. The change takes effect immediately and is also written to theSPFILE.obclient [oceanbase]> ALTER SYSTEM RESET ENABLE_SQL_AUDIT SCOPE = BOTH;
Reset a configuration parameter
The following example shows how to modify the
log_disk_utilization_thresholdparameter:obclient> ALTER SYSTEM RESET log_disk_utilization_threshold;In the sys tenant, modify the tenant-level parameters of all or specified tenants. The following example shows how to do this:
obclient> ALTER SYSTEM RESET log_disk_utilization_threshold TENANT='ALL'; obclient> ALTER SYSTEM RESET log_disk_utilization_threshold TENANT='Oracle';