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 the CPU, memory, and log disk capacity.
Limitations and considerations
Before modifying the resource specifications, if the resource unit is being used by a tenant, please note the following:
If you want to increase the resource specifications, make sure that each node where the resource unit is located has enough remaining resources available for allocation.
You can query the
GV$OB_SERVERSview to confirm the total resources and allocated resources on each node. For more information, see View tenant and resource information.If you want to decrease the resource specifications, make sure that the total resources after modification (CPU, memory, and log disk capacity) are greater than or equal to the resources already 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,]
[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 are to be modified. |
| MEMORY_SIZE | Modifies the memory specifications. The minimum value is controlled by the hidden parameter __min_full_resource_pool_memory, which defaults to 5G. To ensure stability, the minimum memory specification is recommended to be 4G.
NoticeStarting from OceanBase Database V4.0.0.0, memory overcommit is no longer supported. |
| MAX_CPU | Specifies the upper limit for CPU specifications. The minimum value is 1, representing 1 Core. The value must be greater than or equal to the current MIN_CPU value. |
| MIN_CPU | Specifies the lower limit for CPU specifications. Optional. The minimum value is 1, representing 1 Core. The value must be less than or equal to the current MAX_CPU value. |
| MAX_IOPS | Specifies the upper limit for IOPS. Optional. The minimum value is 1024, which must be greater than or equal to the MIN_IOPS value. |
| MIN_IOPS | Specifies the lower limit for 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 for the tenant's resource unit, used to calculate the bandwidth allocation ratio for each tenant on each OBServer. The minimum value is 0. |
| DATA_DISK_SIZE | Specifies the local disk space available per resource unit for the tenant. This parameter is only applicable 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 tenant, the system considers the |
| LOG_DISK_SIZE | Specifies the size of the log disk. Optional. The default value is three times the memory specification value, with a minimum 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 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