Oracle Goldengate参数整理

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle Goldengate参数整理相关的知识,希望对你有一定的参考价值。

转自:http://blog.csdn.net/lemontree1123/article/details/46603549

 

manager参数:

AUTOSTART:指定在mgr启动时自动启动那些进程.
AUTOSTART ER *
AUTOSTART extract extsz 
 
AUTORESTART:指定在mgr可以定时重启那些进程。可以在网络中断等故障恢复后自动重起,避免人工干预.
AUTORESTART ER *, WAITMINUTES 5, RETRIES 3
 
DYNAMICPORTLIST:指定GoldenGate可以使用那些端口接受extract发送过来的数据.
DYNAMICPORTLIST 7840-7850
 
PORT:制定GoldenGate的mgr进程使用哪个 TCP/IP端口侦听请求.
PORT 7809
 
LAGCRITICAL:指定认为超过此时间即为严重错误的延迟最大值,如果延迟达到此时间值则会在ggserr.log里面写入一条error信息
LAGCRITICALMINUTES 10 
 
LAGREPORT:指定在ggserr.log中报告延迟的时间间隔.
LAGREPORTHOURS 1 
 
PURGEOLDEXTRACTS :定义自动删除过时的队列以节省硬盘空间。一般按照两个规则来删除:首先,要满足检查点要求,没有使用过的队列不能删除,保证无数据丢失;其次,可以保留一定的天数。只有当已经使用过且超过设定的天数后的队列会被自动删除。 
purgeoldextracts /backup/goldengate/dirdat/*,usecheckpoints, minkeepdays 7
 
 
抽取参数:
CHECKPARAMS:如果加入该参数,表示下次运行只是检查一下语法,并不实际运行进程。
注意:该命令只能检查一些简单语法,并不能保证参数文件是完全正确的。
COMMENT:注释行,也可以用两个中划线--代替.--checkparams表示本行已经被注释掉 
EXTRACT :定义抽取进程的名字 
OBEY :可以将外部文件的内容包含到本参数文件中来。用于将一些可以重复利用的参数文件部分内容隔离出来,便于统一修改。
Obey tables.txt
TABLEEXCLUDE :定义所需要排除的表。如果在table里面定义了使用通配符,那么可以使用该参数定义排除掉其中的部分表。如:
tableexclude ctais2.TMP_*;
tableexclude ctais2.TEMPTAB; 
GETUPDATEAFTERS | IGNOREUPDATEAFTERS 是否在队列中写入后影像,缺省复制 
GETUPDATEBEFORES | IGNOREUPDATEAFTERS 是否在队列中写入前影像,缺省不复制 
GETUPDATES | IGNOREUPDATES 是否复制update操作,缺省复制
GETDELETES | IGNOREDELETES 是否复制delete操作,缺省复制
GETINSERTS | IGNOREINSERTS 是否复制insert操作,缺省复制
GETRUNCATES| IGNORETRUNCATES 是否复制truncate操作,缺省不复制.
RMTHOST 指定目标系统及其GoldenGate Manager进程的端口号,也用于定义是否使用压缩进行传输。
rmthost  99.16.1.12,mgrport 7809, compress
RMTTRAIL 指定写入到目标端的哪个队列。 
EXTTRAIL 指定写入到本地的哪个队列。 
SQLEXEC 在extract运行时首先运行一个sql语句。sqlexec "Alter session set constraints=deferred" 
PASSTHRU 禁止extract与数据库交互,适用于Data Pump传输进程(dpeXX)
GETENV | SETENV 针对extract进程设定系统环境变量。 setenv ( NLS_LANG = AMERICAN_AMERICA.ZHS16GBK ) 
REPORT 定义自动定时报告。 REPORT AT 01:59 
STATOPTIONS 定义每次使用stat时统计数字是否需要重置
REPORTCOUNT 报告已经处理的纪录条数统计数字
TLTRACE 打开对于数据库日志的跟踪日志 
TRACE/TRACE2 打开对GoldenGate进程的跟踪日志,一般用于调试。 
DISCARDFILE 定义discard文件位置,如果处理中有纪录出错会写入到此文件中
discardfile /oradata/goldengate/repkj.dsc,append,megabytes 100m
NUMFILES 定义本extract为最大多少张表预留空间,缺省为500,超过500张表需要设定一个比实际表数略大的值
numfiles 3000
PURGEOLDEXTRACTS 同mgr进程,可以设置自动删除队列,建议在mgr设置
REPORTROLLOVER 设定切换一个日志的时间和间隔 reportrollover at 02:00
TRANSMEMORY 设定GoldenGate的抽取进程能够使用的内存大小。如下参数指定本进程最大只能占用2G内存,其中每个事务最大 占用内存不能超过500M,如果超过则使用指定目录作为虚拟内存,该目录下的单个文件大小为4G,最多只能在该目录下占用8G空间作为缓存。
transmemory directory (/backup/goldengate/dirtmp,8G,4G),ram 2G,transram 500M
DBOPTIONS  指定对于某种特定数据库所需要的特殊参数。
[SOURCEDB,] USERID ,PASSWORD 指定所要登陆的数据库名称,用户名和密码。对于oracle无需指定sourcedb,直接指定用户名和密码即可。
Userid goldengate, password goldengate 
TRANLOGOPTIONS 指定在解析数据库日志时所需要的特殊参数。例如,对于裸设备,可能需要加入下列参数
tranlogoptions rawdeviceoffset 0 
tranlogoptions altarchivelogdest instance sidname /arch  --指定归档日志所在
WARNLONGTRANS 指定对于超过一定时间的长交易可以在ggserr.log里面写入警告信息。例如,每隔30分钟检查一次长交易,对于超过12个小时的进行告警:--warnlongtrans 12h, checkintervals 30m
 
 
复制参数:
CHECKPARAMS 检查参数语法然后停止
COMMENT 注释行
REPLICAT 定义进程名称
USERID 指定登陆目标数据库的用户名和密码
OBEY 将外部文件包含到参数文件中
ASSUMETARGETDEFS 假定两端数据结构一致使用此参数
SOURCEDEFS 假定两端数据结构不一致,使用此参数指定源端的数据结构定义文件。该文件需要由GoldenGate工具产生
MAPEXCLUDE 用于使用在map中使用*匹配时排除掉指定的表,类似于于源端的tablexclude
mapexclude CTAIS2.JC_GY_SWWSWH
MAP ctais2.* ,TARGET ctais2.*; 
 
GETDELETES | IGNOREDELETES 是否复制delete操作,缺省为复制
GETUPDATES |IGNOREUPDATES  是否复制update操作,缺省为复制
GETINSERTS | IGNOREINSERTS 是否复制insert操作,缺省为复制
GETUPDATEAFTERS | IGNOREUPDATEAFTERS 是否读取后影像,缺省为读取
GETUPDATEBEFORES | IGNOREUPDATEBEFORES 是否读取前影像,缺省为不读取
GETTRUNCATES | IGNORETRUNCATES 是否复制truncate操作,缺省为不复制
allownoopupdates 允许执行无实际变化的update。例如,update a=a会纪录一条update,但是没有后影像,无法正确构筑where语句
REPERROR 定义出错以后replicat的响应,一般可以定义为两种:Abend,即一旦出现错误即停止复制,此为缺省配置;Discard,出现错误后继续复制,只把错误的数据放到discard文件中。 
DISCARDFILE 定义出错数据的输出文件。当数据出现错误后,可以用于查找错误原因 
discardfile /oradata/goldengate/dirrpt/repsz.dsc,append, megabytes 10
HANDLECOLLISIONS 自动过滤重复时段的数据冲突,用于不能停机执行初始化。打开该参数后不会将数据错误报到discard文件中。 
DYNAMICRESOLUTION 使replicat动态解析表的结构,加快启动速度。缺省为每次启动解析所有要复制表的结构 
SQLEXEC 调用存储过程或者执行sql语句。可以将返回值作为依据进行过滤条件,或者用户改变session变量。
GROUPTRANSOPS 将小的交易合并成为一个大的交易进行提交,减少提交次数,降低系统IO消耗。
MAXTRANSOPS 将大交易拆分,每若干条纪录提交一次 maxtransops 1000
BATCHSQL 针对批处理中针对某个表的大批量重复操作进行优化,提高批处理的处理速度。 
DBOPTIONS 定义与数据库类型相关的特殊处理方式。
NUMFILES 定义进程中表的最大数据量,缺省为 500.
PURGEOLDEXTRACTS 定义自动删除队列,一般建议在mgr进程配置。
 
错误定位时经常使用下面三个参数:
nodynsql
nobinarychars
showsyntax
 
 
DYNSQL | NODYNSQL
Valid for Replicat
Use the DYNSQL and NODYNSQL parameters to control the way that SQL statements are 
formed. With NODYNSQL, Replicat uses literal SQL statements with the bind variables 
resolved. With DYNSQL, the default, Replicat uses dynamic SQL to compile a statement 
once, and then execute it many times with different bind variables. 
● Statement with DYNSQL:
UPDATE <table> ... WHERE ID = :B
● Statement with NODYNSQL: 
UPDATE <table> ... WHERE ID = ‘1234’
In most environments, using DYNSQL yields the best efficiency and most throughput. 
However, in isolated instances, using NODYNSQL has proven faster and more efficient. Try 
NODYNSQL only if Replicat throughput appears unsatisfactory.
Do not use DYNSQL when replicating to target databases that do not support dynamic SQL.
When using NODYNSQL, you must also use the NOBINARYCHARS parameter。
Oracle GoldenGate for mysql does not support LOB replication in NODYNSQL mode. 
Default DYNSQL
Syntax DYNSQL | NODYNSQL
 
BINARYCHARS | NOBINARYCHARS
Valid for Extract and Replicat
Use BINARYCHARS and NOBINARYCHARS to control whether character data is treated as binary data or null-terminated strings.
BINARYCHARS, the default, maintains data the way it was entered in the source table. This 
ensures proper processing in cases when a column in the source or target database is 
defined as a character column and it is possible that binary characters could be entered 
into that column. BINARYCHARS is not compatible with the BULKLOAD parameter (direct-bulk load); use NOBINARYCHARS.
NOBINARYCHARS can cause Oracle GoldenGate to interpret a binary character to be the end 
of the data in that column. If there is more data after the binary data, it is not processed 
by Oracle GoldenGate, compromising data integrity. NULL characters cause this to happen, 
as well as any character defined with the DELIMITER option of FORMATASCII. Unless there is 
good reason to use NOBINARYCHARS, leaving the default set to BINARYCHARS is recommended so 
that data is maintained the way it was entered in the source table. Before using 
NOBINARYCHARS, contact Oracle Support.
BINARYCHARS and NOBINARYCHARS are table-specific. One parameter remains in effect for all 
subsequent TABLE or MAP statements until the other is encountered.
Default BINARYCHARS
Syntax BINARYCHARS | NOBINARYCHARS
 
SHOWSYNTAX
Valid for Replicat
Use the SHOWSYNTAX parameter to start an interactive session where you can view each Replicat SQL statement before it is applied. By viewing the syntax of SQL statements that failed, you might be able to diagnose the cause of the problem. For example, you could find out that the WHERE clause is using a non-indexed column.Requirements for using SHOWSYNTAX
● The first time that you use SHOWSYNTAX, request guidance from an Oracle Support analyst. It is a debugging parameter and can cause unwanted results if used improperly. It requires manual intervention, so automated processing is suspended, and it slows down processing, which can cause backlogs and latency.
● To use SHOWSYNTAX, Replicat must be started from the command shell of the operating system. Do not use SHOWSYNTAX if Replicat is started through GGSCI. 
● Use SHOWSYNTAX in a test environment. Create duplicates of your Replicat groups and target tables so that the production environment is not affected. 
Using SHOWSYNTAX
1. In the Replicat parameter file, include the following parameters in the order shown 
here, each on its own line:
? NOBINARYCHARS
? NODYNSQL
? SHOWSYNTAX
NOTE NOBINARYCHARS is an undocumented parameter that causes Oracle GoldenGate 
to treat binary data as a null-terminated string. Contact Oracle Support before 
using it. NODYNSQL causes Replicat to use literal SQL statements instead of using dynamic SQL with bind variables. 
2. From the Oracle GoldenGate home directory, start Replicat from the command shell of the operating system using the syntax shown here. Do not specify a reportfile option. 
Output must go to screen.
replicat paramfile dirprm/<Replicat_name>.prm 
3. The first SQL statement is displayed with some prompts.
? Choose Keep Displaying (the default) to execute the current statement and display the 
next one.
? Choose Stop Display to resume normal processing and stop printing SQL statements 
to screen.
4. When finished viewing syntax, remove SHOWSYNTAX, NOBINARYCHARS, and NODYNSQL from 
the parameter file.
Default None
Syntax SHOWSYNTAX
 
 
11.1版本的OGG Bounded Recovery BR参数可能会有很多问题,最好关闭,然后配合操作系统监控长事务,定时杀掉长事务,避免出现问题。然后
配置CACHESZIE为一个值,避免影响系统性能。
 
 
tranlogoptions logretention disabled
tranlogoptions dblogreader
DBLOGREADER :
(Oracle) Valid for Extract in classic capture mode.Causes Extract to use a newer ASM API that is available as 
of Oracle 10.2.0.5 and later 10g R2 versions, and Oracle 11.2.0.2 and later 11g R2 versions (but not in Oracle 11g R1 versions). This API uses the database server to access the redo and archive logs, instead of connecting directly to the Oracle ASM instance. The database must contain the 
libraries that contain the API modules and must be running.To use this feature, the Extract database user must have SELECT ANY TRANSACTIONprivilege. When used, DBLOGREADER enables Extract to use a read size of up to 4 MB in size. This is controlled with the DBLOGREADERBUFSIZE option
The maximum read size when using the default OCI buffer is 28672 bytes. This is controlled by the ASMBUFSIZE option.
A larger buffer may improve the performance of Extract when redo rate is high. 
When using DBLOGREADER, do not use the ASMUSER and ASMPASSWORD options of TRANLOGOPTIONS. The API uses the user and password specified with the USERID parameter。
 

以上是关于Oracle Goldengate参数整理的主要内容,如果未能解决你的问题,请参考以下文章

Oracle GoldenGate相关

Oracle GoldenGate DDL 详细说明 使用手册(较早资料)

oracle迁移到mysql分库分表方案之——ogg(goldengate)

Oracle Goldengate 12.3.0.1的目录介绍

Oracle GoldenGate学习之Goldengate介绍

oracle GoldenGate 安装