初始化方式
测试1:无主键
源端:
ADD EXTRACT cdcext1, TRANLOG, BEGIN NOW
ADD RMTTRAIL d:/oracle/ogg/dirdat/zz, EXTRACT cdcext1
EXTRACT cdcext1
SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
USERID goldengate, PASSWORD goldengate
RMTHOST 134.178.1.140, MGRPORT 7809
RMTTRAIL d:/oracle/ogg/dirdat/zz
TABLE gtj.t2;
目标:
add replicat cdcrep1, exttrail d:/oracle/ogg/dirdat/zz nodbcheckpoint
REPLICAT cdcrep1
HANDLECOLLISIONS
ASSUMETARGETDEFS
USERID goldengate, PASSWORD goldengate
MAP gtj.t2, TARGET gtj.t2;
源端:
start extract cdcext1
源端开始跑循环:
begin
for i in 90000..100000
loop
insert into gtj.t2 values(i);
commit;
dbms_lock.sleep(0.5);
end loop;
end;
/
源端启动initial load:
start extract initext
等目标load完成后:
目标:
start replicat cdcrep1
源:ctrl+c停止循环
实际生产:追的差不多,开始停业务
最后查询是否一直
然后:
目标:send replicat cdcrep1, nohandlecollisions
最后再启动目标cdcrep1
测试2:有主键
truncate table gtj.t2;
alter table gtj.t2 add primary key(id);
初始数据就用循环重构:
begin
for i in 1..89999
loop
insert into gtj.t2 values(i);
end loop;
commit;
end;
/
dblogin userid goldengate, password goldengate
delete trandata gtj.t2
add trandata gtj.t2
alter cdcext1, begin now
alter cdcrep1, begin now
然后再按照测试1中的进行测试:
源端:
start extract cdcext1
源端开始跑循环:
begin
for i in 90000..100000
loop
insert into gtj.t2 values(i);
commit;
dbms_lock.sleep(0.5);
end loop;
end;
/
源端启动initial load:
start extract initext
等目标load完成后:
目标:
start replicat cdcrep1
源:ctrl+c停止循环
3、目标端加上PK,再次执行,发现一致
4、最后关闭handlecollisions
stop cdcext1
stop cdcrep1
edit param cdcrep1 --注释handlecollisions
再启动进程。
无需停止业务了。