2007年9月29日 星期六

DB2, Replication add replicate timestamp information to target table

Test Case :
replicate table jerrtw.src -> jerryw.tar and add replicate timestamp infomation to table jerryw.tar

table structure:
-- ID is P-Key

jerrtw.src
ID int
NAME char(10)

jerrtw.tar
ID int
NAME char(10)
REPL_TIME timestamp

db2 create table jerryw.scr (id int not null , name char(10) )
db2 alter table jerryw.scr add primary key (id)

db2 create table jerryw.tar (id int not null , name char(10) , time timestamp)
db2 alter table jerryw.tar add primary key (id)


Steps:
1. register table jerrtw.src
2. add jerrtw.src into qualify
3. add new column map to "REPL_TIME " from "Column Mapping" option





4. complete

Test:
db2 insert into jerryw.scr values (1,'aa')
db2 insert into jerryw.scr values (2,'aa')
db2 insert into jerryw.scr values (3,'aa')

db2 update jerryw.scr set name='bb' where id=1

Result:
db2 select * from jerryw.tar

沒有留言: