Supported DDL operations for synchronization
CREATE TABLENotice
CREATE TABLE AS SELECTis not supported.ALTER TABLEDROP TABLETRUNCATE TABLERENAME TABLECREATE INDEXDROP INDEX
Limitations on DDL synchronization
CREATE TABLE
Category Description Syntax restriction - The CREATE LIKE syntax is not supported.
- A syntax that contains column type aliases (non-native data types) is not supported.
- A syntax that contains the SELECT clause or subqueries is not supported.
- An error may be returned if the generated columns contain incompatible functions or complex expressions.
- A syntax that contains the XML data type is not supported.
Column attribute processing - Currently, the values of column attributes, such as column name, column type, null or not null, and default value, are paid attention to.
- Generated columns are not supported. DDL statements do not process the definitions of generated columns.
- Default values with functions should be used with caution. If a function used cannot be executed, the table creation will fail.
Index processing - We recommend that you use explicit index definitions, including explicit definitions of the primary key (PK) and unique key (UK). We recommend that you do not use CHECK. Anonymous indexes automatically generate names, which may cause name conflicts.
- Use functions with caution. If a function used cannot be executed, the table creation will fail.
- We recommend that you do not use foreign keys. At present, OMS does not support the synchronization of tables with foreign keys. Foreign keys will be discarded during DDL conversion.
Partition (Partition) - Only time-based range partitioning is supported. For non-time-based range partitions, the expression will be directly shifted. We recommend that you do not use functions in partitions. Functions may cause incompatibility of syntax, which may lead to failure of the migration task.
- The range of a partition cannot start or end with a data source-related expression such as
MINVALUEorMAXVALUE. - For a DB2 LUW database, a partition must contain the
endingandexclusivekeywords. Otherwise, an error will be returned. - The DB2 LUW database does not support the
everysyntax extension for partitions to prevent calculation errors. - In a DB2 LUW database, the primary key and partition key cannot be intersected. Otherwise, the primary key will be changed to a unique index to adapt to the partition rules and constraints of OceanBase Database.
- In a DB2 LUW database, the
CREATE/ALTER TABLE ADD PARTITIONstatement must carry partition names. Anonymous partitions are not supported.
ALTER TABLE
The
ALTER TABLE ADD PRIMARYstatement in a DB2 LUW database will be converted into theADD UNIQUEstatement in the Oracle compatible mode of OceanBase Database. Since OceanBase Database does not support adding a primary key after a table is created, you must explicitly specify the primary key when you create a table.If you want to use the
ALTER TABLEstatement to modify a LOB column, you must specify the length of the LOB column. However, you cannot use theALTER TABLEstatement to reduce the length of a LOB column.The
UNIQUE INDEXattribute cannot be null in a DB2 LUW database. Therefore, when you create a unique key (UK) column, you must set a non-null constraint for the column. In other words, when you use theALTER TABLE ADD UNIQUEstatement, you must set a non-null constraint for the involved column.
CREATE INDEX
The Local syntax is not supported for general tables in OceanBase Database.
DDL parsing
Refer to the official DB2 documentation for executing DDL statements to ensure maximum compatibility. DB2 LUW has the following limitations on parsing source DDL statements:
DB2 LUW refreshes the cached parsed results of DDL statements by querying the schema. We recommend that you parse only one type of DDL statements at a time and proceed to the next type only after you have confirmed that the current type of DDL statements are correctly parsed.
We recommend that you do not frequently perform the
CREATEandDROPoperations on partitioned tables. Instead, you can first use theCREATE PARTITION TABLEstatement to create partitions and then use theDROP PARTITION TABLEstatement to drop partitions, after you have confirmed that the partitions are synchronized correctly.A DB2 LUW database can only parse an object whose name consists of letters, underscores (_), and digits, starts with a letter or underscore, and does not contain a DB2 LUW keyword.