Oracle Golden Gate 系列八 -- GG 参数文件 说明

 

一.官网有关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 的默认参数是足够的。

 Oracle Golden Gate 系列八 -- GG 参数文件 说明_第1张图片

Oracle Golden Gate 系列八 -- GG 参数文件 说明_第2张图片



 

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.

 

Oracle Golden Gate 系列八 -- GG 参数文件 说明_第3张图片

Oracle Golden Gate 系列八 -- GG 参数文件 说明_第4张图片

Oracle Golden Gate 系列八 -- GG 参数文件 说明_第5张图片

Oracle Golden Gate 系列八 -- GG 参数文件 说明_第6张图片

Oracle Golden Gate 系列八 -- GG 参数文件 说明_第7张图片

Oracle Golden Gate 系列八 -- GG 参数文件 说明_第8张图片





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.

 Oracle Golden Gate 系列八 -- GG 参数文件 说明_第9张图片

Oracle Golden Gate 系列八 -- GG 参数文件 说明_第10张图片



Oracle Golden Gate 系列八 -- GG 参数文件 说明_第11张图片


Oracle Golden Gate 系列八 -- GG 参数文件 说明_第12张图片

  

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.

 Oracle Golden Gate 系列八 -- GG 参数文件 说明_第13张图片

Oracle Golden Gate 系列八 -- GG 参数文件 说明_第14张图片


三.示例

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;

 

 

 

 

 

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

版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!

Blog:     http://blog.csdn.net/tianlesoftware

Weibo: http://weibo.com/tianlesoftware

Email:   [email protected]

Skype: tianlesoftware

 

-------加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请----

DBA1 群:62697716(满);   DBA2 群:62697977(满)  DBA3 群:62697850(满)  

DBA 超级群:63306533(满);  DBA4 群:83829929(满) DBA5群: 142216823(满) 

DBA6 群:158654907(满)   DBA7 群:69087192(满)  DBA8 群:172855474

DBA 超级群2:151508914  DBA9群:102954821     聊天 群:40132017(满)

你可能感兴趣的:(oracle,manager,File,command,database,Parameters)