This topic describes the supported conversion scope of ALTER TABLE DDL operations for partition operations during data migration from a MySQL database to the MySQL compatible mode of OceanBase Database.
Syntax
ALTER TABLE tbl_name partition_options
partition_options:
partition_option [partition_option] ...
partition_option: {
ADD PARTITION (partition_definition)
| DROP PARTITION partition_names
| DISCARD PARTITION {partition_names | ALL} TABLESPACE
| IMPORT PARTITION {partition_names | ALL} TABLESPACE
| TRUNCATE PARTITION {partition_names | ALL}
| COALESCE PARTITION number
| REORGANIZE PARTITION partition_names INTO (partition_definitions)
| EXCHANGE PARTITION partition_name WITH TABLE tbl_name [{WITH | WITHOUT} VALIDATION]
| ANALYZE PARTITION {partition_names | ALL}
| CHECK PARTITION {partition_names | ALL}
| OPTIMIZE PARTITION {partition_names | ALL}
| REBUILD PARTITION {partition_names | ALL}
| REPAIR PARTITION {partition_names | ALL}
| REMOVE PARTITIONING
}
Supported partition operations
Use the
ADD PARTITIONclause to add RANGE partitions.Use the
ADD PARTITIONclause to add LIST partitions.Use the
DROP PARTITIONclause to drop partitions.Use the partition name to specify which partition to drop. Example:
ALTER TABLE T TRUNCATE PARTITION P0; ALTER TABLE T TRUNCATE PARTITIONS P0,P1;Use the
ALTER TABLE...PARTITION BY...clause to redefine partitions. Example:ALTER TABLE orders PARTITION BY HASH(order_id) PARTITIONS 3;Notice
Only OceanBase Database V4.0.0 and later versions support this clause.
Unsupported partition operations
Warning
If a DDL statement to be synchronized contains the following unsupported definitions, the conversion will fail and the output will be an empty string.
Use the
ADD PARTITIONclause to add HASH partitions.Use the
TRUNCATE PARTITIONclause.Use the
DISCARD PARTITIONclause.Use the
IMPORT PARTITIONclause.Use the
COALESCE PARTITIONclause.Use the
REORGANIZE PARTITIONclause.Use the
EXCHANGE PARTITIONclause.Use the
ANALYZE PARTITIONclause.Use the
CHECK PARTITIONclause.Use the
OPTIMIZE PARTITIONclause.Use the
REBUILD PARTITIONclause.Use the
REPAIR PARTITIONclause.Use the
REMOVE PARTITIONINGclause.