Replicat Abending with Mapping Error and Discard File Shows Missing Key Columns
Source table :
create table user1 (empid number not null PRIMARY KEY, empname varchar2(10), dept varchar2(10));
Target table :
create table user1 (empid number not null, empname varchar2(10), dept varchar2(10));
In this case extract will consider empid as key column. There are no primary or unique key defined on target table, so replicat will consider all the columns as key columns.
If an update operation occurs on source, Extract will log only the changed column and the primary key column provided trandata was enabled on source table.
Replicat when processing the update operation will abend with error in mapping and discard file will show like the following
key column empname (1) is missing
key column dept (2) is missing
This is because if there are no primary key or unique key or PK constraint may be disabled or not validated replicat will consider all the columns as key columns).
The best thing is to add same set of primary key or unique key on both source and target tables.
However, as a workaround we can force the extract/replicat to use same columns as key columns using KEYCOLS parameter in the TABLE or MAP statement.
MAP <schema>.<table_name>, target <schema>.<table_name>, keycols (empid);
Source table :
create table user1 (empid number not null PRIMARY KEY, empname varchar2(10), dept varchar2(10));
Target table :
create table user1 (empid number not null, empname varchar2(10), dept varchar2(10));
In this case extract will consider empid as key column. There are no primary or unique key defined on target table, so replicat will consider all the columns as key columns.
If an update operation occurs on source, Extract will log only the changed column and the primary key column provided trandata was enabled on source table.
Replicat when processing the update operation will abend with error in mapping and discard file will show like the following
key column empname (1) is missing
key column dept (2) is missing
This is because if there are no primary key or unique key or PK constraint may be disabled or not validated replicat will consider all the columns as key columns).
The best thing is to add same set of primary key or unique key on both source and target tables.
However, as a workaround we can force the extract/replicat to use same columns as key columns using KEYCOLS parameter in the TABLE or MAP statement.
MAP <schema>.<table_name>, target <schema>.<table_name>, keycols (empid);