1. 程式人生 > >goldengate一些參數整理

goldengate一些參數整理

perf nis 匹配 cover str asmb resolved leg ans

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

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。

goldengate一些參數整理