mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
31 lines
1.1 KiB
Text
31 lines
1.1 KiB
Text
CREATE TABLE t1(i INT) ENGINE INNODB
|
|
PARTITION BY RANGE (i)
|
|
(PARTITION p1 VALUES LESS THAN (100),
|
|
PARTITION p2 VALUES LESS THAN (200),
|
|
PARTITION p3 VALUES LESS THAN (300),
|
|
PARTITION p4 VALUES LESS THAN (400));
|
|
INSERT INTO t1 VALUES (1), (101), (201), (301);
|
|
# xtrabackup backup
|
|
INSERT INTO t1 VALUES (1), (101), (201), (301);
|
|
# xtrabackup prepare
|
|
CREATE TABLE t1_placeholder (i INT) ENGINE INNODB;
|
|
ALTER TABLE t1_placeholder DISCARD TABLESPACE;
|
|
ALTER TABLE t1_placeholder IMPORT TABLESPACE;
|
|
ALTER TABLE t1 EXCHANGE PARTITION p4 WITH TABLE t1_placeholder;
|
|
ALTER TABLE t1_placeholder DISCARD TABLESPACE;
|
|
ALTER TABLE t1_placeholder IMPORT TABLESPACE;
|
|
ALTER TABLE t1 EXCHANGE PARTITION p3 WITH TABLE t1_placeholder;
|
|
ALTER TABLE t1_placeholder DISCARD TABLESPACE;
|
|
ALTER TABLE t1_placeholder IMPORT TABLESPACE;
|
|
ALTER TABLE t1 EXCHANGE PARTITION p2 WITH TABLE t1_placeholder;
|
|
ALTER TABLE t1_placeholder DISCARD TABLESPACE;
|
|
ALTER TABLE t1_placeholder IMPORT TABLESPACE;
|
|
ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t1_placeholder;
|
|
SELECT * FROM t1;
|
|
i
|
|
1
|
|
101
|
|
201
|
|
301
|
|
DROP TABLE t1;
|
|
DROP TABLE t1_placeholder;
|