ITPub博客

首页 > 数据库 > Oracle > 【转】 Oracle GoldenGate系统之----相关参数说明

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

Oracle 作者:邪丶坏人 时间:2016-12-14 13:47:18 0 删除 编辑
原文博主:wailon;原文链接http://blog.itpub.net/429786/viewspace-1061095/  

一、配置文件存放位置 
[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 extdg
#进程环境设置
setenv(NLS_LANG="AMERICAN_AMERICA.ZHS16GBK")
setenv(ORACLE_SID="wailon")
#用户登录信息,userid username@dbname,password userpwd
  userid scott,password tiger
#排除以下用户的相关信息
--tranlogoptions excludeuser scott
#复制所有的ddl操作
ddl include all 

#生成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
#复制所有的ddl操作
ddl include all 

#源对象和目标对象映射关系,列名不一样时用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


----------------------------------------

相关目录及运行程序说明:

Parameter files                /home/oracle/ogg/11.2/dirprm -- 参数文件保存目录,如MGR管理进程
Report files                   /home/oracle/ogg/11.2/dirrpt -- 报告文件保存目录,OGG主要诊断手段之一,使用view report #GroupName查看报告
Checkpoint files               /home/oracle/ogg/11.2/dirchk -- 由Extract(抽取)或Replicat(应用)进程产生对应的CHECKPOINT文件,记录当前读写的位置
Process status files           /home/oracle/ogg/11.2/dirpcs -- 进程状态文件保存目录,记录当前运行进程的状态,进程名以大写显示
                                                                                -- 扩展名为pcm表示管理进程,pcr表示replicat进程,pce表示为extract进程
SQL script files               /home/oracle/ogg/11.2/dirsql -- SQL脚本保存目录
Database definitions files     /home/oracle/ogg/11.2/dirdef -- 由DEFGEN生成的数据库结构定义文件保存目录,主要用于异构数据库
Extract data files             /home/oracle/ogg/11.2/dirdat -- TRAIL文件和Extract(抽取)进程产生的文件默认目录
Temporary files                /home/oracle/ogg/11.2/dirtmp -- 由CACHE管理器分配,用于保存事务数据的目录
Stdout files                   /home/oracle/ogg/11.2/dirout -- 未使用,一般用于DISCARD文件保存

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

请登录后发表评论 登录
全部评论
多年的DBA从业经验,有扎实的linux和Oracle运维和故障处理的能力; 对oracle rac,adg,ogg,rman备份恢复,异机恢复,分区表,数据迁移,sql优化,版本升级,数据库架构设计,故障处理都较为熟练

注册时间:2016-04-01

  • 博文量
    53
  • 访问量
    124327