Purpose
You can use this statement to drop a resource unit.
Notice
Before you drop a resource unit, make sure that the resource unit is not in use. To drop a resource unit that is in use, remove it from the resource pool first.
Syntax
DROP RESOURCE UNIT unit_name;
Parameters
| Parameter | Description |
|---|---|
| unit_name | The name of the resource unit to be dropped. |
Examples
Drop the resource unit
unit1.obclient> DROP RESOURCE UNIT unit1; Query OK, 0 rows affectedIf the resource unit
unit1is allocated to a resource pool, it cannot be directly dropped.obclient> CREATE RESOURCE POOL pool1 UNIT='unit1', UNIT_NUM=1, ZONE_LIST=('zone2'); obclient> DROP RESOURCE UNIT unit1; ERROR 4634 (HY000): resource unit 'UNIT1' is referenced by some resource poolIn this case, you must remove
unit1from the resource poolpool1. To removeunit1from the resource pool and drop it, you must create another resource unitunit2and allocateunit2topool1.obclient> CREATE RESOURCE UNIT unit2 MAX_CPU 4, MEMORY_SIZE '5G', MAX_IOPS 1280,LOG_DISK_SIZE '10G', MIN_CPU=4, MIN_IOPS=1024; obclient> ALTER RESOURCE POOL pool1 UNIT=''; obclient> ALTER RESOURCE POOL pool1 UNIT='unit2'; obclient> DROP RESOURCE UNIT unit1;Notice
The
ALTER RESOURCE POOLstatement can add or remove only one resource unit to or from a resource pool at a time. Therefore, you must removeunit1from the resource pool and then addunit2to it.To clear a resource pool and its resource units, you must drop the resource pool and its resource units.
obclient> DROP RESOURCE UNIT unit1; ERROR 4634 (HY000): resource unit 'UNIT1' is referenced by some resource pool obclient> DROP RESOURCE POOL pool1; obclient> DROP RESOURCE UNIT unit1;