Before you drop a table group, make sure that it contains no table. Specifically, you can drop the table from the table group or clear the table group attribute of the table.
Syntax
DROP TABLEGROUP [IF EXISTS] tablegroup_name;
Parameters
| Parameter | Description |
|---|---|
| tablegroup_name | The name of the table group. If the table group name does not exist and IF EXISTS is not specified, an error is returned. |
Examples
View the
tpcc_grouptable group.obclient> SHOW TABLEGROUPS; +-----------------+------------+---------------+ | Tablegroup_name | Table_name | Database_name | +-----------------+------------+---------------+ | oceanbase | NULL | NULL | | tpcc_group | ordr | test | +-----------------+------------+---------------+ 2 rows in setTry to drop the
tpcc_grouptable group.obclient> DROP TABLEGROUP tpcc_group; ERROR 4615 (HY000): tablegroup is not emptyNote
If this table group contains a table, an error is returned when you drop the table group.
Remove the
ordrtable from thetpcc_grouptable group.obclient>ALTER TABLE ordr tablegroup=''; Query OK, 0 rows affectedNote
You can use the
DROP TABLEstatement to drop the table from the table group.Drop the
tpcc_grouptable group again.obclient> DROP TABLEGROUP tpcc_group; Query OK, 0 rows affectedCheck whether the
tpcc_grouptable group has been dropped.obclient> SHOW TABLEGROUPS; +-----------------+------------+---------------+ | Tablegroup_name | Table_name | Database_name | +-----------------+------------+---------------+ | oceanbase | NULL | NULL | +-----------------+------------+---------------+ 1 row in set