Purpose
You can use this statement to create a resource pool. A resource pool is a collection of resource units that can be allocated to a tenant.
After you create a resource pool, you can allocate it to a tenant. A resource pool can be bound with only one tenant. The total amount of resources allocated to a tenant in its zones are calculated as follows: Unit config × Unit quantity.
Limitations and considerations
When you create a resource pool, if the resources reserved on the corresponding nodes are insufficient, the creation fails. You can query the GV$OB_SERVERS view for the resource information of each node.
Required privileges
You can create a resource pool only as the root user of the sys tenant (namely root@sys) .
Syntax
CREATE RESOURCE POOL pool_name
UNIT [=] unit_name,
UNIT_NUM [=] unit_num,
ZONE_LIST [=] ('zone_name' [, 'zone_name' ...]);
Parameters
| Parameter | Description |
|---|---|
| pool_name | The name of the resource pool to be created. |
| UNIT [=] unit_name | The name of the unit config for the resource pool to be created. |
| UNIT_NUM [=] unitnum | The number of units in the resource pool that are located in a single zone. The value must be smaller than the number of nodes in the target zone. A tenant can have at most one unit on each node. |
| ZONE_LIST [=] ('zone' [, 'zone' ...]) | The distribution of zones in the resource pool to be created. |
Examples
Create a resource pool named pool1.
The unit config is unit1, the number of units is 1, and the resources are distributed in zone1.
obclient [oceanbase]> CREATE RESOURCE POOL pool1 UNIT='unit1', UNIT_NUM=1, ZONE_LIST=('zone1');
Query the information about the created resource pool.
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_RESOURCE_POOLS WHERE NAME='pool1';
The query result is as follows:
+------------------+------------+-----------+----------------------------+----------------------------+------------+----------------+-----------+--------------+
| RESOURCE_POOL_ID | NAME | TENANT_ID | CREATE_TIME | MODIFY_TIME | UNIT_COUNT | UNIT_CONFIG_ID | ZONE_LIST | REPLICA_TYPE |
+------------------+------------+-----------+----------------------------+----------------------------+------------+----------------+-----------+--------------+
| 1007 | pool1 | 1018 | 2023-11-09 10:26:35.427350 | 2023-11-09 10:26:40.654066 | 1 | 1006 | zone1 | FULL |
+------------------+------------+-----------+----------------------------+----------------------------+------------+----------------+-----------+--------------+
1 row in set