Purpose
The ALTER RESOURCE UNIT statement is used to modify the resource specifications of a resource unit. Modifying resource specifications mainly involves increasing or decreasing CPU, memory, and log disk capacity.
Limitations and considerations
Before modifying the resource specifications, if the resource unit is 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 check the total and allocated resources on each node. For more information, see View tenant and resource information.If you want to decrease the resource specifications, ensure that the total resources after modification (CPU, memory, and log disk capacity) are greater than or equal to the current resources 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 resource specifications.
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,]
[DATA_DISK_SIZE [=] 'size_value',]
[LOG_DISK_SIZE [=] 'size_value'];
Parameters
| Parameter | Description |
|---|---|
| unit_name | Specifies the name of the resource unit whose resource specifications you want to modify. |
| 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. 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. The minimum value is 1024, and the value must be greater than or equal to the MIN_IOPS value. |
| MIN_IOPS | Specifies the minimum IOPS. The minimum value is 1024, and the value must be less than or equal to the MAX_IOPS value. |
| MAX_NET_BANDWIDTH | Specifies the maximum network bandwidth per resource unit. The minimum value is 1 M. |
| NET_BANDWIDTH_WEIGHT | Specifies the network bandwidth weight of the resource unit, used to calculate the bandwidth allocation ratio for each tenant on each OBServer node. The minimum value is 0. |
| DATA_DISK_SIZE | Specifies the local disk space available per resource unit. This parameter is applicable only in Shared-Storage (SS) mode. In Shared-Nothing (SN) mode, modifying this parameter will result in an error. In SS mode, when modifying this parameter:
NoteIn SS mode, when creating a tenant, migrating a resource unit, or expanding the system, the system considers the |
| LOG_DISK_SIZE | Specifies the size of the log disk. The default value is three times the memory size, with a minimum value of 2G. |
Examples
View the resource specifications of the resource unit
unit1.obclient(root@sys)[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(root@sys)[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(root@sys)[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
