我是靠谱客的博主 香蕉茉莉,最近开发中收集的这篇文章主要介绍【ogg Administering Oracle GoldenGate】4 Getting Started with the Oracle GoldenGate Process Interfaces4 Getting Started with the Oracle GoldenGate Process Interfaces,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

4 Getting Started with the Oracle GoldenGate Process Interfaces

本章描述了Oracle GoldenGate用户如何通过GGSCI (Oracle GoldenGate Software Command Interface)、批处理和shell脚本以及参数文件向进程提供指令。

Topics:

4.1 Using the GGSCI Command-line Interface

You can use GGSCI to issue the complete range of commands that configure, control, and monitor Oracle GoldenGate along with administering secure and non-secured deployments.

GGSCI is the Oracle GoldenGate command-line interface. To start GGSCI, change directories to the Oracle GoldenGate installation directory, and then run the ggsci executable file.

4.1.1 Using Wildcards in Command Arguments

您可以将通配符与某些Oracle GoldenGate命令一起使用,以将多个提取组和副本组控制为一个单元。由Oracle GoldenGate支持的通配符是星号(*)。星号表示任意数量的字符。例如,要启动名称包含字母X的所有提取组,请发出以下命令。

START EXTRACT *X*

4.1.2 Globalization Support for the Command Interface

所有命令输入和相关控制台输出都在本地操作系统的默认字符集中呈现。要指定与本地操作系统的字符集不兼容的字符,请使用Unicode表示法。例如,下面的Unicode表示法等价于以欧元符号作为名称的表的名称:

ADD TRANDATA u20AC1

For more information, see Support for Escape Sequences for more information about using Unicode notation.

Note:

Oracle GoldenGate group names are case-insensitive.

4.1.3 Using Command History

使用以下工具可以更容易地执行多个命令:

  • Use the HISTORY command to display a list of previously executed commands.

  • Use the ! command to 再次执行前面的命令without editing it.

  • Use the FC command to edit a previous command and then execute it again.

4.1.4 Storing and Calling Frequently Used Command Sequences

通过使用OBEY文件和OBEY命令,您可以自动化一系列常用的命令。OBEY文件采用本地操作系统的字符集。若要指定与该字符集不兼容的字符,请使用Unicode表示法。See Support for Escape Sequences for more information about using Unicode notation.

To use OBEY

  1. 创建并保存包含命令的文本文件,每行一个命令。这是你的服从文件。该名称可以是操作系统支持的任何名称。您可以将其他OBEY文件嵌套在一个OBEY文件中。
  2. Run GGSCI.
  3. (Optional)如果使用包含嵌套的遵从文件的遵从文件,发出以下命令。该命令允许在当前的GGSCI会话中使用嵌套的OBEY文件,并且在使用嵌套的OBEY文件时都是必需的。See Reference for Oracle GoldenGate for more information.
    ALLOWNESTED
    
  4. In GGSCI, call the OBEY file by using the OBEY command.
    OBEY file_name
    

    Where:

    file_name is the relative or fully qualified name of the OBEY file.

Example 4-1 OBEY command file

ADD EXTRACT myext, TRANLOG, BEGIN now
START EXTRACT myext

ADD REPLICAT myrep, EXTTRAIL /ggs/dirdat/aa
START REPLICAT myrep

INFO EXTRACT myext, DETAIL
INFO REPLICAT myrep, DETAIL

下面的示例演示了与OBEY命令一起使用的OBEY命令文件。它创建并开始提取和复制组并检索处理信息。

See Reference for Oracle GoldenGate for more information about the OBEY command.

4.2 Controlling Oracle GoldenGate Processes

控制Oracle GoldenGate进程的标准方法是通过GGSCI接口。通常,在产品设置中首次启动Oracle GoldenGate进程是在初始同步过程(也称为实例化过程)期间。However, you will need to stop and start the processes at various points as needed to perform maintenance, upgrades, troubleshooting, or other tasks.

These instructions show basic syntax. Additional syntax may be available and is documented in Reference for Oracle GoldenGate.

4.2.1 Controlling Manager

Manager should not be stopped unless you want to stop replication processing.

To Stop Manager

  1. From the Oracle GoldenGate directory, run GGSCI.
  2. In GGSCI, issue the following command.

    {START | STOP [!]} MANAGER

    Where:

    The ! bypasses the prompt that confirms the intent to shut down Manager.

Note:

When starting Manager from the command line or GGSCI with User Account Control enabled, you will receive a UAC prompt requesting you to allow or deny the program to run.

4.2.2 Controlling Extract and Replicat

This section contains basic directions for controlling Extract and Replicat processes. See Reference for Oracle GoldenGate for additional command options.

To Start Extract or Replicat

START {EXTRACT | REPLICAT} group_name

Where:

group_name is the name of the Extract or Replicat group or a wildcard set of groups (for example, * or fin*).

To Stop Extract or Replicat Gracefully

STOP {EXTRACT | REPLICAT} group_name

Where:

group_name is the name of the Extract or Replicat group or a wildcard set of groups (for example, * or fin*).

To Stop Replicat Forcefully

STOP REPLICAT group_name !

The current transaction is aborted and the process stops immediately. You cannot stop Extract forcefully.

To Kill a Process that STOP Cannot Stop

KILL {EXTRACT | REPLICAT} group_name

Killing a process does not shut it down gracefully, and checkpoint information can be lost.

To Control Multiple Processes at Once

command ER wildcard specification

Where:

  • command is: KILLSTART, or STOP

  • wildcard specification is a wildcard specification for the names of the process groups that you want to affect with the command. The command affects every Extract and Replicat group that satisfies the wildcard. Oracle GoldenGate supports up to 100,000 wildcard entries.

4.2.3 Deleting Extract and Replicat

This section contains basic directions for deleting Extract and Replicat processes. See Reference for Oracle GoldenGate for additional command options.

To Delete an Extract Group

  1. Run GGSCI.

  2. Issue the DBLOGIN command as the Extract database user (or a user with the same privileges). You can use either of the following commands, depending on whether a local credential store exists.

    DBLOGIN [SOURCEDB dsn] {USERID user, PASSWORD password [encryption_options] | USERIDALIAS alias [DOMAIN domain]}
    
  3. Stop the Extract process.

    STOP EXTRACT group_name

  4. Issue the following command.

    DELETE EXTRACT group_name

  5. (Oracle) Unregister the Extract group from the database.

    UNREGISTER EXTRACT group_name,database_name
    

To Delete a Replicat Group

  1. Stop the Replicat process.

    STOP REPLICAT group_name

  2. Issue one of the following commands from GGSCI to log into the database.
    DBLOGIN [SOURCEDB dsn] {USERID user, PASSWORD password [encryption_options] | USERIDALIAS alias [DOMAIN domain]}
    

    Where:

    • SOURCEDB dsn supplies the data source name, if required as part of the connection information.

    • USERID userPASSWORD password specifies an explicit database login credential.

    • USERIDALIAS alias [DOMAIN domain] specifies an alias and optional domain of a credential that is stored in a local credential store.

    • encryption_options is one of the options that encrypt the password.

  3. Issue the following command to delete the group.

    DELETE REPLICAT group_name

Deleting a Replicat group preserves the checkpoints in the checkpoint table (if being used). Deleting a process group also preserves the parameter file. You can create the same group again, using the same parameter file, or you can delete the parameter file to remove the group's configuration permanently.

4.3 Automating Commands

Oracle GoldenGate支持通过脚本或作业发出命令。本节介绍UNIX或linux平台和IBMi平台的这些选项。

在UNIX或Linux系统上,或者在支持UNIX或Linux应用程序的运行时环境中,您可以通过运行GGSCI并调用输入文件,从脚本(如启动脚本、关闭脚本或故障转移脚本)发出Oracle GoldenGate命令。脚本文件必须在操作系统字符集中进行编码。Unicode表示法可用于操作系统字符集不支持的字符。 Before creating a script, see Globalization Support for the Command Interface.

To Input a Script

在操作系统的命令行中使用以下语法。

ggsci < input_file

Where:

  • The angle bracket (<) character pipes the file into the GGSCI program.

  • input_file is a text file, known as an OBEY file, containing the commands that you want to issue, in the order they are to be issued.

For detailed documentation of Oracle GoldenGate commands, see Reference for Oracle GoldenGate.

Note:

To stop the Manager process from a batch file, make certain to add the ! argument to the end of the STOP MANAGER command. Otherwise, GGSCI issues a prompt that requires a response and causes the process to enter into a loop. See Stopping Manager for more information about stopping Manager.

4.3.1 Issuing Commands Through the IBM i CLI

Oracle GoldenGate for IBM DB2 for i includes a set of native IBM i commands that enables the operation of the most common Oracle GoldenGate programs from the IBM i command-line interface (CLI). Because these commands are native, they do not need to be run from a PASE environment. With this support, it is possible to issue commands interactively or by using the typical job submission tools such as SBMJOB to operate Oracle GoldenGate non-interactively.

The commands are as follows and correspond to the Oracle GoldenGate programs of the same name. They reside in the Oracle GoldenGate installation library.

DEFGEN

EXTRACT

GGSCI

KEYGEN

LOGDUMP

MGR

REPLICAT

For more information about these commands, see Reference for Oracle GoldenGate for Windows and UNIX.

4.4 Using Oracle GoldenGate Parameter Files

Most Oracle GoldenGate functionality is controlled by means of parameters specified in parameter files. A parameter file is a plain text file that is read by an associated Oracle GoldenGate process. Oracle GoldenGate uses two types of parameter files: a GLOBALS file and runtime parameter files.

4.4.1 Globalization Support for Parameter Files

Oracle GoldenGate creates parameter files in the default character set of the local operating system. In the event that the local platform does not support a required character set as the default in the operating system, you can use the CHARSET parameter either globally or per-process to specify a character set for parameter files.

To avoid issues caused by character-set incompatibilities, create or edit a parameter file on the server where the associated process will be running. Avoid creating it on one system (such as your Windows laptop) and then transferring the file to the UNIX server where Oracle GoldenGate is installed and where the operating system character set is different. Oracle GoldenGate provides some tools to help with character set incompatibilities if you must create the parameter file on a different system:

  • You can use the CHARSET parameter to specify a compatible character set for the parameter file. This parameter must be placed on the first line of the parameter file and allows you to write the file in the specified character set. After the file is transferred to the other system, do not edit the file on that system.

  • You can use Unicode notation to substitute for characters that are not compatible with the character set of the operating system where the file will be used. See Support for Escape Sequences for more information about Unicode notation.

See Reference for Oracle GoldenGate for more information about the CHARSET parameter.

4.4.2 Working with the GLOBALS File

The GLOBALS file stores parameters that relate to the Oracle GoldenGate instance as a whole. This is in contrast to runtime parameters, which are coupled with a specific process such as Extract. The parameters in the GLOBALS file apply to all processes in the Oracle GoldenGate instance, but can be overridden by specific process parameters. A GLOBALS parameter file may or may not be required for your Oracle GoldenGate environment.

When used, a GLOBALS file must exist before starting any Oracle GoldenGate processes, including GGSCI. The GGSCI program reads the GLOBALS file and passes the parameters to processes that need them.

To Create a GLOBALS File

  1. From the Oracle GoldenGate installation location, run GGSCI and enter the following command, or open a file in a text editor.
    EDIT PARAMS ./GLOBALS
    

    Note:

    The ./ portion of this command must be used, because the GLOBALS file must reside at the root of the Oracle GoldenGate installation file.

  2. In the file, enter the GLOBALS parameters, one per line.
  3. Save the file. If you used a text editor, save the file as GLOBALS (uppercase, without a file extension) at the root of the Oracle GoldenGate installation directory. If you created the file correctly in GGSCI, the file is saved that way automatically. Do not move this file.
  4. Exit GGSCI. You must start from a new GGSCI session before issuing commands or starting processes that reference the GLOBALSfile.

4.4.3 Working with Runtime Parameters

Runtime parameters give you control over the various aspects of Oracle GoldenGate synchronization, such as:

  • Data selection, mapping, transformation, and replication

  • DDL and sequence selection, mapping, and replication (where supported)

  • Error resolution

  • Logging

  • Status and error reporting

  • System resource usage

  • Startup and runtime behavior

There can be only one active parameter file for the Manager process or an Extract or Replicat group; however, you can use parameters in other files by using the OBEY parameter. See Simplifying the Creation of Parameter Files for more information about simplifying the use of parameter files.

There are two types of parameters: global (not to be confused with GLOBALS parameters) and object-specific:

  • Global parameters apply to all database objects that are specified in a parameter file. Some global parameters affect process behavior, while others affect such things as memory utilization and so forth. USERIDALIAS in Example 4-2 and Example 4-3 is an example of a global parameter. In most cases, a global parameter can appear anywhere in the file before the parameters that specify database objects, such as the TABLE and MAP statements in Example 4-2 and Example 4-3. A global parameter should be listed only once in the file. When listed more than once, only the last instance is active, and all other instances are ignored.

  • Object-specific parameters enable you to apply different processing rules for different sets of database objects. GETINSERTS and IGNOREINSERTS in Example 4-3 are examples of object-specific parameters. Each precedes a MAP statement that specifies the objects to be affected. Object-specific parameters take effect in the order that each one is listed in the file.

Example 4-2 and Example 4-3 are examples of basic parameter files for Extract and Replicat. Comments are preceded by double hyphens.

The preceding example reflects a case-insensitive Oracle database, where the object names are specified in the TABLE statements in capitals. For a case-insensitive Oracle database, it makes no difference how the names are entered in the parameter file (upper, lower, mixed case). For other databases, the case of the object names may matter. See Specifying Object Names in Oracle GoldenGate Input for more information about specifying object names.

注意,在示例4-3中的Replicat示例中使用了单引号和双引号。对于需要使用引号来强制区分大小写的对象名的数据库(如Oracle),还必须在参数文件中使用双引号将区分大小写的对象名括起来。 对于其他大小写敏感的数据库,指定存储在数据库中的名称。For more information about specifying names and literals, see Specifying Object Names in Oracle GoldenGate Input.

Example 4-2 Sample Extract Parameter File

-- Extract group name
EXTRACT capt
-- Extract database user login, with alias to credentials in the credential store.
USERIDALIAS ogg1
-- Remote host to where captured data is sent in encrypted format:
RMTHOSTOPTIONS sysb, MGRPORT 7809, ENCRYPT AES192 KEYNAME mykey
-- Encryption specification for trail data
ENCRYPTTRAIL AES192
-- Remote trail on the remote host
RMTTRAIL /ggs/dirdat/aa
-- TABLE statements that identify data to capture.
TABLE FIN.*;
TABLE SALES.*;

Example 4-3 Sample Replicat Parameter File

-- Replicat group name
REPLICAT deliv
-- Replicat database user login, with alias to credentials in the credential store
USERIDALIAS ogg2
-- Error handling rules
REPERROR DEFAULT, ABEND
-- Ignore INSERT operations
IGNOREINSERTS
-- MAP statement to map source objects to target objects and
-- specify column mapping
MAP "fin"."accTAB", TARGET "fin"."accTAB",
COLMAP ("Account" = "Acct",
"Balance" = "Bal",
"Branch" = "Branch");
-- Get INSERT operations
GETINSERTS
-- MAP statement to map source objects to target objects and
-- filter to apply only the 'NY' branch data.
MAP "fin"."teller", TARGET "fin"."tellTAB",
WHERE ("Branch" = 'NY');

4.4.4 Creating a Parameter File

Oracle建议在操作系统的字符集中写入参数文件时使用GGSCI,但是如果使用CHARSETparameter并在不同的字符集中写入文件,则使用文本编辑器而不是GGSCI。See Reference for Oracle GoldenGate for more information about the CHARSET parameter.

Creating a Parameter File in GGSCI

Creating a Parameter File with a Text Editor

4.4.4.1 Creating a Parameter File in GGSCI

To create a parameter file, use the EDIT PARAMS command within the GGSCI user interface or use a text editor directly. When you use GGSCI, you are using a standard text editor, but your parameter file is saved automatically with the correct file name and in the correct directory.

When you create a parameter file with EDIT PARAMS in GGSCI, it is saved to the dirprm sub-directory of the Oracle GoldenGate directory. You can create a parameter file in a directory other than dirprm, but you also must specify the full path name with the PARAMS option of the ADD EXTRACT or ADD REPLICAT command when you create your process groups. Once paired with an Extract or Replicat group, a parameter file must remain in its original location for Oracle GoldenGate to operate properly once processing has started.

The EDIT PARAMS command launches the following text editors within the GGSCI interface:

  • Notepad on Microsoft Windows systems

  • The vi editor on UNIX and Linux systems. DB2 for i only supports vi when connected with SSH or xterm. For more information, see Creating a Parameter File with a Text Editor.

    Note:

    You can change the default editor through the GGSCI interface by using the SET EDITOR command. See Reference for Oracle GoldenGate.

  1. From the directory where Oracle GoldenGate is installed, run GGSCI.
  2. In GGSCI, issue the following command to open the default text editor.
    EDIT PARAMS group_name
    

    Where:

    group_name is either mgr (for the Manager process) or the name of the Extract or Replicat group for which the file is being created. The name of an Extract or Replicat parameter file must match that of the process group.

    The following creates or edits the parameter file for an Extract group named extora.

    EDIT PARAMS extora
    

    The following creates or edits the parameter file for the Manager process.

    EDIT PARAMS MGR
    
  3. Using the editing functions of the text editor, enter as many comment lines as you want to describe this file, making certain that each comment line is preceded with two hyphens (--).
  4. On non-commented lines, enter the Oracle GoldenGate parameters, starting a new line for each parameter statement.

    Oracle GoldenGate parameters have the following syntax:

    PARAMETER_NAME argument [, option] [&]
    

    Where:

    • PARAMETER_NAME is the name of the parameter.

    • argument is a required argument for the parameter. Some parameters take arguments, but others do not. Commas between arguments are optional.

      EXTRACT myext
      USERIDALIAS ogg1
      RMTHOSTOPTIONS sysb, MGRPORT 8040, ENCRYPT AES192 KEYNAME mykey
      ENCRYPTTRAIL AES 192
      RMTTRAIL /home/ggs/dirdat/c1, PURGE
      CUSEREXIT userexit.dll MyUserExit, INCLUDEUPDATEBEFORES, &
        PARAMS "init.properties"
      TABLE myschema.mytable;
      
    • [, option] is an optional argument.

    • [&] 在多行参数语句中,在每一行的末尾都需要,就像前面示例中的CUSEREXIT参数语句一样。例外情况如下,可以接受,但不需要,因为与号以分号结束:

      • MAP

      • TABLE

      • SEQUENCE

      • FILE

      • QUERY

    Note:

    RMTHOST和RMTHOSTOPTIONS参数可以一起指定;如果正确配置了动态IP分配,则RMTHOST参数对于RMTHOSTOPTIONS是不需要的。当使用RMTHOSTOPTIONS时,MGRPORToption将被忽略。

  5. Save and close the file.

4.4.4.2 Creating a Parameter File with a Text Editor

You can create a parameter file outside GGSCI by using a text editor, but make certain to:

  • Save the parameter file with the name of the Extract or Replicat group that owns it, or save it with the name mgr if the Manager process owns it. Use the .prm file extension. For example: extfin.prm and mgr.prm.

  • Save the parameter file in the dirprm directory of the Oracle GoldenGate installation directory.

  • For DB2 for i systems, you can edit parameter files from a 5250 terminal using SEU or EDTF. If you use SEU, you must copy the file using the CPYTOSTMF command, specify an encoding of CCSID 1208, and line endings of *LF. If editing with EDTF from F15 (services) ensure that you change the CCSID of the file to 1208 and the EOL option to *LF.

    Alternatively, you can use the Rfile command from the IBM Portable Application Solutions Environment for i.

4.4.5 Validating a Parameter File

checkprm验证本机命令从命令行运行,并使用可配置的应用程序和运行环境对指定的参数文件进行评估。它可以提供简单的通过/失败,也可以提供关于如何存储和解释每个参数值的可选细节。

checkprm的输入不区分大小写。如果值字符串包含空格,则不需要加引号,因为checkprm可以识别有意义的值。如果没有指定模式来检查prm,则可以接受适用于组件的任何模式的所有参数。

The output of checkprm is assembled with four possible sections:

  • help messages

  • pre-validation error

  • validation result

  • parameter details

A pre-validation error is typically an error that prevents a normal parameter validation from executing, such as missing options or an inaccessible parameter file. If an option value is specified incorrectly, a list of possible inputs for that option is provided. If the result is FAIL, each error is in the final result message. If the result is PASS, a message that some of the parameters are subject to further runtime validation. The parameter detailed output contains the validation context, the values read from GLOBALS (if it is present), and the specified parameters. The parameter and options are printed with proper indentation to illustrate these relationships.

Table 4-1 describes all of the arguments that you can use with the checkprm commands. When you use checkprm and do not use any of these arguments, then checkprm attempts to automatically detect Extract or Replicat and the platform and database of the Oracle GoldenGate installation.

Table 4-1 checkprm Arguments

ArgumentPurpose & Behavior

None

Displays usage information

-v

Displays banner. Cannot be combined with other options.

? | help

Displays detailed usage information, include all possible values of each option. Cannot be combine with other options.

parameter_file

Specifies the name of the parameter file, has to be the first argument if a validation is requested. You must specify the absolute path to the parameter file. For example, CHECKPRM ./dirprm/myext.prm.

-COMPONENT | -C

Specifies the running component (application) that this parameter file is validated for. This option can be omitted for Extract or Replicat because automatic detection is attempted. Valid values include:

CACHEFILEDUMP COBGEN CONVCHK CONVPRM DDLCOB DEFGEN EMSCLNT EXTRACT GGCMD GGSCI KEYGEN LOGDUMP

MGR OGGERR REPLICAT RETRACE

REVERSE SERVER GLOBALS

There is no default for this option.

-MODE | -M

Specifies the mode of the running application if applicable. This option is optional, only applicable to Extract or Replicat. If no mode is specified, the validation is performed for all Extract or Replicat modes.

Valid input of this option includes:

  • Classic Extract

  • Integrated Extract

  • Initial Load Extract

  • Remote Task Extract

  • Data Pump Extract

  • Passive Extract

  • Classic Replicat

  • Coordinated Replicat

  • Integrated Replicat

  • Special Run Replicat

  • Remote Task

  • Replicat All

When key in the value for this option, the application name is optional, as long as it matches the value of component. For example, "Â"Data Pump ExtractÂ" is equivalent to "Â"Data PumpÂ" if the component is Extract. However, it is invalid if the component is Replicat.

-PLATFORM | -P

Specifies the platform the application is supposed to run on. The default value is the platform that this checkprm executable is running on.

The possible values are:

AIX HP-OSS HPUX-IT HPUX-PA

Linux OS400 ZOS Solaris SPARC

Solaris x86 Windows x64 All

-DATABASE | -D

Specifies the database the application is built against. The default value is the database for your Oracle GoldenGate installation.

The database options are:

Generic Oracle 8 Oracle 9i

Oracle 10g Oracle 11g Oracle 12c

DB2LUW 10.5 DB2LUW 10.1 DB2 Remote

Teradata

DB2 for I DB2 for i Remote

-VERBOSE | -V

Directs checkprm to print out detailed parameter information, to demonstrate how the values are read and interpreted.

It must be the last option specified in a validation.

Following are some use examples:

checkprm ?
checkprm  ./dirprm/ext1.prm -C extract -m data pump -p Linux -v
checkprm  ./dirprm/ext1.prm -m integrated
checkprm  ./dirprm/rep1.prm -m integrated
checkprm  ./dirprm/mgr.prm -C mgr -v
checkprm GLOBALS -c GLOBALS

Verifying Using CHECKPARAMS Parameter

An alternative to using the recommended checkprm utility, is to check the syntax of parameters in an Extract or Replicat parameter file for accuracy using the CHECKPARAMS parameter. This process can be used with Extract or Replicat.

To Verify Parameter Syntax

  1. Include the CHECKPARAMS parameter in the parameter file.
  2. Start the associated process by issuing the START EXTRACT or START REPLICAT command in GGSCI.
    START {EXTRACT | REPLICAT} group_name
    

    The process audits the syntax, writes the results to the report file or the screen, and then stops.

  3. Do either of the following:
    • If the syntax is correct, remove the CHECKPARAMS parameter before starting the process to process data.

    • If the syntax is wrong, correct it based on the findings in the report. You can run another test to verify the changes, if desired. Remove CHECKPARAMS before starting the process to process data.

For more information about the report file, see Monitoring Oracle GoldenGate Processing.

For more information about CHECKPARAMS, see Reference for Oracle GoldenGate.

4.4.6 Viewing a Parameter File

You can view a parameter file directly from the command shell of the operating system, or you can view it from the GGSCI user interface. To view the file from GGSCI, use the VIEW PARAMS command.

VIEW PARAMS group_name

Where:

group_name is either mgr (for Manager) or the name of the Extract or Replicat group that is associated with the parameter file.

Caution:

Do not use VIEW PARAMS to view an existing parameter file that is in a character set other than that of the local operating system (such as one where the CHARSET option was used to specify a different character set). The contents may become corrupted. View the parameter file from outside GGSCI.

If the parameter file was created in a location other than the dirprm sub-directory of the Oracle GoldenGate directory, specify the full path name as shown in the following example.

VIEW PARAMS c:lpparmsreplp.prm

4.4.7 Changing a Parameter File

An Oracle GoldenGate process must be stopped before changing its parameter file, and then started again after saving the parameter file. Changing parameter settings while a process is running can have unexpected results, especially if you are adding tables or changing mapping or filtering rules.

Caution:

Do not use the EDIT PARAMS command to view or edit an existing parameter file that is in a character set other than that of the local operating system (such as one where the CHARSET option was used to specify a different character set). The contents may become corrupted. View the parameter file from outside GGSCI.

To Change Parameters:

  1. Stop the process by issuing the following command in GGSCI. To stop Manager in a Windows cluster, use the Cluster Administrator.
    STOP {EXTRACT | REPLICAT | MANAGER} group_name
    
  2. Open the parameter file by using a text editor or the EDIT PARAMS command in GGSCI.
    EDIT PARAMS mgr
    
  3. Make the edits, and then save the file.
  4. Start the process by issuing the following command in GGSCI. Use the Cluster Administrator if starting Manager in a Windows cluster.
    START {EXTRACT | REPLICAT | MANAGER} group_name
    

4.4.8 Simplifying the Creation of Parameter Files

可以使用以下节省时间的工具减少必须指定参数的次数。

  • Using Wildcards

  • Using OBEY

  • Using Macros

  • Using Parameter Substitution

4.4.8.1 Using Wildcards

For parameters that accept object names, you can use asterisk (*) and question mark (?) wildcards. The use of wildcards reduces the work of specifying numerous object names or all objects within a given schema. For more information about using wildcards, see Using Wildcards in Database Object Names.

4.4.8.2 Using OBEY

You can create a library of text files that contain frequently used parameter settings, and then you can call any of those files from the active parameter file by means of the OBEY parameter. The syntax for OBEY is:

OBEY file_name

Where:

file_name is the relative or full path name of the file.

Upon encountering an OBEY parameter in the active parameter file, Oracle GoldenGate processes the parameters from the referenced file and then returns to the active file to process any remaining parameters. OBEY is not supported for the GLOBALS parameter file.

If using the CHARSET parameter in a parameter file that includes an OBEY parameter, the referenced parameter file does not inherit the CHARSETcharacter set. The CHARSET character set is used to read wildcarded object names in the referenced file, but you must use an escape sequence (uX) for all other multibyte specifications in the referenced file.

See Reference for Oracle GoldenGate for more information about OBEY.

See Reference for Oracle GoldenGate for more information about CHARSET.

4.4.8.3 Using Macros

您可以使用宏来自动化一个参数语句的多次使用。See Using Oracle GoldenGate Macros to Simplify and Automate Work.

4.4.8.4 Using Parameter Substitution

可以使用参数替换在运行时自动为Oracle GoldenGate参数分配值,而不是在创建参数文件时分配静态值。这样,如果值在每次运行时都发生变化,您就可以避免编辑参数文件或维护具有不同设置的多个文件。您可以简单地在运行时导出所需的值。参数替换可用于任何Oracle GoldenGate进程。

To Use Parameter Substitution

  1. For each parameter for which substitution is to occur, declare a runtime parameter instead of a value, and precede the runtime parameter name with a question mark (?) as shown in the following example.
    SOURCEISFILE
    EXTFILE ?EXTFILE
    MAP scott?TABNAME, TARGET tiger ACCOUNT_TARG;
    
  2. Before starting the Oracle GoldenGate process, use the shell of the operating system to pass the runtime values by means of an environment variable, as shown in Example 4-4 and Example 4-5.

Example 4-4 Parameter substitution on Windows

C:GGS> set EXTFILE=C:ggsextfile
C:GGS> set TABNAME=PROD.ACCOUNTS
C:GGS> replicat paramfile c:ggsdirprmparmfl

Example 4-5 Parameter substitution on UNIX (Korn shell)

$ EXTFILE=/ggs/extfile
$ export EXTFILE
$ TABNAME=PROD.ACCOUNTS
$ export TABNAME
$ replicat paramfile ggs/dirprm/parmfl

UNIX is case-sensitive, so the parameter declaration in the parameter file must be the same case as the shell variable assignments.

4.4.9 Getting Information about Oracle GoldenGate Parameters

You can use the INFO PARAM command to view a parameter's definition information from GGSCI. The name provided in the command line can be a parameter, or an option, but it must be a full name that is part of the names concatenated together using a period (.) as the delimiter. For example:

INFO PARAM RMTHOST
RMTHOST.STREAMING
INFO PARAM RMTHOST.STREAMING

Using the GETPARAMINFO, you can query the runtime parameter values of a running instance, including Extract, Replicat, and Manager. This command is similar to using checkprm -v, see Validating a Parameter File. The default behavior is to display all that has ever been queried by the application, parameters and their current values. If a particular parameter name is specified, then the output is filtered by that name. Optionally, the output can be redirect to a file specified by the -FILE option. For example:

SEND ext1pmp GETPARAMINFO

For more information about these and all Oracle GoldenGate parameters including exact syntax, see the Reference for Oracle GoldenGate.

4.5 Specifying Object Names in Oracle GoldenGate Input

The following rules apply when specifying object names in parameter files (such as in TABLE and MAP statements), column-conversion functions, commands, and in other input.

Supported Database Object Names

Qualifying Database Object Names

Specifying Case-Sensitive Database Object Names

Using Wildcards in Database Object Names

Differentiating Case-Sensitive Column Names from Literals

4.5.1 Specifying Filesystem Path Names in Parameter Files on Windows Systems

On Windows systems, if the name of any directory in a filesystem path name begins with a number, the path must be specified with forward slashes, not backward slashes, when listing that path in Oracle GoldenGate input, such as parameter files or commands. This requirement prevents Oracle GoldenGate from interpreting the name as an octal escape sequence. For example, the following paths contain a directory named 2014 that will be interpreted as the octal sequence 201:

C:ogg2014installdirdataa
C:ogginstall2014dirdataa

The preceding path can be used with forward slashes as follows:

C:/ogg/2014/install/dirdat/aa
C:/ogg/install/2014/dirdat/aa

For more information, see Support for Escape Sequences.

4.5.2 Supported Database Object Names

Object names in parameter files, command, and other input can be any length and in any supported character set. For supported character sets, see Supported Character Sets.

Oracle GoldenGate supports most characters in object and column names. Specify object names in double quote marks if they contain special characters such as white spaces or symbols.

The following lists of supported and non-supported characters covers all databases supported by Oracle GoldenGate; a given database platform may or may not support all listed characters.

4.5.2.1 Supported Special Characters

Oracle GoldenGate supports all characters that are supported by the database, including the following special characters. Object names that contain these special characters must be enclosed within double quotes in parameter files.

CharacterDescription

/

Forward slash (See Specifying Names that Contain Slashes)

*

Asterisk (Must be escaped by a backward slash when used in parameter file, as in: *)

?

Question mark (Must be escaped by a backward slash when used in parameter file, as in: ?)

@

At symbol (Supported, but is often used as a resource locator by databases. May cause problems in object names)

#

Pound symbol

$

Dollar symbol

%

Percent symbol (Must be %% when used in parameter file)

^

Caret symbol

( )

Open and close parentheses

_

Underscore

-

Dash

 

Space

4.5.2.2 Non-supported Special Characters

The following characters are not supported in object names and non-key column names.

CharacterDescription

Backward slash (Must be \ when used in parameter file)

{ }

Begin and end curly brackets (braces)

[ ]

Begin and end brackets

=

Equal symbol

+

Plus sign

!

Exclamation point

~

Tilde

|

Pipe

&

Ampersand

:

Colon

;

Semi-colon

,

Comma

' '

Single quotes

" "

Double quotes

'

Accent mark (Diacritical mark)

.

Period

<

Less-than symbol (or beginning angle bracket)

>

Greater-than symbol (or ending angle bracket)

4.5.3 Specifying Names that Contain Slashes

If a table name contains a forward-slash character (/) in any part of its name, that name component must be enclosed within double quotes unless the object name is from an IBM i platform . The following are some examples:

"c/d" 
"/a".b 
a."b/"

If the name contains a forward slash that is not enclosed within double quotes, Oracle GoldenGate treats it as a name that originated on the IBM i platform (from a DB2 for i database). The forward slash in the name is interpreted as a separator character.

4.5.4 Qualifying Database Object Names

Object names must be fully qualified in the parameter file. This means that every name specification must be qualified, not only those supplied as input to Oracle GoldenGate parameter syntax, but also names in a SQL procedure or query that is supplied as SQLEXEC input, names in user exit input, and all other input supplied in the parameter file.

Oracle GoldenGate supports two-part and three-part object names, as appropriate for the database.

4.5.4.1 Two-part Names

Most databases require only two-part names to be specified, in the following format:

owner.object

For example: HR.EMP

Where:

owner is a schema or database, depending on how the database defines a logical namespace that contains database objects. object is a table or other supported database object.

The databases for which Oracle GoldenGate supports two-part names are as follows, shown with their appropriate two-part naming convention:

  • DB2 for i: schema.object and library/file(member)

  • DB2 LUW: schema.object

  • DB2 on z/OS: schema.object

  • MySQL: database.object

  • Oracle Database (non-CDB databases): schema.object

  • SQL Server: schema.object

  • Teradata: database.object

4.5.4.2 Three-part Names

Oracle GoldenGate supports three-part names for the following databases:

  • Oracle container databases (CDB)

Three-part names are required to capture from a source Oracle container database because one Extract group can capture from more than one container. Thus, the name of the container, as well as the schema, must be specified for each object or objects in an Extract TABLEstatement.

Specify a three-part Oracle CDB name as follows:

container.schema.object

For example: PDB1.HR.EMP

For more information about Oracle container databases, see Oracle Database Administrator’s Guide.

4.5.4.3 Applying Data from Multiple Containers or Catalogs

To apply data captured from multiple source containers or catalogs to a target Oracle container database, both three- and two-part names are required. In the MAP portion of the MAP statement, each source object must be associated with a container or catalog, just as it was in the TABLEstatement. This enables you (and Replicat) to properly map data from multiple source containers or catalogs to the appropriate target objects. In the TARGET portion of the MAP statement, however, only two-part names are required. This is because Replicat can connect to only one target container or catalog at a time, and schema.owner is a sufficient qualifier. Multiple Replicat groups are required to support multiple target containers or catalogs. Specify the target container or catalog with the TARGETDB parameter.

4.5.4.4 Specifying a Default Container or Catalog

You can use the SOURCECATALOG parameter to specify a default catalog for any subsequent TABLEMAP, (or Oracle SEQUENCE) specifications in the parameter file. The following example shows the use of SOURCECATALOG to specify the default Oracle PDB named pdb2 for schema2 and schema3 objects, and the default PDB named pdb3 for schema4 objects. The objects in pdb1 are specified with a fully qualified three-part name, which does not require a default catalog to be specified.

TABLE pdb1.schema1.table*; 
SOURCECATALOG pdb2 
TABLE schema2.table*; 
TABLE schema3.table*; 
SOURCECATALOG pdb3 
TABLE schema4.table*;

4.5.5 Specifying Case-Sensitive Database Object Names

Oracle GoldenGate supports case-sensitive names. Follow these rules when specifying case-sensitive objects.

  • Specify object names from a case-sensitive database in the same case that is used to store them in the host database. Keep in mind that, in some database types, different levels of the database can have different case-sensitivity, such as case-sensitive schema but case-insensitive table. If the database requires quotes to enforce case-sensitivity, put quotes around each object that is case-sensitive in the qualified name.

    Correct: TABLE "Sales"."ACCOUNT"

    Incorrect: TABLE "Sales.ACCOUNT"

  • Oracle GoldenGate converts case-insensitive names to the case in which they are stored when required for mapping purposes.

Table 4-2 provides an overview of the support for case-sensitivity in object names, per supported database. Refer to the database documentation for details on this type of support.

Table 4-2 Case Sensitivity of Object Names Per Database

DatabaseRequires quotes to enforce case-sensitivity?Unquoted object nameQuoted object name

DB2

Yes. Differentiates between case-sensitive and case-insensitive by use of quotes.

Case-insensitive, stores in upper case

Case-sensitive, stores in mixed case

MySQL

(Case-sensitive database)

No

  • Always case-sensitive, stores in mixed case

  • The names of columns, triggers, and procedures are case-insensitive

No effect

No effect

Oracle Database

Yes. Differentiates between case-sensitive and case-insensitive by use of quotes.

Case-insensitive, stores in upper case

Case-sensitive, stores in mixed case

SQL Server

(Database created as case-sensitive)

No

Always case-sensitive, stores in mixed case

No effect

No effect

SQL Server

(Database created as case-sensitive)

No

Always case-insensitive, stores in mixed case

No effect

No effect

Teradata

No

Always case-insensitive, stores in mixed case

No effect

No effect

Note:

For all supported databases, passwords are always treated as case-sensitive regardless of whether the associated object name is quoted or unquoted.

4.5.6 Using Wildcards in Database Object Names

如果特定数据库支持通配符,则可以对完全限定对象名称的任何部分使用通配符。这些名称部分可以是以下内容:容器、数据库或目录名、所有者(模式或数据库名)和表或序列名。有关如何支持对象名称和通配符的详细信息,请参阅该数据库的Oracle GoldenGate安装和配置指南。

Where appropriate, Oracle GoldenGate parameters permit the use of two wildcard types to specify multiple objects in one statement:

  • A question mark (?) replaces one character. For example in a schema that contains tables named TABn, where n is from 0 to 9, a wildcard specification of HQ.TAB? returns HQ.TAB0HQ.TAB1HQ.TAB2, and so on, up to HQ.TAB9, but no others. This wildcard is not supported for the DB2 LUW database nor for DEFGEN. This wildcard can only be used to specify source objects in a TABLE or MAPparameter. It cannot be used to specify target objects in the TARGET clause of TABLE or MAP.

  • An asterisk (*) represents any number of characters (including zero sequence). For example, the specification of HQ.T* could return such objects as HQ.TOTALHQ.T123, and HQ.T. This wildcard is valid for all database types throughout all Oracle GoldenGate commands and parameters where a wildcard is allowed.

  • In TABLE and MAP statements, you can combine the asterisk and question-mark wildcard characters in source object names only.

4.5.6.1 Rules for Using Wildcards for Source Objects

For source objects, you can use the asterisk alone or with a partial name. For example, the following source specifications are valid:

  • TABLE HQ.*;

  • TABLE PDB*.HQ.*;

  • MAP HQ.T_*;

  • MAP HQ.T_*, TARGET HQ.*;

The TABLEMAP and SEQUENCE parameters take the case-sensitivity and locale of the database into account for wildcard resolution. For databases that are created as case-sensitive or case-insensitive, the wildcard matches the exact name and case. For example, if the database is case-sensitive, SCHEMA.TABLE is matched to SCHEMA.TABLESchema.Table is matched to Schema.Table, and so forth. If the database is case-insensitive, the matching is not case-sensitive.

For databases that can have both case-sensitive and case-insensitive object names in the same database instance, with the use of quote marks to enforce case-sensitivity, the wildcarding works differently. When used alone for a source name in a TABLE statement, an asterisk wildcard matches any character, whether or not the asterisk is within quotes. The following statements produce the same results:

TABLE hr.*;
TABLE hr."*";

Similarly, a question mark wildcard used alone matches any single character, whether or not it is within quotes. The following produce the same results:

TABLE hr.?;
TABLE hr."?";

If a question mark or asterisk wildcard is used with other characters, case-sensitivity is applied to the non-wildcard characters, but the wildcard matches both case-sensitive and case-insensitive names.

  • The following TABLE statements capture any table name that begins with lower-case abc. The quoted name case is preserved and a case-sensitive match is applied. It captures table names that include "abcA" and "abca" because the wildcard matches both case-sensitive and case-insensitive characters.

    TABLE hr."abc*";
    TABLE hr."abc?";
    
  • The following TABLE statements capture any table name that begins with upper-case ABC, because the partial name is case-insensitive (no quotes) and is stored in upper case by this database. However, because the wildcard matches both case-sensitive and case-insensitive characters, this example captures table names that include ABCA and "ABCa".

    TABLE hr.abc*;
    TABLE hr.abc?;
    

4.5.6.2 Rules for Using Wildcards for Target Objects

When using wildcards in the TARGET clause of a MAP statement, the target objects must exist in the target database. (The exception is when DDL replication is being used, which allows new schemas and their objects to be replicated as they are created.)

For target objects, only an asterisk can be used. If an asterisk wildcard is used with a partial name, Replicat replaces the wildcard with the entire name of the corresponding source object. Therefore, specifications such as the following are incorrect:

TABLE HQ.T_*, TARGET RPT.T_*;
MAP HQ.T_*, TARGET RPT.T_*;

The preceding mappings produce incorrect results, because the wildcard in the target specification is replaced with T_TEST (the name of a source object), making the whole target name T_T_TESTn. The following illustrates the incorrect results:

  • HQ.T_TEST1 maps to RPT.T_T_TEST1

  • HQ.T_TEST2 maps to RPT.T_T_TEST2

  • (The same pattern applies to all other HQ.T_TESTn mappings.)

The following examples show the correct use of asterisk wildcards.

MAP HQ.T_*, TARGET RPT.*;

The preceding example produces the following correct results:

  • HQ.T_TEST1 maps to RPT.T_TEST1

  • HQ.T_TEST2 maps to RPT.T_TEST2

  • (The same pattern applies to all other HQ.T_TESTn mappings.)

4.5.6.3 Fallback Name Mapping

Oracle GoldenGate has a fallback mapping mechanism in the event that a source name cannot be mapped to a target name. If an exact match cannot be found on the target for a case-sensitive source object, Replicat tries to map the source name to the same name in upper or lower case (depending on the database type) on the target. Fallback name mapping is controlled by the NAMEMATCH parameters. For more information, see Reference for Oracle GoldenGate.

4.5.6.4 Wildcard Mapping from Pre-11.2.1 Trail Version

If Replicat is configured to read from a trail file that is a version prior to Oracle GoldenGate 11.2.1, the target mapping is made in the following manner to provide backward compatibility.

  • Quoted object names are case-sensitive.

  • Unquoted object names are case-insensitive.

The following maps a case-sensitive table name "abc" to target "abc". This only happens with a trail that was written by pre-11.2.1 Extract for SQL Server databases with a case-sensitive configuration. In this example, if the target database is Oracle Database or DB2 fallback name mapping is performed if the target database does not contain case-sensitive "abc" but does have table ABC. (See Fallback Name Mapping.)

MAP hq."abc", TARGET hq.*;

The following example maps a case-insensitive table name abc to target table name ABC. Previous releases of Oracle GoldenGate stored case-insensitive object names to the trail in upper case; thus the target table name is always upper cased. For case-insensitive name conversion, the comparison is in uppercase, A to Z characters only, in US-ASCII without taking locale into consideration.

MAP hq.abc, TARGET hq.*;

4.5.6.5 Asterisks or Question Marks as Literals in Object Names

If the name of an object itself includes an asterisk or a question mark, the entire name must be escaped and placed within double quotes, as in the following example:

TABLE HT."?ABC";

4.5.6.6 How Wildcards are Resolved

By default, when an object name is wildcarded, the resolution for that object occurs when the first row from the source object is processed. (By contrast, when the name of an object is stated explicitly, its resolution occurs at process startup.) To change the rules for resolving wildcards, use the WILDCARDRESOLVE parameter. The default is DYNAMIC.

4.5.6.7 Excluding Objects from a Wildcard Specification

You can combine the use of wildcard object selection with explicit object exclusion by using the EXCLUDEWILDCARDOBJECTSONLYCATALOGEXCLUDESCHEMAEXCLUDEMAPEXCLUDE, and TABLEEXCLUDE parameters. See Reference for Oracle GoldenGate for descriptions and syntax.

4.5.7 Differentiating Case-Sensitive Column Names from Literals

By default, Oracle GoldenGate follows SQL-92 rules for specifying column names and literals. In Oracle GoldenGate parameter files, conversion functions, user exits, and commands, case-sensitive column names must be enclosed within double quotes if the database requires quotes around a name to support case-sensitivity. For example:

"columnA"

Case-sensitive column names in databases that do not require quotes to enforce case-sensitivity must be specified as they are stored in the database. For example:

ColumnA

Literals must be enclosed within single quotes. In the following example, Product_Code is a case-sensitive column name in an Oracle database, and the other strings are literals.

@CASE ("Product_Code", 'CAR', 'A car', 'TRUCK', 'A truck')

最后

以上就是香蕉茉莉为你收集整理的【ogg Administering Oracle GoldenGate】4 Getting Started with the Oracle GoldenGate Process Interfaces4 Getting Started with the Oracle GoldenGate Process Interfaces的全部内容,希望文章能够帮你解决【ogg Administering Oracle GoldenGate】4 Getting Started with the Oracle GoldenGate Process Interfaces4 Getting Started with the Oracle GoldenGate Process Interfaces所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(46)

评论列表共有 0 条评论

立即
投稿
返回
顶部