Purpose
The ALTER RESOURCE UNIT statement is used to modify the resource specifications of a resource unit. Modifying the resource specifications primarily involves increasing or decreasing the CPU, memory, and log disk capacity.
Limitations and considerations
Before modifying the resource specifications, if the resource unit is currently being used by a tenant, the following considerations apply:
If you want to increase the resource specifications, ensure that each node where the resource unit resides has sufficient remaining resources available for allocation.
You can query the
GV$OB_SERVERSview to confirm the total resources and the resources already allocated. For more information, see View tenant and resource information.If you want to decrease the resource specifications, ensure that the total resources after the modification (CPU, memory, and log disk capacity) are greater than or equal to the total resources currently used by the tenant.
Privilege requirements
Only the root user of the sys tenant (root@sys) can modify the resource specifications of a resource unit. Other tenants do not support modifying the resource specifications of a resource unit.
Statement
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,]
[MAX_NET_BANDWIDTH [=] bandwidth_num,]
[NET_BANDWIDTH_WEIGHT [=] bandwidth_weight_num,]
[LOG_DISK_SIZE [=] 'size_value'];
Parameters
| Parameter | Description |
|---|---|
| unit_name | Specifies the name of the resource unit whose resource specifications are to be modified. |
| MEMORY_SIZE | Specifies the memory size. The minimum value is controlled by the hidden parameter __min_full_resource_pool_memory, which defaults to 5G. To ensure stability, the minimum recommended memory size is 4G.
NoticeStarting from OceanBase Database V4.0.0.0, memory overcommit is no longer supported. |
| MAX_CPU | Specifies the maximum CPU cores. The minimum value is 1, indicating 1 core. The value must be greater than or equal to the current MIN_CPU value. |
| MIN_CPU | Specifies the minimum CPU cores. Optional. The minimum value is 1, indicating 1 core. The value must be less than or equal to the current MAX_CPU value. |
| MAX_IOPS | Specifies the maximum IOPS. Optional. The minimum value is 1024, which must be greater than or equal to the MIN_IOPS value. |
| MIN_IOPS | Specifies the minimum IOPS. Optional. The minimum value is 1024, which must be less than or equal to the MAX_IOPS value. |
| MAX_NET_BANDWIDTH | Specifies the maximum network bandwidth available per resource unit for the tenant. The minimum value is 1 M. |
| NET_BANDWIDTH_WEIGHT | Specifies the network bandwidth weight of the tenant's resource unit. This weight is used to calculate the bandwidth allocated to each tenant on each OBServer node. The minimum value is 0. |
| LOG_DISK_SIZE | Specifies the size of the log disk. Optional. The default value is three times the memory size, with a minimum of 2G. |
Examples
View the resource specifications of the resource unit
unit1.obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_UNIT_CONFIGS WHERE NAME='unit1';The query result is as follows:
+----------------+-------+----------------------------+----------------------------+---------+---------+-------------+---------------+----------------+----------+----------+-------------+-------------------+----------------------+ | UNIT_CONFIG_ID | NAME | CREATE_TIME | MODIFY_TIME | MAX_CPU | MIN_CPU | MEMORY_SIZE | LOG_DISK_SIZE | DATA_DISK_SIZE | MAX_IOPS | MIN_IOPS | IOPS_WEIGHT | MAX_NET_BANDWIDTH | NET_BANDWIDTH_WEIGHT | +----------------+-------+----------------------------+----------------------------+---------+---------+-------------+---------------+----------------+----------+----------+-------------+-------------------+----------------------+ | 1001 | unit1 | 2025-05-28 11:19:39.116490 | 2025-05-28 11:19:39.116490 | 4 | 4 | 5368709120 | 10737418240 | NULL | 1280 | 1024 | 1 | 5242880 | 10 | +----------------+-------+----------------------------+----------------------------+---------+---------+-------------+---------------+----------------+----------+----------+-------------+-------------------+----------------------+ 1 row in setModify the resource specifications of the resource unit
unit1to 2 CPU cores, 5 GB of memory, a maximum network bandwidth of 4 M per resource unit, and a network bandwidth weight of 8.obclient [oceanbase]> ALTER RESOURCE UNIT unit1 MAX_CPU 2, MIN_CPU 2, MEMORY_SIZE '5G', MAX_NET_BANDWIDTH '4M', NET_BANDWIDTH_WEIGHT 8;After the modification is successful, view the resource specifications of the resource unit
unit1again.obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_UNIT_CONFIGS WHERE NAME='unit1';The query result is as follows:
+----------------+-------+----------------------------+----------------------------+---------+---------+-------------+---------------+----------------+----------+----------+-------------+-------------------+----------------------+ | UNIT_CONFIG_ID | NAME | CREATE_TIME | MODIFY_TIME | MAX_CPU | MIN_CPU | MEMORY_SIZE | LOG_DISK_SIZE | DATA_DISK_SIZE | MAX_IOPS | MIN_IOPS | IOPS_WEIGHT | MAX_NET_BANDWIDTH | NET_BANDWIDTH_WEIGHT | +----------------+-------+----------------------------+----------------------------+---------+---------+-------------+---------------+----------------+----------+----------+-------------+-------------------+----------------------+ | 1001 | unit1 | 2025-05-28 11:19:39.116490 | 2025-05-28 11:31:15.005869 | 2 | 2 | 5368709120 | 10737418240 | NULL | 1280 | 1024 | 1 | 4194304 | 8 | +----------------+-------+----------------------------+----------------------------+---------+---------+-------------+---------------+----------------+----------+----------+-------------+-------------------+----------------------+ 1 row in set