goldengate一些參数整理
2017-08-16 12:22 tlnshuju 阅读(1003) 评论(0) 编辑 收藏 举报
manager參数:
AUTOSTART:指定在mgr启动时自己主动启动那些进程.
AUTOSTART ER *
AUTOSTART extract extsz
AUTORESTART:指定在mgr能够定时重新启动那些进程。
能够在网络中断等故障恢复后自己主动重起。避免人工干预.
AUTORESTART ER *, WAITMINUTES 5, RETRIES 3
DYNAMICPORTLIST:指定GoldenGate能够使用那些port接受extract发送过来的数据.
DYNAMICPORTLIST 7840-7850
PORT:制定GoldenGate的mgr进程使用哪个 TCP/IPport侦听请求.
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进程的port号。也用于定义是否使用压缩进行传输。
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 指定所要登陆的数据库名称。username和password。对于oracle无需指定sourcedb。直接指定username和password就可以。
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 指定登陆目标数据库的username和password
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
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。