测试表
create table DATA_CHANGE_HIS
(
OID NUMBER(38),
TABLE_NAME VARCHAR2(1000),
BEFORE_AFTER VARCHAR2(32),
DEAL_DATE TIMESTAMP(6),
OP_FLAG VARCHAR2(32),
NAME VARCHAR2(50),
COL1 NVARCHAR2(1000),
COL2 NVARCHAR2(1000),
COL3 NVARCHAR2(1000),
COL4 NVARCHAR2(1000),
COL5 NVARCHAR2(1000),
COL6 NVARCHAR2(1000),
COL7 NVARCHAR2(1000)
)
create unique index FBK_UNIQUE on DATA_CHANGE_HIS (COL7)
GGSCI>目标端复制进程参数
MAP sgs_chj.*, target sgs_fbk.DATA_CHANGE_HIS,
COLMAP ( OID = OID ,
TABLE_NAME=@getenv("GGHEADER", "TABLENAME"),
BEFORE_AFTER=@getenv("GGHEADER", "BEFOREAFTERINDICATOR"),
DEAL_DATE=@getenv ("GGHEADER", "COMMITTIMESTAMP"),
OP_FLAG=@getenv ("GGHEADER", "OPTYPE"),
COL7 = COL7
);
1、COLMAP (包含所有列)但并未建索引
warning No unique key is defined for table DATA_CHANGE_HIS. All viable columns will be used to represent the key, but may not guarantee uniqueness. KEYCOLS may be used to define the key.
说明映射表中缺少索引,将会用所有字段作为索引。可在该表中选一字段建索引
若COLMAP (未包含所有表字段 (col1等))
报 Key column COL1 is missing from map.
2、Error in COLMAP clause
报列匹配条件错误
一般情况下:colmap中的所有列名为目标表的列名如下:
-->ggsci>
MAP sgs_chj.*, target sgs_fbk.DATA_CHANGE_HIS,
COLMAP ( OID = OID ,
TABLE_NAME=@getenv("GGHEADER", "TABLENAME"),
BEFORE_AFTER=@getenv("GGHEADER", "BEFOREAFTERINDICATOR"),
DEAL_DATE=@getenv ("GGHEADER", "COMMITTIMESTAMP"),
OP_FLAG=@getenv ("GGHEADER", "OPTYPE"),
COL7 = COL7
);
3、Key column COL7 is missing from map.
当col7设为索引时,如果在COLMAP 列中未写 会报错的
4、Bad column length (549) specified for column TABLE_NAME in table SGS_CHJ.SDE_LINE, maximum allowable length is 400.
报源端映射过来的值比目标字段的长度大,而插入失败,修改目标字段长度
5、 Bad column index (11) specified for table SDE.NJP, max columns = 5.
经测试在OGG同步过程中,源端表字段要求小于等于目标端表字段