Purpose
The
ALTER SYSTEM [SET] parameter_name = expressionstatement is used to modify the value of a configuration parameter.The
ALTER SYSTEM RESET parameter_namestatement is used to reset the value of a configuration parameter.
In OceanBase Database, configuration parameters are divided into cluster-level and tenant-level parameters. Cluster-level parameters apply to all nodes in the entire cluster, while tenant-level parameters apply to all nodes of the current tenant. For more information about configuration parameters, see Overview of configuration parameters and system variables.
Limitations and considerations
Only the
systenant can modify or reset cluster-level parameters. User tenants cannot modify or reset cluster-level parameters.The effective method of a configuration parameter is generally divided into dynamic and restart-effective methods. Most configuration parameters are dynamic, meaning they take effect without requiring a restart of the OBServer node. Before modifying a configuration parameter, you can use the
SHOW PARAMETERS LIKEstatement to confirm its effective method. For more information about how to view the effective method of a configuration parameter, see Cluster-level configuration parameters.
Privilege requirements
To execute the ALTER SYSTEM [SET] parameter_name = expression statement and the ALTER SYSTEM RESET parameter_name statement, the current user must have the ALTER SYSTEM privilege. For more information about OceanBase Database privileges, see Privilege classification in MySQL mode and Privilege classification in Oracle mode.
Syntax
Modify the value of a configuration parameter
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 parameter to be modified. |
| expression | Specifies the new value of the configuration parameter. |
| COMMENT | Adds a comment about the modification. This parameter is optional and is recommended not to be omitted. |
| SCOPE | Specifies the effective scope of the configuration parameter modification. The following three options are available:
The default value of SCOPE is BOTH. |
| SERVER | Specifies the OBServer node in the cluster where the configuration parameter value is to be modified. Only one OBServer node can be specified. |
| ZONE | Specifies the zone in the cluster where the configuration parameter value is to be modified. Only one zone can be specified. After specifying a zone, the modification will take effect for all OBServer nodes in the specified zone. You cannot specify both a zone and a server. |
| TENANT | Specifies the tenant for which the tenant-level configuration parameter value is to be modified. If not specified, the default is the current tenant. The options are as follows:
This clause is required only when the sys tenant modifies the tenant-level configuration parameter of a specified tenant. For more information about tenant-level configuration parameters, see Tenant-level configuration parameters. |
Reset the value of a configuration parameter
ALTER SYSTEM RESET parameter_name [SCOPE = {MEMORY | SPFILE | BOTH}] [TENANT [=] tenant_name];
Parameters
| Parameter | Description |
|---|---|
| parameter_name | Specifies the name of the configuration parameter to be reset. |
| SCOPE | Specifies the effective scope of the configuration parameter reset. The following three options are available:
The default value of SCOPE is BOTH. |
| TENANT | Specifies the tenant for which the tenant-level configuration parameter value is to be reset. If not specified, the default is the current tenant. This clause is required only when the sys tenant modifies the tenant-level configuration parameter of a specified tenant. For more information about tenant-level configuration parameters, see Tenant-level configuration parameters. |
Examples
Modify configuration items
In the sys tenant, modify the cluster-level configuration item
enable_sql_audit.obclient [oceanbase]> ALTER SYSTEM SET ENABLE_SQL_AUDIT = False SCOPE = BOTH;In the sys tenant, modify the tenant-level configuration item
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 configuration item
major_freeze_duty_timeof all tenants (including the sys tenant, user tenants, and Meta tenants) 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 configuration item
major_freeze_duty_timeof the current tenant.obclient [oceanbase]> ALTER SYSTEM SET major_freeze_duty_time='01:00';In the sys tenant, reset the cluster-level configuration item
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 configuration items
The following example shows how to modify the
log_disk_utilization_thresholdconfiguration item:obclient> ALTER SYSTEM RESET log_disk_utilization_threshold;In the sys tenant, modify the tenant-level configuration items 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';
