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.
--大多數(shù)GG 功能都是受指定的參數(shù)控制,這個(gè)參數(shù)文件是一個(gè)ASCII 文件。
OracleGoldenGate uses two types of parameter files: a GLOBALS file and runtimeparameter files.
--GG 使用兩種類型的參數(shù)文件: GLOBALS 和 runtime parameter。
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 文件里保存的參數(shù)爭對(duì)整個(gè)GG instance,該參數(shù)可以被指定的進(jìn)程參數(shù)覆蓋,一般來說,GLOBALS參數(shù)一旦指定,很少修改。
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 參數(shù)文件僅當(dāng)某些情況下才會(huì)使用,在使用時(shí),必須在啟動(dòng)GG進(jìn)程之前創(chuàng)建該參數(shù)文件。
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的根目錄運(yùn)行edit 命令創(chuàng)建參數(shù)文件,前面必須加./,因?yàn)镚LOBALS文件必須放在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.
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.
--對(duì)每個(gè)Manager Process 或者Extract 和Replicat group 只能有一個(gè)active 的Parameter file. 但是可以通過OBEY參數(shù)使用其他的參數(shù)文件。
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 參數(shù)影響所有參數(shù)文件中指定的databaseobject。 一些blobal 參數(shù)影響進(jìn)程的行為,另一些影響內(nèi)存使用等。
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 參數(shù)允許對(duì)不同的databaseobject 設(shè)置不同的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”);
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創(chuàng)建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 默認(rèn)的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 必須是我們我們創(chuàng)建的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 必須是全部的大寫或者全部的小謝,不能混合使用,否則會(huì)報(bào)錯(cuò)。
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.
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.
--當(dāng)創(chuàng)建了parameter 文件之后,該文件保存在GG 根目錄的dirprm子目錄,可以在創(chuàng)建文件時(shí)指定參數(shù)文件的全路徑,從而指定在其他位置。
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.
--在相關(guān)的進(jìn)程啟動(dòng)之后,參數(shù)文件就不能改變位置。
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.
可以通過參數(shù)驗(yàn)證Extrace 和Replicat 參數(shù)事都正確,該特性只對(duì)以上2組進(jìn)程有效。
To verify parameter syntax:
1. Include the CHECKPARAMSparameter in the parameter file.
--在參數(shù)文件里添加CHECKPARAMS 參數(shù)
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.
--然后啟動(dòng)進(jìn)程,如果有錯(cuò)誤,會(huì)將結(jié)果輸出到screen,然后停止進(jìn)程。
3. Do either of the following:
(1) If the syntax is correct, removethe CHECKPARAMS parameter before starting the process to process data.
--如果正確,從參數(shù)文件中移除該參數(shù)。
(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.
--如果報(bào)錯(cuò)可以根據(jù)提示進(jìn)行處理。
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 命令查看進(jìn)程的參數(shù)。
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
--如果文件沒有放在默認(rèn)的目錄,則指定文件的全路徑。
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.
--必須停止進(jìn)程之后才能修改參數(shù)文件。 如果在進(jìn)程運(yùn)行時(shí)修改參數(shù)文件可能導(dǎo)致不可預(yù)知的錯(cuò)誤。
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>
OracleGoldenGate provides tools that reduce the number of times that a parameter mustbe specified.
--GG 提供工具來減少指定參數(shù)的次數(shù)。
(1) Wildcards
(2) The OBEY parameter
(3) Macros
(4) Parameter substitution
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.
--可以使用*通配符來匹配對(duì)象。
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.
--可以創(chuàng)建一個(gè)文件包含常用的參數(shù)設(shè)置,可以在active parameter 的情況下通過OBEY來調(diào)用其他的參數(shù)。
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.
--使用動(dòng)態(tài)參數(shù)代替靜態(tài)參數(shù)
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.
--在原參數(shù)文件中, 在動(dòng)態(tài)參數(shù)之前加上?
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.
--- 在運(yùn)行進(jìn)程之前,先指定動(dòng)態(tài)參數(shù)值,在運(yùn)行,示例如下:
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的參數(shù)分為如下幾類:
(1)GLOBALS parameters
(2)Manager parameters
(3)Extract parameters
(4)Replicat parameters
(5)DEFGEN parameters
The GLOBALS filestores parameters that relate to the Oracle GoldenGate instance as a whole, asopposed to runtime parameters for a specific process.
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.
--大多數(shù)情況下Manager 的默認(rèn)參數(shù)是足夠的。
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.
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.
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.
These parameterscontrol Oracle GoldenGate DDL support. Other parameters may be required withDDL support, but the ones here deal specifically with the DDL feature.
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;
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;
聯(lián)系客服