一.官網有關GG 參數文件的說明
Most OracleGoldenGate functionality is controlled by means of parameters specified in parameterfiles. A parameter file is an ASCII file that is read by an associated process.
--大多數GG 功能都是受指定的參數控制,這個參數文件是一個ASCII 文件。
OracleGoldenGate uses two types of parameter files: a GLOBALS file and runtimeparameter files.
--GG 使用兩種類型的參數文件: GLOBALS 和 runtime parameter。
1.1 Overview of the GLOBALS file
The GLOBALS filestores parameters that relate to the Oracle GoldenGate instance as a whole.This is in contrast to runtime parameters, which are coupled with a specificprocess such as Extract. The parameters in the GLOBALS file apply to allprocesses in the Oracle GoldenGate instance, but can be overridden by specificprocess parameters. Once set, GLOBALS parameters are rarely changed, and thereare far fewer of them than runtime parameters.
--GLOBALS 文件里保存的參數爭對整個GG instance,該參數可以被指定的進程參數覆蓋,一般來說,GLOBALS參數一旦指定,很少修改。
A GLOBALSparameter file is required only in certain circumstances and, when used, must becreated from the command shell before starting any Oracle GoldenGate processes,including GGSCI. The GGSCI program reads the GLOBALS file and passes theparameters to processes that need them.
GLOBALS 參數文件僅當某些情況下才會使用,在使用時,必須在啟動GG進程之前創建該參數文件。
To create a GLOBALS file:
1. From the Oracle GoldenGate installationlocation, run GGSCI and enter the following command, or open a file in an ASCIItext editor.
EDIT PARAMS./GLOBALS
NOTE:
The ./ portionof this command must be used, because the GLOBALS file must
reside at the root of the Oracle GoldenGateinstallation file.
--在GG的根目錄運行edit 命令創建參數文件,前面必須加./,因為GLOBALS文件必須放在GG 安裝的根目錄下面。
2. In the file, enter the GLOBALSparameters, one per line.
3. Save the file. If you used a texteditor, save the file as GLOBALS (uppercase, without a file extension) at theroot of the Oracle GoldenGate installation directory. If you created the filecorrectly in GGSCI, the file is saved that way automatically. Do not move thisfile.
4. Exit GGSCI. You must start from a newGGSCI session before issuing commands or starting processes that reference theGLOBALS file.
1.2 Overview of runtime parameters
Runtimeparameters give you control over the various aspects of Oracle GoldenGate synchronization,such as:
(1) Data selection, mapping,transformation, and replication
(2) DDL and sequence selection,mapping, and replication (where supported)
(3) Error resolution
(4) Logging
(5) Status and error reporting
(6) System resource usage
(7) Startup and runtime behavior
There can be only one active parameter file for the Manager process or an Extract or Replicatgroup; however, you can use parameters in other files by using the OBEY parameter.
--對每個Manager Process 或者Extract 和Replicat group 只能有一個active 的Parameter file. 但是可以通過OBEY參數使用其他的參數文件。
There are twotypes of parameters: global (not to be confused with GLOBALS parameters) and object-specific:
-- runtime parameters 也有兩種:blobal 和object-specific.
(1) Global parameters apply to alldatabase objects that are specified in a parameter file. Some global parametersaffect process behavior, while others affect such things as memory utilizationand so forth.
--global 參數影響所有參數文件中指定的databaseobject。 一些blobal 參數影響進程的行為,另一些影響內存使用等。
USERID in Figure 4 and Figure 5 is an example of a global parameter.In most cases, a global parameter can appear anywhere in the file before theparameters that specify database objects, such as the TABLE and MAP statementsin Figure 4 and Figure 5.
A global parameter should be listed only once in the file. Whenlisted more than once, only the last instance is active, and all other instancesare ignored.
(2) Object-specific parametersenable you to apply different processing rules for different sets of databaseobjects.
--object-specific 參數允許對不同的databaseobject 設置不同的process rule。
GETINSERTS and IGNOREINSERTS in Figure 5 are examples ofobjectspecific parameters. Each precedes a MAP statement that specifies theobjects to be affected. Object-specific parameters take effect in the orderthat each one is listed in the file.
The following are examples of basicparameter files for Extract and Replicat.
Figure 4 Sample Extractparameter file
EXTRACT capt
USERID ggs, PASSWORD *********
DISCARDFILE /ggs/capt.dsc, PURGE
RMTHOST sysb, MGRPORT 7809
RMTTRAIL /ggs/dirdat/aa
TABLE fin.*;
TABLE sales.*;
Figure 5 Sample Replicatparameter file
REPLICAT deliv
USERID ggs, PASSWORD ****
SOURCEDEFS /ggs/dirdef/defs
DISCARDFILE /ggs/deliv.dsc, PURGE
GETINSERTS
MAP fin.account, TARGET fin.acctab,
COLMAP (account = acct,
balance = bal,
branch = branch);
MAP fin.teller, TARGET fin.telltab,
WHERE (branch = “NY”);
IGNOREINSERTS
MAP fin.teller, TARGET fin.telltab,
WHERE (branch = “LA”);
1.3 Creating a parameter file
To create aparameter file, use the EDIT PARAMS command within the GGSCI user interface (recommended)or use a text editor directly. When you use GGSCI, you are using a standardtext editor, but your parameter file is saved automatically with the correctfile name and in the correct directory.
--可以使用ggsci 或者直接使用text editor創建parameterfile。
The EDIT PARAMScommand launches the following text editors within the GGSCI interface:
(1) Notepad on Microsoft Windowssystems
(2) The vi editor on UNIX and Linuxsystems
NOTE:
You can changethe default editor through the GGSCI interface by using the SET EDITOR command.
--可以使用set editor 命令修改ggsci 默認的editor。
To create a parameter file in GGSCI
1. From the directory where OracleGoldenGate is installed, run GGSCI.
2. In GGSCI, issue the following command toopen the default text editor.
EDIT PARAMS<group name>
Where: <groupname> is either mgr (for the Manager process) or the name of the Extract orReplicat group for which the file is being created. The name of an Extract or Replicatparameter file must match that of the process group.
--這里的group name 必須是我們我們創建的process groupname。
The followingcreates or edits the parameter file for an Extract group named extora.
EDIT PARAMS extora
The following creates or edits theparameter file for the Manager process.
EDIT PARAMS MGR
NOTE:
On Linux, thegroup and parameter file names must be all uppercase or all lowercase. Usage ofmixed case file names result in errors when starting the process.
--在Linux 下,group 和parameterfile name 必須是全部的大寫或者全部的小謝,不能混合使用,否則會報錯。
3. Using the editing functions of theeditor, enter as many comment lines as you want to describe this file, makingcertain that each comment line is preceded with two hyphens (--).
--注釋使用- -表示。
4. On non-commented lines, enter the OracleGoldenGate parameters, starting a new line for each parameter statement.
Oracle GoldenGate parameters have thefollowing syntax:
<PARAMETER> <argument> [,<option>] [&]
Where:
. <PARAMETER> is the name of theparameter.
. <argument> is a required argumentfor the parameter. Some parameters take arguments, but others do not. Separateall arguments with commas, as in the following example:
USERID ggs, PASSWORDAACAAAAAAAAAAAIALCKDZIRHOJBHOJUH, &ENCRYPTKEY superx128
RMTHOST sysb, MGRPORT 8040
RMTTRAIL /home/ggs/dirdat/c1, PURGE
. [, <option>] is an optionalargument.
. [&] is required at the end of eachline in a multi-line parameter statement, as in the
USERID parameter statement in the previousexample.
5. Save and close the file.
1.4 Storing parameter files
When you createa parameter file with EDIT PARAMS in GGSCI, it is saved to the dirprmsubdirectory of the Oracle GoldenGate directory. You can create a parameterfile in a directory other than dirprm by specifying the full path name, but youalso must specify the full path name with the PARAMS option of the ADD EXTRACTor ADD REPLICAT command when you create the process group.
--當創建了parameter 文件之后,該文件保存在GG 根目錄的dirprm子目錄,可以在創建文件時指定參數文件的全路徑,從而指定在其他位置。
Once paired withan Extract or Replicat group, a parameter file must remain in its original locationfor Oracle GoldenGate to operate properly once processing has started.
--在相關的進程啟動之后,參數文件就不能改變位置。
1.5 Verifying a parameter file
You can checkthe syntax of parameters in an Extract or Replicat parameter file for accuracy.This feature is not available for other Oracle GoldenGate processes.
可以通過參數驗證Extrace 和Replicat 參數事都正確,該特性只對以上2組進程有效。
To verify parameter syntax:
1. Include the CHECKPARAMSparameter in the parameter file.
--在參數文件里添加CHECKPARAMS 參數
2. Start the associated process by issuingthe START EXTRACT or START REPLICAT command in GGSCI.
START {EXTRACT |REPLICAT} <group name>
Oracle GoldenGate audits the syntax and writes the results to the report file or tothe screen. Then the process stops.
--然后啟動進程,如果有錯誤,會將結果輸出到screen,然后停止進程。
3. Do either of the following:
(1) If the syntax is correct, removethe CHECKPARAMS parameter before starting the process to process data.
--如果正確,從參數文件中移除該參數。
(2) If the syntax is wrong, correct itbased on the findings in the report. You can run another test to verify thechanges, if desired. Remove CHECKPARAMS before starting the process to processdata.
--如果報錯可以根據提示進行處理。
1.6 Viewing a parameter file
You can view aparameter file directly from the command shell of the operating system, or youcan view it from the GGSCI user interface. To view the file from GGSCI, use theVIEW PARAMS command.
VIEW PARAMS<group name>
Where: <groupname> is either mgr (for Manager) or the name of the Extract or Replicat groupthat is associated with the parameter file.
--可以通過view 命令查看進程的參數。
If the parameterfile was created in a location other than the dirprm sub-directory of the OracleGoldenGate directory, specify the full path name as shown in the followingexample.
VIEW PARAMSc:\lpparms\replp.prm
--如果文件沒有放在默認的目錄,則指定文件的全路徑。
1.7 Changing a parameter file
An OracleGoldenGate process must be stopped before editing the parameter file, and then startedagain after saving the parameter file. Changing parameter settings while aprocess is running can have unpredictable and adverse consequences, especiallyif you are adding tables or changing mapping or filtering rules.
--必須停止進程之后才能修改參數文件。 如果在進程運行時修改參數文件可能導致不可預知的錯誤。
To change parameters
1. Stop the process by using the followingcommand in GGSCI, unless you want to stop Manager in a Windows cluster; in thatcase, Manager must be stopped by using the Cluster Administrator.
STOP {EXTRACT |REPLICAT | MANAGER} <group name>
2. Open the parameter file by using a texteditor or the EDIT PARAMS command in GGSCI.
EDIT PARAMS mgr
3. Make the edits, and then save the file.
4. Start the process (use the ClusterAdministrator if starting Manager in a Windows
cluster).
START {EXTRACT |REPLICAT | MANAGER} <group name>
1.8 Simplifying the creation of parameter files
OracleGoldenGate provides tools that reduce the number of times that a parameter mustbe specified.
--GG 提供工具來減少指定參數的次數。
(1) Wildcards
(2) The OBEY parameter
(3) Macros
(4) Parameter substitution
Using wildcards
For parametersthat accept object names, you can use an asterisk (*) wildcard to match any numberof characters. Owner names, if used, cannot be specified with wildcards. Theuse of wildcards reduces the work of specifying numerous object names or allobjects within a given schema.
--可以使用*通配符來匹配對象。
Using OBEY
You can create alibrary of text files that contain frequently used parameter settings, and thenyou can call any of those files from the active parameter file by means of theOBEY parameter. The syntax for OBEY is:
OBEY <filename>
Where: <filename> is the relative or full path name of the file.
--可以創建一個文件包含常用的參數設置,可以在active parameter 的情況下通過OBEY來調用其他的參數。
Uponencountering an OBEY parameter in the active parameter file, Oracle GoldenGate processesthe parameters from the referenced file and then returns to the active file to processany remaining parameters.
Using macros
You can use macros to automate multipleuses of a parameter statement.
Using parameter substitution
You can useparameter substitution to assign values to Oracle GoldenGate parameters automaticallyat run time, instead of assigning static values when you create the parameterfile. That way, if values change from run to run, you can avoid having to edit theparameter file or maintain multiple files with different settings. You cansimply export the required value at runtime. Parameter substitution can be usedfor any Oracle GoldenGate process.
--使用動態參數代替靜態參數
To use parameter substitution
1. For each parameter for whichsubstitution is to occur, declare a runtime parameter instead of a value,preceding the runtime parameter name with a question mark (?) as shown in thefollowing example.
--在原參數文件中, 在動態參數之前加上?
SOURCEISFILE
EXTFILE ?EXTFILE
MAP ? TABNAME,TARGET account_targ;
2. Before starting the OracleGoldenGate process, use the shell of the operating system to pass the runtimevalues by means of an environment variable, as shown in Figure 6 and Figure 7.
--- 在運行進程之前,先指定動態參數值,在運行,示例如下:
Figure 6 Parameter substitution on Windows
C:\GGS> set EXTFILE=C:\ggs\extfile
C:\GGS> set TABNAME=prod.accounts
C:\GGS> replicat paramfilec:\ggs\dirprm\parmfl
Figure 7 Parameter substitution on UNIX(Korn shell)
$ EXTFILE=/ggs/extfile
$ export EXTFILE
$ TABNAME=prod.accounts
$ export TABNAME
$ replicat paramfile c:\ggs\dirprm\parmfl
UNIX is case-sensitive, so the parameterdeclaration in the parameter file must be the
same case as the shell variableassignments.
二.具體GG 參數分類說明
GG的參數分為如下幾類:
(1)GLOBALS parameters
(2)Manager parameters
(3)Extract parameters
(4)Replicat parameters
(5)DEFGEN parameters
2.1 GLOBALS parameters
The GLOBALS filestores parameters that relate to the Oracle GoldenGate instance as a whole, asopposed to runtime parameters for a specific process.

2.2 Manager parameters summary
Manager is theparent process of Oracle GoldenGate and is responsible for the management ofits processes, resources, user interface, and the reporting of thresholds and errors.In most cases default settings for Manager suffice.
--大多數情況下Manager 的默認參數是足夠的。




2.3 Extract parameters summary
The Extractprocess captures either full data records or transactional data changes, dependingon configuration parameters, and then sends the data to a target system to be appliedto target tables or processed further by another process, such as a loadutility.









2.4 Replicat parameters summary
The Replicatprocess reads data extracted by the Extract process and applies it to target tablesor prepares it for use by another application, such as a load utility.







2.5 DEFGEN parameters summary
DEFGEN creates afile with data definitions for source or target tables. Data definitions are neededwhen the source and target tables have different definitions or the databasesare of different types.

2.6 DDL parameters summary
These parameterscontrol Oracle GoldenGate DDL support. Other parameters may be required withDDL support, but the ones here deal specifically with the DDL feature.


三.示例
3.1 Source System
ADD EXTRACT <ext>, TRANLOG, BEGIN<time>, [, THREADS]
ADD EXTTRAIL <local_trail>, EXTRACT<ext>
EDIT PARAMS <ext>
-- Identify the Extract group:
EXTRACT <ext>
-- Specify database login information asneeded for the database:
[SOURCEDB <dsn_1>,][USERID<user>[, PASSWORD <pw>]]
-- Specify the local trail that thisExtract writes to:
EXTTRAIL <local_trail>
-- Specify tables to be captured:
TABLE <owner>.<table>;
ADD EXTRACT <pump_1>, EXTTRAILSOURCE<local_trail>, BEGIN <time>
ADD RMTTRAIL <remote_trail_1>,EXTRACT <pump_1>
EDIT PARAMS <pump_1>
-- Identify the data pump group:
EXTRACT <pump_1>
-- Specify database login information asneeded for the database:
[SOURCEDB <dsn_1>,][USERID<user>[, PASSWORD <pw>]]
-- Specify the name or IP address of thefirst target system:
RMTHOST <target_1>, MGRPORT<portnumber>
-- Specify the remote trail on the firsttarget system:
RMTTRAIL <remote_trail_1>
-- Allow mapping, filtering, conversion orpass data through as-is:
[PASSTHRU | NOPASSTHRU]
-- Specify tables to be captured:
TABLE <owner>.<table>;
示例:
add extract extl,tranlog,begin now
ADD EXTTRAIL /u01/ogg/dirdat/rl, EXTRACTEXTL
ADD TRANDATA dave.objce_t
edit params extl
extract extl
SETENV (NLS_LANG ="AMERICAN_AMERICA.ZHS16GBK")
userid ogg,password ogg
exttrail /u01/ogg/dirdat/rl
dynamicresolution
gettruncates
table dave.table;
ADD EXTRACT pump1, EXTTRAILSOURCE/u01/ogg/dirdat/rl, BEGIN now
add rmttrail /u01/ogg/dirdat/rl extractpump1
edit params pump1
extract pump1
SETENV (NLS_LANG ="AMERICAN_AMERICA.ZHS16GBK")
userid ogg, password ogg
rmthost 192.168.1.111, mgrport 7809
rmttrail /u01/ogg/dirdat/rl
PASSTHRU
gettruncates
table dave.table;
3.2 Target System
edit params ./GLOBALS
CHECKPOINTTABLE<owner>.<tablename>
ADD REPLICAT <rep_1>, EXTTRAIL<remote_trail_1>, BEGIN <time> checkpointtable<owner>.<tablename>
edit params <rep_1>
-- Identify the Replicat group:
REPLICAT <rep_1>
-- State whether or not source and targetdefinitions are identical:
SOURCEDEFS <full_pathname> |ASSUMETARGETDEFS
-- Specify database login information asneeded for the database:
[TARGETDB <dsn_3>,] [USERID <userid>[, PASSWORD <pw>]]
-- Specify error handling rules:
REPERROR (<error>, <response>)
-- Specify tables for delivery:
MAP <owner>.<table>, TARGET<owner>.<table>[, DEF <template name>];
示例:
edit params ./GLOBALS
CHECKPOINTTABLE ogg.chkpoint
ADD CHECKPOINTTABLE ogg.chkpoint
add replicat repl exttrail/u01/ogg/dirdat/rl,begin now,checkpointtable ogg.chkpoint
edit repl
replicat repl
SETENV (NLS_LANG ="AMERICAN_AMERICA.ZHS16GBK")
userid ogg,password ogg
assumetargetdefs
reperror default,discard
discardfile /tmp/repsz.dsc,append,megabytes100
gettruncates
map dave.table, target dave.table;