Automatic Object Name Mapping
The target table name is taken from the TARGET clause of the MAP statement, and the target column names are taken from the source column names in the trail metadata.
Automatic Schema Evolution functionality currently supports object name mapping only when the target database CHARSET is either same as the source database CHARSET, or if its the superset of the source database CHARSET. In other cases, an appropriate error message is reported.
In cases where the table or column name length from source is too long (and this length is not supported on the target database), or the case where the table or column name contains unsupported characters (that are not supported on the target database), Replicat abends with an appropriate error message.
To continue, one of the following corrective actions must be taken:
-
For problematic target table name(s), you must explicitly specify the appropriate target table name in the
MAPspecification that meets the target database requirements. -
For problematic column name(s), you need to explicitly specify the appropriate target column name(s) in the
COLMAPclause of theMAPstatement that meets the target database requirements. This can be supported with some restrictions on the source, such as not adding any new columns with the same names as specified in theCOLMAPclause for the target column.
The case sensitivity of the table or column names generated for Automatic Schema Evolution depends on the case sensitivity rules of the source and target databases and are governed by the following rules.
-
In a case-sensitive source database to case-sensitive target database replication scenario, all the names are quoted and used.
-
For any other combinations of source to target, including case-sensitive to case-insensitive, case- insensitive to case insensitive, and case-insensitive to case-sensitive, the following rules are followed:
-
Table names are used exactly as specified in the
TARGETclause of theMAPstatement in the Replicat parameter file. -
Column names are used from the trail file, without any quotes, unless quoted explicitly in the
COLMAPclause of theMAPstatement in the Replicat parameter file.
-
If the column names contain any of the following special characters or spaces, the names will be quoted and used.
'".,{}()[]|+-_%~^#@/!><*&$:=?;\
Following are the object naming convention used by Automatic Schema Evolution for the following use cases:
-
Use Case: Case Sensitive Source Database
Options Behavior If you are replicating to a case-sensitive target database, consider the use case with:
The source table name as
hr.employeeColumn idtypeint(primary key)Name type
varchar
If the target table name in the
TARGETclause of theMAPstatement contains a wildcard, then the same name and case as the source name is used for the target table with quotes added to it.Example:
The
MAPstatement in the Replicat parameter file is the followingMAP hr.*, TARGET region.*;Automatic Schema Evolution functionality generates the DDL on case-sensitive target database as:
CREATE TABLE "region"."employee" ( "id" int not null, "name" VARCHAR(20), primary key ("id"));Note:
The object nameemployeeis quoted in theCREATE TABLE DDLbecause the source and target database are case sensitive.If you are replicating to a case-sensitive target database, consider the use case with:
The source table name as
hr.employeeColumn idtypeint(primary key)Name type
varchar
If the target table name in the
TARGETclause of theMAPstatement contains an explicit name, then the same name and case as the source name is used for the target table with quotes added to it.Example:
The
MAPstatement in the Replicat parameter file is as follows:MAP hr.employee, TARGET region.employee, COLMAP(USEDEFAULTS, "EMPNAME" = name);Automatic Schema Evolution functionality generates the DDL on case-sensitive target database as follows:
CREATE TABLE "region"."employee" ( "id" int not null, "EMPNAME" VARCHAR(20), primary key ("id"));Note:
The object nameemployeeis unquoted in theCREATE TABLE DDLas the object name in theTARGETclause ofMAPstatement is unquoted.If you are replicating to a case-insensitive target database, then consider use case with:
The source table name as
hr.employeeColumn idtypeint(primary key)Name type
varchar
If the target table name in the
Example:TARGETclause of theMAPstatement contains a wildcard, then the same name and case as the source name is used for the target table.The map statement in the Replicat parameter file is the following:
MAP hr.*, TARGET region.*;Automatic Schema Evolution functionality generates the DDL on case insensitive target database as follows:
CREATE TABLE region.employee (id int not null, name VARCHAR(20), primary key (id));Note:
The object nameemployeeis unquoted in theCREATE TABLE DDLbecause the target clause has an unquoted wildcard name.If you are replicating to a case-insensitive target database, then consider use case with:
The source table name as
hr.employeeColumn idtypeint(primary key)Name type
varchar
If the target table name in the
Example:TARGETclause of theMAPstatement contains an explicit name, then the same name and case as the source name is used for the target table.The
MAPstatement in the Replicat parameter file is the following:MAP hr.employee, TARGET region."employee", COLMAP(USEDEFAULTS, "EMPNAME" = name);Automatic Schema Evolution functionality generates the DDL on case-insensitive target database as follows:
CREATE TABLE region."employee" ( id int not null, "EMPNAME" VARCHAR(20), primary key (id));Note:
The object nameemployeeis quoted in theCREATE TABLE DDLas the object name in theTARGETclause ofMAPstatement is quoted.EMPNAMEis quoted in DDL, because it is specified as quoted inCOLMAPclause -
Use Case: Case-Insensitive Source Database
Options Behavior If you are replicating to a case-sensitive target database, then consider use case with:
The source table name as
hr.employeeColumn idtypeint(primary key)Name type
varchar
If the target table name in the
Example:TARGETclause of theMAPstatement contains a wildcard, then the same name and case as the source name is used for the target table.The
MAPstatement in Replicat parameter file is the following:MAP hr.*, TARGET region.*;Automatic Schema Evolution functionality generates the DDL on case-sensitive target database as follows:
CREATE TABLE region.employee ( id int not null, name VARCHAR(20), primary key (id));Note:
The object nameemployeeis unquoted in theCREATE TABLE DDLbecause the target clause has an unquoted wildcard name.If you are replicating to a case-sensitive target database, then consider use case with:
The source table name as
hr.employeeColumn idtypeint(primary key)Name type
varchar
If the target table name in the
Example:TARGETclause of theMAPstatement contains an explicit name, then the same name and case as the source name is used for the target table.The
MAPstatement in the Replicat parameter file is the following:MAP hr.employee, TARGET region.employee, COLMAP(USEDEFAULTS, "EMPNAME" = name);Automatic Schema Evolution functionality generates the DDL on case-sensitive target database as follows:
CREATE TABLE region.employee ( id int not null, "EMPNAME" VARCHAR(20), primary key (id));Note:
The object nameemployeeis unquoted in theCREATE TABLE DDLas the object name in theTARGETclause ofMAPstatement is unquoted.If you are replicating to a case-insensitive target database, then consider use case with:
The source table name as
hr.employeeColumn idtypeint(primary key)Name type
varchar
If the target table name in the
Example:TARGETclause of theMAPstatement contains a wildcard, then the same name and case as the source name is used for the target table.The
MAPstatement in the Replicat parameter file is the following:MAP hr.*, TARGET region.*;Automatic Schema Evolution functionality generates the DDL on case-insensitive target database as follows:
CREATE TABLE region.employee ( id int not null, name VARCHAR(20), primary key (id));Note:
The object nameemployeeis unquoted in theCREATE TABLE DDLbecause the target clause has an unquoted wildcard name.If you are replicating to a case-insensitive target database, then consider use case with:
The source table name as
hr.employeeColumn idtypeint(primary key)Name type
varchar
If the target table name in the
Example:TARGETclause of theMAPstatement contains an explicit name, then the same name and case as the source name is used for the target table.The
MAPstatement in the Replicat parameter file is the following:MAP hr.employee, TARGET region.employee, COLMAP(USEDEFAULTS, EMPNAME = name);Automatic Schema Evolution functionality generates the DDL on case-insensitive target database as follows:
CREATE TABLE region.employee ( id int not null, EMPNAME VARCHAR(20), primary key (id));Note:
The object nameemployeeis unquoted in theCREATE TABLE DDLas the object name in theTARGETclause ofMAPstatement is unquoted.