January 2018
Intermediate to advanced
446 pages
12h 57m
English
You can use the DROP TABLESPACE command to drop the tablespace. However, all the tables inside that tablespace should be either dropped or moved:
mysql> DROP TABLESPACE ts2;ERROR 3120 (HY000): Tablespace `ts2` is not empty.
You have to move the partitions p2 and p3 of table table_gen_part_ts1 in the ts2 tablespace to other tablespace before dropping:
mysql> ALTER TABLE table_gen_part_ts1 REORGANIZE PARTITION p2 INTO (PARTITION p2 VALUES LESS THAN (3000000) TABLESPACE ts1);mysql> ALTER TABLE table_gen_part_ts1 REORGANIZE PARTITION p3 INTO (PARTITION p3 VALUES LESS THAN (3000000) TABLESPACE ts1);
Now you can drop the tablespace:
mysql> DROP TABLESPACE ts2;Query OK, 0 rows affected (0.01 sec)
Read now
Unlock full access