Description
The ALTER RESOURCE UNIT statement is used to modify the resource specifications of a unit. Modifying resource specifications mainly involves increasing or decreasing CPU, memory, log disk capacity, and so on.
Limitations and considerations
Before modifying the unit config of a resource, if the unit is currently being used by a tenant, note the following:
To upgrade the unit, ensure that all nodes hosting the units have sufficient available resources for allocation.
You can query the
GV$OB_SERVERSview to confirm the total resources and allocated resources of each node. For detailed operations, see View tenant and resource information.If you want to downgrade the resource specification, 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 unit's resource specification. Modifying the unit's resource specification is not supported for users in other tenants.
Statements
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 unit for the resource specification to be modified. |
| MEMORY_SIZE | Modifies the memory specification. Its minimum value is determined by the hidden parameter __min_full_resource_pool_memory, whose default value is 5 GB. To ensure stability, we recommend that you set the minimum memory to 4 GB.
NoticeOceanBase AI Database no longer supports memory overprovisioning. |
| MAX_CPU | Modify the upper limit of CPU specifications. The minimum value is 1, which indicates 1 core. The value must be greater than or equal to the current value of MIN_CPU. |
| MIN_CPU | Optional. Specifies the minimum CPU specification. The minimum value is 1, which indicates 1 core. The value must be less than or equal to the current value of MAX_CPU. |
| MAX_IOPS | Optional. The maximum IOPS. The minimum value is 1024, which must be greater than or equal to the value of MIN_IOPS. |
| MIN_IOPS | Optional. Specifies the new lower limit of IOPS. The minimum value is 1024, which must be less than or equal to the value of MAX_IOPS. |
| MAX_NET_BANDWIDTH | Modify the maximum network bandwidth per unit for a tenant. The minimum value is 1 MB. |
| NET_BANDWIDTH_WEIGHT | Modifies the network bandwidth weight of a tenant unit, which is used to calculate the proportion of bandwidth allocated from each OBServer node to the tenant. The minimum value is 0. |
| DATA_DISK_SIZE | Modify the local disk space size available for each unit of a tenant. When modifying this specification, note that:
NoteWhen creating a tenant, migrating a unit, or scaling out, the system considers the |
| LOG_DISK_SIZE | Optional. Specifies the size of the log disk. The default value is three times the memory size, and the minimum value is 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 unit config of resource unit
unit1. Set CPU to 2 cores, memory to 5 GB, maximum network bandwidth per unit to 4 MB, and network bandwidth weight to 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, check the resource specifications of 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