Purpose
You can use the ALTER RESOURCE UNIT statement to modify the unit config of a resource unit. You can increase or decrease the CPU, memory, and log disk capacities in a unit config.
Limitations and considerations
If the resource unit corresponding to the unit config is being used by a tenant, observe the following considerations:
To upgrade a unit config, make sure that the nodes where the resource unit is distributed have sufficient resources available.
You can query the
GV$OB_SERVERSview for the total resources and allocated resources of each node. For more information, see View tenant and resource information.To downgrade a unit config, make sure that the total capacities of the CPU, memory, and log disk after the modification are greater than or equal to the used capacities of the tenant.
Required privileges
You can modify a unit config only as the root user of the sys tenant (namely root@sys) .
Syntax
ALTER RESOURCE UNIT unit_name
MEMORY_SIZE [=] 'size_value',
MAX_CPU [=] cpu_num,
[MIN_CPU [=] cpu_num,]
[MAX_IOPS [=] iops_num,]
[MIN_IOPS [=] iops_num,]
[IOPS_WEIGHT [=]iopsweight,]
[LOG_DISK_SIZE [=] 'size_value'];
Parameters
| Parameter | Description |
|---|---|
| unit_name | The name of the unit for which the unit config is to be modified. |
| MEMORY_SIZE | The memory size. The minimum memory size is controlled by the hidden parameter __min_full_resource_pool_memory, and is 5G by default. To ensure stability, we recommend that you set the minimum memory size to 4G.
NoticeOceanBase Database does not support memory overcommitment since V4.0.0.0. |
| MAX_CPU | The maximum number of CPU cores. The minimum value is 1, which indicates one CPU core. The value of this parameter must be greater than or equal to the current MIN_CPU value. |
| MIN_CPU | Optional. The minimum number of CPU cores. The minimum value is 1, which indicates one CPU core. The value of this parameter must be smaller than or equal to the current MAX_CPU value. |
| MAX_IOPS | Optional. The maximum IOPS. The minimum value is 1024. The value of this parameter must be greater than or equal to the MIN_IOPS value. |
| MIN_IOPS | Optional. The minimum IOPS. The minimum value is 1024. The value of this parameter must be smaller than or equal to the MAX_IOPS value. |
| LOG_DISK_SIZE | Optional. The log disk size. The default value is three times the specified memory size. Minimum value: 2G. |
Examples
Change the number of CPU cores to 2 and memory size to 5 GB for the unit config of the resource unit unit1.
obclient [oceanbase]> ALTER RESOURCE UNIT unit1 MAX_CPU 2, MEMORY_SIZE '5G';