Oracle GoldenGate系统之----相关参数说明

一、配置文件存放位置
[oracle@dg ~]$ cd /u01/app/ogg/dirprm/

[oracle@dg dirprm]$ ls
dgrac.prm  extb.prm  extdg.prm  jagent.prm  mgr.prm  rep1.prm

二、 管理进程mgr配置文件
[oracle@dg dirprm]$ more mgr.prm
PORT 7801                                --  监听端口PORT
DYNAMICPORTLIST 7802-7820    -- 开启其他进程使用端口(数量决定最大进程数)
AUTOSTART ER *                       -- 开启管理进程后,自动启动所有的EXTRACT及REPLICAT进程
AUTORESTART ER *,RETRIES 3,WAITMINUTES 2,RESETMINUTES 60  -- 自动重启异常中止的进程,重试3次,每次等2分钟,一小时后重试
STARTUPVALIDATIONDELAY 5    -- 启动时延迟5秒校验
PURGEOLDEXTRACTS ./dirdat/*,USECHECKPOINTS,MINKEEPDAYS 7    -- 自动清理EXTRACT目录文件,保留7天


三、 抽取进程,进程名不超过8个字符

[oracle@dg dirprm]$ more extdg.prm
#定义extract ,参数名和组名一致
extract extdg
#进程环境设置
setenv(NLS_LANG="AMERICAN_AMERICA.ZHS16GBK")
setenv(ORACLE_SID="wailon")
#用户登录信息,userid username@dbname,password userpwd
  userid scott,password tiger
#排除以下用户的相关信息
--tranlogoptions excludeuser scott
#生成EXTRACT TRAIL文件位置,2个字符开头,其他自动生成
exttrail /u01/app/ogg/dirdat/dg
#动态分析表结构
dynamicresolution
#捕捉TRUNCATE操作
  gettruncates
#定义需要同步的表,可使用通配符*
  table scott.*;
 
四、 PUMP发送进程,extract进程的一种,把生成的EXTRACT TRAIL文件传送到远端服务器
[oracle@dg dirprm]$ more dgrac.prm
extract dgrac
setenv(NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
userid scott@wailon,password tiger

#远端服务器配置信息
rmthost 192.168.56.131,mgrport 7801

#远端服务器生成的TRAIL文件
rmttrail /u01/app/ogg/dirdat/dg

#直通模式或普通模式,两边表名及列名一样用直通,否则用普通配置自定义映射
--NOPASSTHRU
PASSTHRU
gettruncates
table scott.*;
 

五、 应用进程replicat,进程名不超过8个字符
[oracle@dg dirprm]$ more rep1.prm
#定义replicat组名
replicat rep1
setenv(NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
userid scott@wailon, password tiger
#两边数据库类型及结构一致时用ASSUMETARGETDEFS;否则使用SOURCEDEFS数据结构定义文件,实现不同数据库间同步
--assumetargetdefs
sourcedefs /u01/app/ogg/dirdef/emp.def

#应用数据出错,默认丢弃

reperror default,discard

#丢弃的数据保存文件
discardfile /u01/app/ogg/dirout/rep1.dsc,append,megabytes 100
gettruncates
batchsql

#源对象和目标对象映射关系,列名不一样时用colmap,列名用双引号引用,列名与“=”之间有空格
map scott.b, target scott.b, &
colmap(usedefaults, "OWNER" = "USERNAME");

#表映射关系,注意target前有一个空格
  map scott.emp, target scott.emp;
map scott.dept, target scott.dept;
 
六、 初始化加载
1、源端

[oracle@dg dirprm]$ more extb.prm
extract extb
setenv(NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
userid scott@wailon, password tiger
rmthost 192.168.56.131, mgrport 7801
rmttask replicat, group repb
table scott.b;
 
2、目标
[oracle@dgrac dirprm]$ more repb.prm
replicat repb
assumetargetdefs
userid scott@ogg, password tiger
reperror default,discard
discardfile /u01/app/ogg/dirtmp/repb.dsc,append,megabytes 100
#INSERTAPPEND 直接路径加载,提高加载速度
--INSERTAPPEND
#当目标端存在相同数据时,忽略重复数据错误
HANDLECOLLISIONS
map scott.b, target scott.b;

[oracle@dgrac dirprm]$ -- 数据定义文件参数文件
[oracle@dgrac dirprm]$ more defgen.prm
defsfile /u01/app/ogg/dirdef/emp.def
userid scott@wailon,password tiger
table scott.emp;
table scott.dept;
table scott.b;

[oracle@dgrac dirprm]$ cd ..
[oracle@dgrac ogg]$ -- 根据参数文件生成数据定义文件
[oracle@dgrac ogg]$ ./defgen paramfile dirprm/defgen.prm

[oracle@dg ogg]$ cd dirdef/
[oracle@dg dirdef]$ -- 数据定义文件目录
[oracle@dg dirdef]$ ls
emp.def
[oracle@dg dirdef]$ -- 数据定义文件格式
[oracle@dg dirdef]$ more emp.def
*+- Defgen version 2.0, Encoding US-ASCII
*
* Definitions created/modified  2013-09-25 23:16
*
*  Field descriptions for each column entry:
*
*     1    Name
*     2    Data Type
*     3    External Length
*     4    Fetch Offset
*     5    Scale
*     6    Level
*     7    Null
*     8    Bump if Odd
*     9    Internal Length
*    10    Binary Length
*    11    Table Length
*    12    Most Significant DT
*    13    Least Significant DT
*    14    High Precision
*    15    Low Precision
*    16    Elementary Item
*    17    Occurs
*    18    Key Column
*    19    Sub Data Type
*
Database type: ORACLE
Character set ID: windows-936
National character set ID: UTF-16
Locale: neutral
Case sensitivity: 14 14 14 14 14 14 14 14 14 14 14 14 11 14 14 14
*
Definition for table SCOTT.EMP
Record length: 112
Syskey: 0
Columns: 8
EMPNO     134      8        0  0  0 1 0      8      8      8 0 0 0 0 1    0 1 3
ENAME      64     10       12  0  0 1 0     10     10      0 0 0 0 0 1    0 0 0
JOB        64      9       28  0  0 1 0      9      9      0 0 0 0 0 1    0 0 0
MGR       134      8       42  0  0 1 0      8      8      8 0 0 0 0 1    0 0 3
HIREDATE  192     19       54  0  0 1 0     19     19     19 0 5 0 0 1    0 0 0
SAL       134      9       76  2  0 1 0      8      8      8 0 0 0 0 1    0 0 3
COMM      134      9       88  2  0 1 0      8      8      8 0 0 0 0 1    0 0 3
DEPTNO    134      8      100  0  0 1 0      8      8      8 0 0 0 0 1    0 0 3
End of definition
*
Definition for table SCOTT.DEPT
Record length: 50
Syskey: 0
Columns: 3
DEPTNO  134      8        0  0  0 1 0      8      8      8 0 0 0 0 1    0 1 3
DNAME    64     14       12  0  0 1 0     14     14      0 0 0 0 0 1    0 0 0
LOC      64     13       32  0  0 1 0     13     13      0 0 0 0 0 1    0 0 0
End of definition
*
Definition for table SCOTT.B
Record length: 532
Syskey: 0
Columns: 15
USERNAME         64     30        0  0  0 1 0     30     30      0 0 0 0 0 1    0 0 0
OBJECT_NAME      64    128       36  0  0 1 0    128    128      0 0 0 0 0 1    0 0 0
SUBOBJECT_NAME   64     30      170  0  0 1 0     30     30      0 0 0 0 0 1    0 0 0
OBJECT_ID        64     50      206  0  0 1 0     50     50     50 0 0 0 0 1    0 1 2
DATA_OBJECT_ID   64     50      262  0  0 1 0     50     50     50 0 0 0 0 1    0 0 2
OBJECT_TYPE      64     19      318  0  0 1 0     19     19      0 0 0 0 0 1    0 0 0
CREATED         192     19      342  0  0 1 0     19     19     19 0 5 0 0 1    0 0 0
LAST_DDL_TIME   192     19      364  0  0 1 0     19     19     19 0 5 0 0 1    0 0 0
TIMESTAMP        64     19      386  0  0 1 0     19     19      0 0 0 0 0 1    0 0 0
STATUS           64      7      410  0  0 1 0      7      7      0 0 0 0 0 1    0 0 0
TEMPORARY        64      1      422  0  0 1 0      1      1      0 0 0 0 0 1    0 0 0
GENERATED        64      1      428  0  0 1 0      1      1      0 0 0 0 0 1    0 0 0
SECONDARY        64      1      434  0  0 1 0      1      1      0 0 0 0 0 1    0 0 0
NAMESPACE        64     50      440  0  0 1 0     50     50     50 0 0 0 0 1    0 0 2
EDITION_NAME     64     30      496  0  0 1 0     30     30      0 0 0 0 0 1    0 0 0
End of definition

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/429786/viewspace-1061095/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/429786/viewspace-1061095/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值