在目标数据库,配置检查点信息到目标数据库表中,
GGSCI>edit params ./GLOBALS
checkpointtable ogg.chkpt
GGSCI>add checkpointtable ogg.chkpt
配置MGR (源端和目标端都一样)
GGSCI> edit param mgr
port 7777
1 配置源端的附加日志
在数据库级别添加最小附加日志,在需要同步的表级别开启详细附加日志
SQL>alter database add supplemental log data;
GGSCI>add trandata bb.t1
2 配置源端和目标端所需的进程
配置源端 extract,名称为ext1
GGSCI (test.us.oracle.com) 52> edit params ext1
EXTRACT ext1
SETENV(NLS_LANG=american_america.ZHS16GBK)
SETENV(ORACLE_SID=test)
USERID ogg, PASSWORD oracle
EXTTRAIL ./dirdat/sa
TABLE bb.t1;
添加local extract(如果提示有了ex1, 则删除就可以了。 edit params ext1查看参数,不受影响)
GGSCI>add extract ext1, tranlog, begin now, threads 1
GGSCI>add exttrail ./dirdat/sa, extract ext1, megabytes 50
配置源端的datapump进程
GGSCI (test.us.oracle.com) 55> edit params lp1
EXTRACT lp1
PASSTHRU
RMTHOST test02, MGRPORT 7777
RMTTRAIL ./dirdat/ta
TABLE bb.t1;
添加lp1 进程(本地datapump进程)
GGSCI>add extract lp1, exttrailsource ./dirdat/sa, begin now
GGSCI>ADD RMTTRAIL ./dirdat/ta, EXTRACT lp1, MEGABYTES 50
3 配置目标端进程
GGSCI (test02) 19> view params ./GLOBALS
checkpointtable ogg.chkpt
GGSCI>add checkpointtable ogg.chkpt --或者不写表名字也可以
配置replicat进程
GGSCI (test02) 21> edit params rp1
REPLICAT rp1
SETENV (ORACLE_SID=orcl)
USERID ogg, PASSWORD oracle
DISCARDFILE ./dirrpt/rp1.dsc, PURGE
HandleCollisions
AssumeTargetDefs
Map bb.*,Target bb.*;
添加rp1进程
GGSCI>add replicat rp1,exttrail ./dirdat/ta
4 查看ogg的抓取进程
GGSIC>stats ext ext1
GGSCI>stats rep rp1
5 查看一些错误,通过ogg目录下的error log文件查看,或者通过命令查看 ,比如view report xxx等等。
-----------------------
下面再新增加一个extract和replicate进程。和上面操作是一样的。贴出来如下:
-- 新增加,配置一个ext ,rep进程,已测试通过
配置源端 extract,名称为ext2
GGSCI (test.us.oracle.com) 52> edit params ext2
EXTRACT ext2
SETENV(NLS_LANG=american_america.ZHS16GBK)
SETENV(ORACLE_SID=test)
USERID ogg, PASSWORD oracle
EXTTRAIL ./dirdat/t2
TABLE bb.t2;
添加local extract(如果提示有了ex1, 则删除就可以了。 edit params ext1查看参数,不受影响)
GGSCI>add extract ext2, tranlog, begin now, threads 1
GGSCI>add exttrail ./dirdat/t2, extract ext2, megabytes 50
配置源端的datapump进程
GGSCI (test.us.oracle.com) 55> edit params pt2
EXTRACT pt2
PASSTHRU
RMTHOST test02, MGRPORT 7777
RMTTRAIL ./dirdat/tb
TABLE bb.t2;
添加lp1 进程(本地datapump进程)
GGSCI>add extract pt2, exttrailsource ./dirdat/t2, begin now -- 说明该dump是从哪里抽取的?从/dirdat/t2中抽取的,也就是从ext2中抽取的
GGSCI>ADD RMTTRAIL ./dirdat/tb, EXTRACT pt2, MEGABYTES 50 -- 到remote 文件是/dirdat/tb
3 配置目标端进程
配置checkpoint (要先编辑这个文件,再登录,然后才能添加进去)
GGSCI (test02) 19> view params ./GLOBALS
checkpointtable ogg.chkpt
GGSCI>add checkpointtable ogg.chkpt --或者不写表名字也可以
配置replicat进程
GGSCI (test02) 21> edit params rp2
REPLICAT rp2
SETENV (ORACLE_SID=orcl)
USERID ogg, PASSWORD oracle
DISCARDFILE ./dirrpt/rp2.dsc, PURGE
HandleCollisions
AssumeTargetDefs
Map bb.t2,Target bb.t2;
添加rp1进程
GGSCI>add replicat rp2,exttrail ./dirdat/tb -- 文件就是源端抛过来的 /dirdat/tb
4 查看ogg的抓取进程
GGSIC>stats ext ext1
GGSCI>stats rep rp1