测试目的,源端和目标端,表结构一样,但是schema不一样。目标端比源端多一个update_time字段,主要记录ogg同步时间。 (目前测试是从低版本的ogg,同步到高版本的ogg,没有问题。之前测试高版本的ogg,同步到低版本的ogg,有问题)
源端: 192.168.2.78 ?,Windows ?,RDBMS 11.2.0.4 ,OGG 11.2.1.0.33?
SQL> desc bb.tab2
Name Null? Type
----------------------------------------- -------- ----------------------------
ID NOT NULL NUMBER
NAME VARCHAR2(10)
SQL>
目标端: 192.168.2.100 , Linux , RDBMS 19.14 ,OGG ?19.1.0.0.4
ZBB@test>desc zbb.tab2
Name Null? Type
----------------------------------------------------------------- -------- --------------------------------------------
ID NOT NULL NUMBER
NAME VARCHAR2(10)
UPDATE_DATE TIMESTAMP(6)
ZBB@test>
-- 源端创建mgr进程
PORT 7809
PURGEOLDEXTRACTS C:\app\ogg11g\dirdat,USECHECKPOINTS
-- 源端配置extract抽取进程
extract ext_tab2
SETENV(NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8")
SETENV(ORACLE_HOME="C:\app\Administrator\product\11.2.0\dbhome_1")
SETENV(ORACLE_SID="test")
userid ogg, password oracle
exttrail c:\app\ogg11g\dirdat\b2
--GETTRUNCATES
REPORTCOUNT EVERY 1 MINUTES, RATE
DISCARDFILE .\dirrpt\extnd1_tab2.dsc,APPEND,MEGABYTES 1024
--THREADOPTIONS MAXCOMMITPROPAGATIONDELAY 60000 IOLATENS60000
DBOPTIONS ALLOWUNUSEDCOLUMN
WARNLONGTRANS 2h,CHECKINTERVAL 3m
TRANLOGOPTIONS EXCLUDEUSER ogg
FETCHOPTIONS NOUSESNAPSHOT
FETCHOPTIONS FETCHPKUPDATECOLS
--TRANLOGOPTIONS CONVERTUCS2CLOBS
--ddl include all
--DDL INCLUDE MAPPED
table bb.tab2, TOKENS (UPDATE_DATE = @GETENV ("GGHEADER", "COMMITTIMESTAMP"));
-- 源端配置extract投递进程
extract pm2
SETENV(NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8")
SETENV(ORACLE_SID="test")
userid ogg,password oracle
--passthru
rmthost 192.168.2.100,mgrport 7809
rmttrail ./dirdat/mm
table bb.tab2 , TOKENS ( TKN-COMMITTIME = @GETENV ("GGHEADER", "COMMITTIMESTAMP"));
-- 源端定义defgen?
defsfile C:\app\ogg11g\dirdef\defgen_tab2.def
userid ogg,password oracle
table bb.tab2;
-- 源端生成defgen文件,将生成的文件,copy到目标端的diedef目录下?
defgen.exe paramfile C:\app\ogg11g\dirprm\defgen.prm
--目标端配置mgr
PORT 7809
PURGEOLDEXTRACTS /u01/ogg19c/dirdat/*,usecheckpoints, minkeepdays 3
LAGREPORTHOURS 1
LAGINFOMINUTES 30
LAGCRITICALMINUTES 45
--目标端配置replicate进程
replicat reptab2
Sourcedefs /u01/ogg19c/dirdef/defgen_tab2.def
SETENV(NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8")
SETENV(ORACLE_SID="test")
userid ogg, password oracle
--assumetargetdefs
discardfile /u01/ogg19c/dirdat/rep_tabm_discard,append
--handlecollisions
--discardfile /u01/ogg/dirrpt/reptabm_repaix.dsc,purge
REPORTROLLOVER AT 05:30 ON Friday
map bb.tab2,target zbb.tab2,COLMAP (USEDEFAULTS, UPDATE_DATE= @TOKEN ('TKN-COMMITTIME'));
--ddl include all
DDLERROR 10655 IGNORE
DDLERROR 10636 IGNORE
DDLERROR DEFAULT IGNORE RETRYOP
-- 测试数据,源端插入数据,数据同步到了目标端,并且目标端update字段会更新?
17:10:39 SQL> insert into bb.tab2 values(2,'bb');
1 row created.
17:10:55 SQL> commit;
Commit complete.
17:11:04 SQL> select * from bb.tab2;
ID NAME
---------- ----------
2 bb
1 aa
17:11:17 SQL>
-- 目标端 ,数据已经同步,update_date已经更新?
SYS@test>select * from zbb.tab2;
ID NAME UPDATE_DATE
---------- ---------- ---------------------------------------------------------------------------
1 aa 04-MAR-22 03.57.59.000000 PM
2 bb 04-MAR-22 05.10.56.000000 PM
SYS@test>
END
|