Total insert collisions (ogg)

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:Total insert collisions (ogg)

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

1、错误现象
Replicating from ECP.TAB_UUM_PACKAGE to RWGL.TAB_UUM_USER:
*** Total statistics since 2011-08-05 10:34:10 ***

Total inserts                               20.00
Total updates                                0.00
Total deletes                                0.00
Total discards                               0.00
Total operations                            20.00
Total insert collisions                     20.00

2、错误原因
RWGL.TAB_UUM_USER表上有insert触发器,导致失败。因为触发器使得插入操作为插入和触发器中的操作绑定为了一个整体,现在因为触发器失败,导致插入失败,而且还会丢失该条插入记录,需要查找出该条记录比较困难。
3、解决方案
采用自治事件结合异常捕获
自治事件使得触发器和插入操作相互分离,异常捕获记录触发器失败的原因,插入到日志表中,通过该表,可以查询查失败的记录,然后人工干预,触发器实例:

create or replace trigger ogg_t
  before insert on t_1
  for each row
declare
   tid NUMBER;
   err VARCHAR2(100);
   PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
  SELECT t.id2 INTO tid FROM t_2 t WHERE NAME=:new.Name;
  INSERT INTO t_3 VALUES(tid,:new.name);
  COMMIT;
EXCEPTION
       WHEN TOO_MANY_ROWS THEN
         INSERT INTO t_error VALUES(:new.id,'TOO_MANY_ROWS');
         COMMIT;
        WHEN NO_DATA_FOUND THEN
           INSERT INTO t_error VALUES(:new.id,'NO_DATA_FOUND');
           COMMIT;
         WHEN OTHERS THEN
           err:=SUBSTR(SQLERRM(SQLCODE),1,100);
           INSERT INTO t_error VALUES(:new.id,err);
           COMMIT;
end ogg_t;

1)PRAGMA AUTONOMOUS_TRANSACTION;
自治事务,就是说触发器不管是成功,还是失败,数据库同步程序都能够同步成功数据到目标端
2)COMMIT;
因为采用了自治事件,所以begin end中的操作是独立与数据库中数据,需要单独提交
3)EXCEPTION
添加异常处理
4)INSERT INTO t_error VALUES(:new.id,’TOO_MANY_ROWS’);(类此语句,注意commit)
建立一张错误日志表(根据具体情况决定),如果触发器失败,把错误记录到该表中,以后出现问题查找很方便(要求:通过该表能够查询到那条语句的触发器执行失败。失败原因,失败时间,额外列(用于确定对应记录))

Goldengate常见错误

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:Goldengate常见错误

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

ERROR OGG-01031 There is a problem in network communication, a remote file problem, encryption keys for target and source do not match (if using ENCRYPT) or an unknown error. (Reply received is Unable to open file “/opt/OGG/dirdat/AIR/EXTTRAIL/U9000005” (error 11, Resource temporarily unavailable)).
重新启动一次
WARNING OGG-00769 mysql_refresh() failed, falling back to default key. SQL error (1227). Access denied; you need the RELOAD privilege for this operation.
mysql用户权限问题
ERROR OGG-01033 There is a problem in network communication, a remote file problem, encryption keys for target and source do not match (if using ENCRYPT) or an unknown error. (Remote file used is /opt/OGG/dirdat/rl000003, reply received is Unable to lock file “/opt/OGG/dirdat/rl000003” (error 13, Permission denied). Lock currently held by process id (PID) 14409)
原因:网络或者目标段路径不正常,访问到目标端目录失败导致
在目标端kill -9 14409
或者等待2小时,自动系统自动重启目标端进程
ERROR OGG-01033 Oracle GoldenGate Capture for Oracle, p-xz.prm: There is a problem in network communication, a remote file problem, encryption keys for target and source do not match (if using ENCRYPT) or an unknown error. (Remote file used is /opt/OGG/dirdat/XunZhi/EXTFILE/U1000000, reply received is Could not create /opt/OGG/dirdat/XunZhi/EXTFILE/U1000000).
检查远程的目录是否和datapump中的远程目录是否一致

Goldengate 配置oracle to mysql

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:Goldengate 配置oracle to mysql

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

以前oracle to mysql试验总是有乱码问题不能解决,后来和同事交流中,他说oracle使用ogg的11g版本,mysql使用ogg的10g版本可以解决乱码问题,开始我还是怀疑,因为想新的版本都不行,难道老版本就可以解决这个问题吗?抱着试试看的态度,做了个试验,尽然成功了,把试验的相关情况记录下来
mysql参数配置(cat /etc/my.cnf):
[client]
default-character-set = gbk
[mysqld]
lower_case_table_names=1–表名不区分大小写(省的在repl进程中因为大小写的问题导致不能捕获数据)
character-set-server = gbk
表/列编码:均为gbk
Note:
1、因为mysql是target端,所以对于log-bin/binlog_format参数无要求
2、通过以上设置确保mysql的所有相关编码均为gbk
系统编码配置(cat /etc/sysconfig/i18n):
source:
LANG=”zh_CN.GBK”
SUPPORTED=”zh_CN.GBK:zh_CN:zh”
SYSFONT=”latarcyrheb-sun16″
target:
LANG=”zh_CN.GBK”
SYSFONT=”latarcyrheb-sun16″
Note:是的系统编码和mysql编码相同
OGG配置过程:
source端:

add extract ext-all,tranlog,begin now
ADD EXTTRAIL /opt/OGG/dirdat/extract/AL, EXTRACT ext-all
edit params ext-all
extract ext-all
SETENV (NLS_LANG =AMERICAN_AMERICA.ZHS16GBK)
userid is1ogg,password passw0rd
exttrail /opt/OGG/dirdat/extract/AL
discardfile /opt/OGG/discard/ext-all.txt, append, megabytes 100
DDL INCLUDE MAPPED OPTYPE alter OBJNAME ECP.TAB*
TABLE ecp.*;
add EXTRACT p-air, EXTTRAILSOURCE /opt/OGG/dirdat/extract/AL, BEGIN now
add rmttrail /opt/OGG/dirdat/rl extract p-air
edit params p-air
extract p-air
SETENV (NLS_LANG =AMERICAN_AMERICA.ZHS16GBK)
userid is1ogg,password passw0rd
RMTHOST 192.168.1.4,MGRPORT 7809,TCPBUFSIZE 100000,TCPFLUSHBYTES 300000
rmttrail /opt/OGG/dirdat/rl
discardfile /opt/OGG/discard/p-air.txt, append, megabytes 100
TABLE ecp.*;

target端:

add replicat repl, exttrail /opt/OGG/dirdat/rl,nodbcheckpoint
edit params repl
replicat repl
DBOPTIONS HOST 127.0.0.1, CONNECTIONPORT 3306
TARGETDB ecp,userid root,password xifenfei
assumetargetdefs
reperror default,discard
discardfile /tmp/mysql.dsc,append,megabytes 100
MAP ECP.TAB_UUM_DEPT, TARGET ecp.tab_uum_dept;
MAP ECP.TAB_UUM_DEPT_LEADER, TARGET ecp.tab_uum_dept_leader;

异构数据库初始化大字段处理

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:异构数据库初始化大字段处理

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

一、source端

SOURCEISTABLE
SOURCEDB oracle
RMTHOST 127.0.0.1, MGRPORT 7820
RMTFILE D:\ogg\oracle\dirdat\i1
table dbo.t_v;
table dbo.t_t;

二、target端

SPECIALRUN
END RUNTIME
SETENV (NLS_LANG =AMERICAN_AMERICA.ZHS16GBK)
userid ogg,password xifenfei
EXTFILE D:\ogg\oracle\dirdat\i1
SOURCEDEFS D:\ogg\oracle\dirdef\t_v.def
discardfile D:\ogg\oracle\dirtmp\repsz.dsc,append,megabytes 100
MAP "dbo.t_v", target mssql.t_v;
MAP "dbo.t_t", target mssql.t_t
, colmap ( id = id , text_t = @binary(t_text));

三、执行
extract paramfile dirprm\einit1.prm reportfile dirrpt\einit1.rpt
replicat paramfile dirprm\rinit1.prm reportfile dirrpt\rinit1.rpt
四、试验说明
如果大字段数据库过长,如这里的text字段类型过长是,在l1中有数据,但是target端的数据库中无对应数据,初步分析原因可能有:
1、defgen定义文件中确定文件长度导致
2、target端编码和clob列相关限制有关(可能性不大)
3、goldengate软件内在机制导致,还需要彻底的阅读官网文档
4、现在好像到target端的最终长度为4000byte(根据数据库编码不同区分汉字、字母、数字),在本测试中,如果source端使用ntext,target只能接收1000个汉字,如果是text类型,可以接受1333个汉字。
5、试验环境说明:sql server 2005 to oracle 11g,source端表(id int primary key auto,t_text text),target端(id number primary key,text_t clob)
—出现异常原因已经找到(2011年2月22日23:27:51)
When the size of a large object exceeds 4K, Oracle GoldenGate stores the data in segments within the Oracle GoldenGate trail. The first 4K is stored in the base segment, and the rest is stored in a series of 2K segments. Oracle GoldenGate does not support the filtering, column mapping, or manipulation of large objects of this size. Full Oracle GoldenGate functionality can be used for objects that are 4K or smaller.
大致意思就是当内容超过4k时,就不能使用过滤、列映射、或者操作大字段,当内容等于或者小于4k时,所有的goldengate函数都可以使用。上面问题是当t_text内容大于4k时,不能进行大对象操作。
疑问:那当有数据超过4k该怎么处理
—试验测试(2011年2月23日23:34:13)
初始化后,同步数据库过程中,异构数据库不同列类型(如:mssql中的text到oracle中的clob),也必须使用sourcedefs,使用适当的函数对列类型进行转换(如:colmap ( id = id , t_lob = @binary(t_lob))),对于大于4k的数据,还是和初始化一样不能被处理。该问题等待寻找解决方案

goldengate同步sql server to oracle

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:goldengate同步sql server to oracle

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

准备工作,在sql server机器上建立odbc连接
一、初始化加载数据
1、source端
1)添加extract进程

ADD EXTRACT einito, SOURCEISTABLE
edit param einito
--以下添加到einito.prm文件中
EXTRACT einito
SOURCEDB mssql_test
RMTHOST 127.0.0.1, MGRPORT 7815
RMTTASK REPLICAT, GROUP rinitm
TABLE dbo.t1;

2)生成defgen文件

edit params defgen
---以下为defgen.prm中内容
defsfile F:\ogg\mssql\dirdef\t1.def
sourcedb mssql_test
table dbo.t1;
--退出ggsci(ogg安装目录dos下)
exit
defgen paramfile F:\ogg\mssql\dirprm\defgen.prm

2、target端
1)replicat 进程

ADD REPLICAT rinitm, SPECIALRUN
edit params rinitm
--以下内容在rinitm.prm文件中
replicat rinitm
sourcedefs F:\ogg\oracle\dirdef\t1.def
SETENV (NLS_LANG =AMERICAN_AMERICA.ZHS16GBK)
USERID chf, PASSWORD xifenfei
DISCARDFILE F:\ogg\oracle\dirrpt\RINItm.dsc, append
MAP "dbo.t1", TARGET CHF.T1_1;

二、数据同步
1、source端
1)添加附件日志

dblogin sourcedb mssql_test
add trandata dbo.t1

2)摄取进程(extract)

add extract extm,tranlog,begin now
ADD EXTTRAIL F:\ogg\mssql\dirdat\ms, EXTRACT EXTM
edit param extm
--以下为extm.prm内容
extract extm
SOURCEDB mssql_test
exttrail F:\ogg\mssql\dirdat\ms
dynamicresolution
gettruncates
tranlogoptions managesecondarytruncationpoint
TABLE dbo.t1;

3)传递进程(data pump extract )

ADD EXTRACT pump1, EXTTRAILSOURCE F:\ogg\mssql\dirdat\ms, BEGIN now
add rmttrail F:\ogg\oracle\dirdat\or extract pump1
edit params pump1
--以下为pump1.prm内容
extract pump1
SOURCEDB mssql_test  --需要,不然不能获得数据
rmthost 127.0.0.1, mgrport 7815
rmttrail F:\ogg\oracle\dirdat\or
PASSTHRU
gettruncates
TABLE dbo.t1;

2、target端
1)设置检查点表

edit params ./GLOBALS
--下面一句为GLOBALS文件中内容
CHECKPOINTTABLE ogg.chkpoint
dblogin userid ogg,password xifenfei
ADD CHECKPOINTTABLE ogg.chkpoint

2)replicat进程

add replicat repl exttrail F:\ogg\oracle\dirdat\or,begin now,checkpointtable ogg.chkpoint
edit  params repl
--以下为repl.prm中内容
replicat repl
SETENV (NLS_LANG =AMERICAN_AMERICA.ZHS16GBK)
userid ogg,password xifenfei
sourcedefs F:\ogg\oracle\dirdef\t1.def
reperror default,discard
discardfile F:\ogg\oracle\dirtmp\repsz.dsc,append,megabytes 100
gettruncates
MAP "dbo.t1", TARGET CHF.T1_1;

note:
因为defgen中的表名为小写,所以在replicat相关进程中,map表需要使用双引号小写

goldengate 异常处理

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:goldengate 异常处理

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

异常处理一(异常表通用型)
新建异常处理表

create table ogg.exception_log
    ( replicat_name varchar2(10),
      table_name varchar2(100),
      errno number,
      dberrmsg varchar2(4000),
      optype varchar2(20),
      errtype varchar2(20),
      logrba number,
      logposition number,
     committimestamp timestamp,
     primary key(logrba,logposition,committimestamp)
);

REPLICAT添加异常处理

REPERROR (DEFAULT, EXCEPTION)
REPERROR (DEFAULT2,discard)---abend根据需求
map chf.a_t_1, target chf.a_t_1;
map chf.a_t_1, target ogg.exception_log,
EXCEPTIONSONLY,
INSERTALLRECORDS,
COLMAP (   replicat_name = "repl"
, table_name = @GETENV ("GGHEADER", "TABLENAME")
, errno = @GETENV ("LASTERR", "DBERRNUM")
, dberrmsg = @GETENV ("LASTERR", "DBERRMSG")
, optype = @GETENV ("LASTERR", "OPTYPE")
, errtype = @GETENV ("LASTERR", "ERRTYPE")
, logrba = @GETENV ("GGHEADER", "LOGRBA")
, logposition = @GETENV ("GGHEADER", "LOGPOSITION")
, committimestamp = @GETENV ("GGHEADER", "COMMITTIMESTAMP"));
--实例中只处理chf.a_t_1表

异常处理二(异常表需要定制)
新建表(正常表和异常表)

--正常表
create table fei_1_1(id number , name varchar2(1000));
--异常表
create table ogg.exception_fei_1
    ( id number,
      name varchar2(1000),
      table_name varchar2(100),
      errno number,
      dberrmsg varchar2(4000),
      optype varchar2(20),
      errtype varchar2(20),
      logrba number,
      logposition number,
     committimestamp timestamp,
     primary key(logrba,logposition,committimestamp)
);

异常处理程序

map chf.fei_1, target chf.fei_1_1;
map chf.fei_1, target ogg.exception_fei_1,
EXCEPTIONSONLY,
INSERTALLRECORDS,
COLMAP ( USEDEFAULTS
, table_name = @GETENV ("GGHEADER", "TABLENAME")
, errno = @GETENV ("LASTERR", "DBERRNUM")
, dberrmsg = @GETENV ("LASTERR", "DBERRMSG")
, optype = @GETENV ("LASTERR", "OPTYPE")
, errtype = @GETENV ("LASTERR", "ERRTYPE")
, logrba = @GETENV ("GGHEADER", "LOGRBA")
, logposition = @GETENV ("GGHEADER", "LOGPOSITION")
, committimestamp = @GETENV ("GGHEADER", "COMMITTIMESTAMP"));

异常处理三(通配符MAPEXCEPTION)
新建异常表

create table ogg.exception_fei_all
    ( replicat_name varchar2(10),
      table_name varchar2(100),
      errno number,
      dberrmsg varchar2(4000),
      optype varchar2(20),
      errtype varchar2(20),
      logrba number,
      logposition number,
     committimestamp timestamp,
     primary key(logrba,logposition,committimestamp)
);

异常处理程序

MAP chf.fei_*, TARGET chf.*,
MAPEXCEPTION (TARGET ogg.exception_fei_all,
COLMAP (   replicat_name = "repl"
, table_name = @GETENV ("GGHEADER", "TABLENAME")
, errno = @GETENV ("LASTERR", "DBERRNUM")
, dberrmsg = @GETENV ("LASTERR", "DBERRMSG")
, optype = @GETENV ("LASTERR", "OPTYPE")
, errtype = @GETENV ("LASTERR", "ERRTYPE")
, logrba = @GETENV ("GGHEADER", "LOGRBA")
, logposition = @GETENV ("GGHEADER", "LOGPOSITION")
, committimestamp = @GETENV ("GGHEADER", "COMMITTIMESTAMP")));

处理说明:
REPERROR参数用以控制Replicat进程如何响应映射过程中发生的错误
DEFAULT参数代表一种全局错误类型,即除去所有已明确指定的错误外的一切错误
DEFAULT2参数代表当DEFAULT错误以Exception方式响应时,所有MAP映射中未定义Exception部分出现的所有错误
EXCEPTIONSONLY只能用于确定表的异常处理
MAPEXCEPTION可以用于通配符的表异常处理

使用goldengate同步oracle

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:使用goldengate同步oracle

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

一、source端

add extract extl,tranlog,begin now
ADD EXTTRAIL /u01/ogg/dirdat/lr, EXTRACT EXTL
ADD TRANDATA chf.objce_t
edit params extl
extract extl
userid ogg,password xifenfei
exttrail /u01/ogg/dirdat/lr
dynamicresolution
gettruncates
table chf.objce_t;
ADD EXTRACT pump1, EXTTRAILSOURCE /u01/ogg/dirdat/lr, BEGIN now
add rmttrail /u01/ogg/dirdat/rl extract pump1
edit params pump1
extract pump1
userid ogg, password xifenfei
rmthost 192.168.1.111, mgrport 7809
rmttrail /u01/ogg/dirdat/rl
PASSTHRU
gettruncates
table chf.objce_t;

二、target端

edit params ./GLOBALS
CHECKPOINTTABLE ogg.chkpoint
dblogin userid ogg,password xifenfei
ADD CHECKPOINTTABLE ogg.chkpoint
add replicat repl exttrail /u01/ogg/dirdat/rl,begin now,checkpointtable ogg.chkpoint
edit  params repl
replicat repl
userid ogg,password xifenfei
assumetargetdefs
reperror default,discard
discardfile /tmp/repsz.dsc,append,megabytes 100
gettruncates
map chf.objce_t, target chf.objce_t;

使用goldengate同步mysql

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:使用goldengate同步mysql

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

一、source端

add extract extl,vam,begin now
ADD EXTTRAIL F:\ogg\mysql\dirdat\rl, EXTRACT EXTL
edit params extl
extract extl
sourcedb test@localhost:3306,userid root,password xifenfei
exttrail F:\ogg\mysql\dirdat\rl
dynamicresolution
gettruncates
table test.t_1;
add EXTRACT pump1, EXTTRAILSOURCE F:\ogg\mysql\dirdat\rl, BEGIN now
add rmttrail /ogg/mysql/dirdat/rl extract pump1
edit params pump1
extract pump1
rmthost 192.168.1.111,mgrport 7808
rmttrail /ogg/mysql/dirdat/rl
PASSTHRU
gettruncates
table test.t_1;

二、target端

edit params ./GLOBALS
dblogin sourcedb test@localhost:3306,userid root,password xifenfei
CHECKPOINTTABLE ogg.chkpoint
ADD CHECKPOINTTABLE ogg.chkpoint
add replicat repl exttrail /ogg/mysql/dirdat/rl,begin now,checkpointtable ogg.chkpoint
edit params repl
replicat repl
DBOPTIONS HOST 127.0.0.1, CONNECTIONPORT 3306
TARGETDB test,userid root,password xifenfei
assumetargetdefs
reperror default,discard
discardfile /tmp/mysql.dsc,append,megabytes 100
gettruncates
map TEST.T_1, target "test.t_1";

三、说明
本实例是win 中的mysql同步到linux中的mysql
有个注意点:
1、add extract extl,vam,begin now 不像oracle中的tranlog
2、注意各个参数中schema.tablename大小写问题
1)win中不区分,全部使用小写会自动转换为大写
2)在replicate参数中,因为map是从win中的data pump中得到,所以map后面的schema.tablename需要大写
3)在replicate参数中,因为table是linux中的对应linux中的数据库名和表名(mysql是以文件形式存储,一般均为小写),所以map后面的schema.tablename需要小写+双引号,防止转为大写
3、注意mysql数据库编码
四、与oracle不同之处
1、登录
dblogin sourcedb dbname@localhost:3306,userid root,password xifenfei
2、Extract中访问mysql
sourcedb dbname@localhost:3306,userid root,password xifenfei
3、Replicat中访问mysql
DBOPTIONS HOST 127.0.0.1, CONNECTIONPORT 3306
TARGETDB dbname,userid root,password xifenfei

goldedgate 初始化数据

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:goldedgate 初始化数据

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

一、mysql数据库初始化
1、source端配置

ADD EXTRACT EINI1, SOURCEISTABLE
EDIT PARAMS EINI1
EXTRACT EINI1
sourcedb test@localhost:3306,USERID root, PASSWORD xifenfei
RMTHOST 192.168.1.111, MGRPORT 7808
RMTTASK REPLICAT, GROUP RINI1
TABLE "test.web_statistics";

3、target端配置

ADD REPLICAT RINI1, SPECIALRUN
EDIT PARAMS RINI1
REPLICAT RINI1
ASSUMETARGETDEFS
DBOPTIONS HOST 127.0.0.1, CONNECTIONPORT 3306
TARGETDB test,userid root,password xifenfei
DISCARDFILE ./dirrpt/RINI2.dsc, PURGE
MAP "test.web_statistics", TARGET "test.web_statistics";

3、开启复制
start extract eini1
二、oracle数据库
1、source端配置

ADD EXTRACT EINI1, SOURCEISTABLE
EDIT PARAMS EINI1
EXTRACT EINI1
SETENV (NLS_LANG =AMERICAN_AMERICA.UTF8)
USERID ogg, PASSWORD "xifenfei"
RMTHOST 192.168.1.111, MGRPORT 7809
RMTTASK REPLICAT, GROUP RINI1
TABLE chf.init_obj;

2、target端配置

ADD REPLICAT RINI1, SPECIALRUN
EDIT PARAMS RINI1
REPLICAT RINI1
ASSUMETARGETDEFS
SETENV (NLS_LANG =AMERICAN_AMERICA.UTF8)
USERID ogg, PASSWORD xifenfei
DISCARDFILE ./dirrpt/RINI1.dsc, PURGE
MAP chf.init_obj, TARGET chf.init_obj;

3、开启复制
start extract eini1

goldengate通用配置

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:goldengate通用配置

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

一、理论
source

ADD EXTRACT <ext>, TRANLOG, BEGIN <time>, [, THREADS]
ADD EXTTRAIL <local_trail>, EXTRACT <ext>
EDIT PARAMS <ext>
-- Identify the Extract group:
EXTRACT <ext>
-- Specify database login information as needed for the database:
[SOURCEDB <dsn_1>,][USERID <user>[, PASSWORD <pw>]]
-- Specify the local trail that this Extract writes to:
EXTTRAIL <local_trail>
-- Specify tables to be captured:
TABLE <owner>.<table>;
ADD EXTRACT <pump_1>, EXTTRAILSOURCE <local_trail>, BEGIN <time>
ADD RMTTRAIL <remote_trail_1>, EXTRACT <pump_1>
EDIT PARAMS <pump_1>
-- Identify the data pump group:
EXTRACT <pump_1>
-- Specify database login information as needed for the database:
[SOURCEDB <dsn_1>,][USERID <user>[, PASSWORD <pw>]]
-- Specify the name or IP address of the first target system:
RMTHOST <target_1>, MGRPORT <portnumber>
-- Specify the remote trail on the first target system:
RMTTRAIL <remote_trail_1>
-- Allow mapping, filtering, conversion or pass data through as-is:
[PASSTHRU | NOPASSTHRU]
-- Specify tables to be captured:
TABLE <owner>.<table>;

target

edit params ./GLOBALS
CHECKPOINTTABLE <owner>.<tablename>
ADD REPLICAT <rep_1>, EXTTRAIL <remote_trail_1>, BEGIN <time> checkpointtable <owner>.<tablename>
edit params <rep_1>
-- Identify the Replicat group:
REPLICAT <rep_1>
-- State whether or not source and target definitions are identical:
SOURCEDEFS <full_pathname> | ASSUMETARGETDEFS
-- Specify database login information as needed for the database:
[TARGETDB <dsn_3>,] [USERID <user id>[, PASSWORD <pw>]]
-- Specify error handling rules:
REPERROR (<error>, <response>)
-- Specify tables for delivery:
MAP <owner>.<table>, TARGET <owner>.<table>[, DEF <template name>];

二、配置实例
source

add extract extl,tranlog,begin now
ADD EXTTRAIL /u01/ogg/dirdat/rl, EXTRACT EXTL
ADD TRANDATA chf.objce_t
edit params extl
extract extl
SETENV (NLS_LANG = "AMERICAN_AMERICA.ZHS16GBK")
userid ogg,password xifenfei
exttrail /u01/ogg/dirdat/rl
dynamicresolution
gettruncates
table chf.objce_t;
ADD EXTRACT pump1, EXTTRAILSOURCE /u01/ogg/dirdat/rl, BEGIN now
add rmttrail /u01/ogg/dirdat/rl extract pump1
edit params pump1
extract pump1
SETENV (NLS_LANG = "AMERICAN_AMERICA.ZHS16GBK")
userid ogg, password xifenfei
rmthost 192.168.1.111, mgrport 7809
rmttrail /u01/ogg/dirdat/rl
PASSTHRU
gettruncates
table chf.objce_t;

target

edit params ./GLOBALS
CHECKPOINTTABLE ogg.chkpoint
ADD CHECKPOINTTABLE ogg.chkpoint
add replicat repl exttrail /u01/ogg/dirdat/rl,begin now,checkpointtable ogg.chkpoint
edit repl
replicat repl
SETENV (NLS_LANG = "AMERICAN_AMERICA.ZHS16GBK")
userid ogg,password xifenfei
assumetargetdefs
reperror default,discard
discardfile /tmp/repsz.dsc,append,megabytes 100
gettruncates
map chf.objce_t, target chf.objce_t;