D66519GC10_ag

190
Oracle GoldenGate 11g Fundamentals for Oracle Activity Guide D66519GC10 Edition 1.0 April 2011 D72292

description

D66519GC10_ag

Transcript of D66519GC10_ag

  • Oracle GoldenGate 11g Fundamentals for Oracle Activity Guide

    D66519GC10 Edition 1.0 April 2011 D72292

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved. Disclaimer This document contains proprietary information and is protected by copyright and other intellectual property laws. You may copy and print this document solely for your own use in an Oracle training course. The document may not be modified or altered in any way. Except where your use constitutes "fair use" under copyright law, you may not use, share, download, upload, copy, print, display, perform, reproduce, publish, license, post, transmit, or distribute this document in whole or in part without the express authorization of Oracle. The information contained in this document is subject to change without notice. If you find any problems in the document, please report them in writing to: Oracle University, 500 Oracle Parkway, Redwood Shores, California 94065 USA. This document is not warranted to be error-free. Restricted Rights Notice If this documentation is delivered to the United States Government or anyone using the documentation on behalf of the United States Government, the following notice is applicable: U.S. GOVERNMENT RIGHTS The U.S. Governments rights to use, modify, reproduce, release, perform, display, or disclose these training materials are restricted by the terms of the applicable Oracle license agreement and/or the applicable U.S. Government contract. Trademark Notice Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

    Author Karen Kehn

    Technical Contributors and Reviewers Glenn Goodrich, Eric Siglin, Sue Jang, Loren Penton, Randy Richeson, Heike Hundt, Viktor Tchemodanov, Joe Greenwald, Deirdre Matishak

    This book was published using: Oracle Tutor

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Oracle GoldenGate 11g Fundamentals for Oracle Table of Contents i

    Table of Contents

    Practices for Lesson 1: Introduction to Oracle GoldenGate 11g: Fundamentals for Oracle .....................1-1 Practices for Lesson 1 ....................................................................................................................................1-2

    Practices for Lesson 2: Technology Overview ..............................................................................................2-1 Practices for Lesson 2 ....................................................................................................................................2-2

    Practices for Lesson 3: Oracle GoldenGate Architecture ............................................................................3-1 Practices for Lesson 3 ....................................................................................................................................3-2

    Practices for Lesson 4: Installing Oracle GoldenGate ..................................................................................4-1 Practices for Lesson 4: Overview ...................................................................................................................4-2 Practice 4-1: Lab Preparation ........................................................................................................................4-3 Practice 4-2: Installing Oracle GoldenGate ....................................................................................................4-7 Practice 4-3: Introduction to the GGSCI Command Interface ........................................................................4-14

    Practices for Lesson 5: Configuration Overview and Preparing the Environment ....................................5-1 Practices for Lesson 5: Overview ...................................................................................................................5-2 Practice 5-1: Preparing Your Environment .....................................................................................................5-3 Practice 5-2: Creating the GLOBALS Parameter File ....................................................................................5-9 Practice 5-3: Configuring and Starting the GoldenGate Manager ..................................................................5-10 Practice 5-4: Using the TRANDATA option ....................................................................................................5-13

    Practices for Lesson 6: Configuring Change Capture ..................................................................................6-1 Practices for Lesson 6: Overview ...................................................................................................................6-2 Practice 6-1: Setting Up the Extract and the EXTTRAIL .....................................................6-3 Practice 6-2: Setting Up an Extract Data Pump and Starting the Two Extracts .............................................6-5

    Practices for Lesson 7: Configuring Initial Load ...........................................................................................7-1 Practices for Lesson 7: Overview ...................................................................................................................7-2 Practice 7-1: Setting Up the Initial Load by Using the File to Replicat Method ...............................................7-3 Practice 7-2: Setting Up the Initial Data Load by Using the Direct Load Method ...........................................7-10

    Practices for Lesson 8: Configuring Change Delivery .................................................................................8-1 Practices for Lesson 8: Overview ...................................................................................................................8-2 Practice 8-1: Setting Up the Checkpoint Table on the Target System ...........................................................8-3 Practice 8-2: Setting Up GoldenGate Delivery ...............................................................................................8-4 Practice 8-3: Generating Data and Starting GoldenGate Processes ..............................................................8-6

    Practices for Lesson 9: Extract Trail and Files ..............................................................................................9-1 Practices for Lesson 9: Overview ...................................................................................................................9-2 Practice 9-1: Using the Logdump Utility .........................................................................................................9-3

    Practices for Lesson 10: Oracle GoldenGate Parameters ............................................................................10-1 Practices for Lesson 10: Overview .................................................................................................................10-2 Practice 10-1: Modifying Source Manager Parameters ..................................................................................10-3 Practice 10-2: Modifying the Target Manager Parameters .............................................................................10-5 Practice 10-3: Modifying the Extract Parameters on the Source Database ....................................................10-7

    Practices for Lesson 11: Data Selection and Filtering ..................................................................................11-1 Practices for Lesson 11 ..................................................................................................................................11-2

    Practices for Lesson 12: Additional Transformation Topics........................................................................12-1 Practices for Lesson 12: Overview .................................................................................................................12-2 Practice 12-1: Modifying an Existing Set of Macros and User Tokens ...........................................................12-3

    Practices for Lesson 13: Configuration Options ...........................................................................................13-1

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Oracle GoldenGate 11g Fundamentals for Oracle Table of Contents ii

    Practices for Lesson 13: Overview .................................................................................................................13-2 Practice 13-1: Setting Up the Database and Source Definitions File .............................................................13-3 Practice 13-2: GoldenGate Encryption ...........................................................................................................13-7

    Practices for Lesson 14: Bidirectional Replication .......................................................................................14-1 Practices for Lesson 14: Overview .................................................................................................................14-2 Practice 14-1: Two-Way Active-Active Data Replication ................................................................................14-3 Practice 14-2: Conflict Detection and Resolution ...........................................................................................14-21

    Practices for Lesson 15: DDL Replication .....................................................................................................15-1 Practices for Lesson 15: Overview .................................................................................................................15-2 Practice 15-1: DDL Replication ......................................................................................................................15-3

    Practices for Lesson 16: Tuning and Troubleshooting ................................................................................16-1 Practices for Lesson 16 ..................................................................................................................................16-2

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Oracle GoldenGate 11g Fundamentals for Oracle Table of Contents iii

    Preface

    Profile Before you begin this course, you should have working experience with the vi editor, database concepts and data integration concepts.

    How This Course Is Organized This is an instructor-led course featuring lecture and hands-on exercises. Online demonstrations and written practice sessions reinforce the concepts and skills introduced.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Oracle GoldenGate 11g Fundamentals for Oracle Table of Contents iv

    Related Publications

    Oracle Publications Title Part Number

    Oracle GoldenGate Windows and UNIX Administrators Guide 11g Release 1 (11.1.1)

    E17341-01

    Oracle GoldenGate Windows and UNIX Reference Guide 11g Release 1 (11.1.1)

    E17791-01

    Oracle GoldenGate Windows and UNIX Troubleshooting and Tuning Guide 11g Release 1 (11.1.1)

    E17792-01

    Additional Publications System release bulletins Installation and users guides Read-me files International Oracle Users Group (IOUG) articles Oracle Magazine

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 1: Introduction to Oracle GoldenGate 11g: Fundamentals for Oracle Chapter 1 - Page 1

    Practices for Lesson 1: Introduction to Oracle GoldenGate 11g: Fundamentals for Oracle Chapter 1

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 1: Introduction to Oracle GoldenGate 11g: Fundamentals for Oracle Chapter 1 - Page 2

    Practices for Lesson 1

    Overview There are no practices for this Lesson.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 2: Technology Overview Chapter 2 - Page 1

    Practices for Lesson 2: Technology Overview Chapter 2

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 2: Technology Overview Chapter 2 - Page 2

    Practices for Lesson 2

    Overview There are no practices for this Lesson.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 3: Oracle GoldenGate Architecture Chapter 3 - Page 1

    Practices for Lesson 3: Oracle GoldenGate Architecture Chapter 3

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 3: Oracle GoldenGate Architecture Chapter 3 - Page 2

    Practices for Lesson 3

    Overview There are no practices for this Lesson.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 1

    Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 2

    Practices for Lesson 4: Overview

    Practices Overview In these practices, you will become familiar with the lab environment that you will be using for the duration of the class. You will also install the GoldenGate software to be used with both the AMER and EURO databases. Finally, you will be introduced briefly to the command line interface, GGSCI.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 3

    Practice 4-1: Lab Preparation

    Overview There are two databases configured on your machine. One is called AMER and the other is called EURO. These are physically different databases, each with its own structure and set of users. At some times in the practices that follow you will need to connect to one of your databases using SQL*Plus. The following steps describe how to connect to each of your databases and also provide more details about the users and tables that you will be working with. Each database has administrative users, such as system, as well as other users created specifically for this course. The data tables that you will create and populate in the AMER database that you will be using in this course are owned by the WEST user. Conversely, the data tables in the EURO database are owned by the EAST user. To connect to the AMER database as the system user using SQL*Plus, enter the following command at the operating system prompt:

    Shell> sqlplus system@amer

    The password for all database accounts for this course is oracle_4U.

    Operating System

    Type Linux

    oracle

    oracle

    AMER Database (Source)

    west

    oracle_4U

    amer

    /u01/app/oracle/gg_amer

    Manager 15000

    EURO Database (Target)

    east

    oracle_4U

    euro

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 4

    /u01/app/oracle/gg_euro

    Manager 15001

    GoldenGate

    /stage

    GoldenGate u01/app/oracle/gg_amer

    GoldenGate u01/app/oracle/gg_euro

    1. To set up your working environment, create terminal windows to make it easier to navigate

    between the source and target databases: a. Log in to your designated machine with the following information:

    1) Username: oracle 2) Password: oracle

    2. Double-click the terminal icon located on your desktop.

    3. From the Terminal menu, select Set Title.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 5

    4. Set the name of the terminal window to GG_AMER_HOME and navigate to the $GG_AMER_HOME directory (this is where the GoldenGate software will be installed).

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 6

    5. Create another terminal window for the euro database, naming it GG_EURO_HOME following the same steps above. Navigate to the $GG_EURO_HOME directory (this is the directory where GoldenGate will be installed). For many of the practices, keep both of these windows open, to easily toggle between the two databases.

    (Note: It is important to confirm that you are using the correct SID by issuing the . oraenv command, AMER and EURO, respectively.)

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 7

    Practice 4-2: Installing Oracle GoldenGate

    Overview In this practice, you will install two Oracle GoldenGate instance(s), one to be used with the AMER database and one to be used with the EURO database.

    Tasks 1. In the GG_AMER_HOME terminal window, unzip the .zip file by executing the following

    command: Shell> unzip ggs*.zip

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 8

    2. Extract the .tar file into the same (gg_amer) directory: Shell> tar xvof *.tar

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 9

    3. Create the required subdirectories in the installation directory: Shell> ggsci GGSCI> create subdirs GGSCI> exit

    4. The GGSCI CREATE SUBDIRS command creates the following GoldenGate subdirectories:

    Directory Contents

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 10

    dirchk GoldenGate checkpoint files dirdat GoldenGate trail and extract files dirdef Source data definitions produced by DEFGEN and used to translate

    heterogeneous data dirpcs Process status files dirout Directory that is no longer used dirprm GoldenGate parameter (run-time configuration) files dirrpt Process report files dirsql SQL scripts dirtmp Temporary storage for transactions that exceed memory dirver An Oracle GoldenGate Veridata directory. Not used unless this

    software is installed in the Oracle GoldenGate location. 5. Verify that the GoldenGate directories were created:

    Shell> ls d dir*

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 11

    6. Now install the GoldenGate software in the GG_EURO_HOME directory. In the GG_EURO_HOME terminal window, unzip the .zip file by executing the following command:

    Shell> unzip ggs*.zip

    7. Extract the .tar file into the same (gg_euro) directory:

    Shell> tar xvof *.tar

    8. Create the required subdirectories in the installation directory:

    Shell> ggsci GGSCI> create subdirs GGSCI> exit

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 12

    9. The GGSCI CREATE SUBDIRS command creates the following GoldenGate subdirectories:

    Directory Contents dirchk GoldenGate checkpoint files dirdat GoldenGate trail and extract files dirdef Source data definitions produced by DEFGEN and used to translate

    heterogeneous data dirpcs Process status files dirout Directory that is no longer used dirprm GoldenGate parameter (run-time configuration) files dirrpt Process report files dirsql SQL scripts dirtmp Temporary storage for transactions that exceed memory dirver An Oracle GoldenGate Veridata directory. Not used unless this

    software is installed in the Oracle GoldenGate location.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 13

    10. Verify that the GoldenGate directories were created: Shell> ls d dir*

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 14

    Practice 4-3: Introduction to the GGSCI Command Interface

    Overview In this practice you learn how to invoke the GoldenGate command interface (GGSCI) and how to access online help for all commands.

    Assumptions This can be done using either the AMER database or the EURO database.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 15

    Tasks 1. How you invoke GGSCI depends on the settings in your profile. From the /home/oracle

    directory, review the .bash_profile file. Make certain that the ORACLE_HOME and GG_AMER_HOME, GG_EURO_HOME system environment variables are set to the correct directories. The GoldenGate processes refer to them when connecting to the database. If the appropriate settings have been included, you can invoke GGSCI directly from the command line.

    2. Launch the GGSCI command interface:

    Shell> cd Shell> . oraenv Shell> ggsci

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 16

    3. View a HELP summary for all commands: GGSCI> HELP GGSCI> HELP ALL

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 17

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 18

    4. View a HELP summary for a command or entity (some of the screenshots are too long to include):

    GGSCI> HELP ADD EXTRACT GGSCI> HELP ADD EXTTRAIL

    5. View your command history: GGSCI> HISTORY

    6. View a brief informational summary of all processes:

    GGSCI> INFO ALL

    7. Exit GGSCI.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 - Page 1

    Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 - Page 2

    Practices for Lesson 5: Overview

    Practices Overview In these practices, you will begin the process of setting up one-way data replication by creating and populating your databases. You will also configure and start the manager process on both instances of GoldenGate. Oracle GoldenGate provides log-based change data capture (CDC) and replication of committed database transactions. The software provides capture, routing, transformation, and delivery of transactional data across heterogeneous environments in real time. The following figure depicts a simplified GoldenGate implementation that you will create. In this practice, you will create the objects that are shaded (source database, target database and mgr.prm files):

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 - Page 3

    Practice 5-1: Preparing Your Environment

    Overview In this practice you will set up the databases (AMER and EURO) and configure GoldenGate to work specifically with the Oracle databases.

    Assumptions Two core databases are already installed, AMER and EURO. AMER (the source database) has the following user (west/oracle_4U) already created and EURO has the following user (east/oracle_4U) also already created. You will be running the source_database.sql script on the AMER database and the target_database.sql script on the EURO database. Both of these scripts will create the following tables:

    ACCOUNT

    ACCOUNT_TRANS

    BRANCH

    TELLER

    TELLER_TRANS

    BRANCH_ATM The data tables in the AMER database are owned by the WEST user and the data tables in the EURO database are owned by the EAST user.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 - Page 4

    Tasks 1. To create the source database for AMER, navigate to the

    /home/oracle/labs/Section5/sqlscripts directory. At the shell prompt, issue the following command:

    Shell> sqlplus west/oracle_4U @source_database.sql

    2. To populate the tables on the AMER database, run the following command from the same

    directory (/home/oracle/labs/Section5/sqlscripts): Shell> sqlplus west/oracle_4U @seed_database.sql

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 - Page 5

    3. To create the data tables on the EURO database, in the GG_EURO_HOME terminal window, navigate to the /home/oracle/labs/Section5/sqlscripts directory. Execute the following command:

    Shell> sqlplus east/oracle_4U @target_database.sql

    4. Create a GoldenGate user that can connect to the source and target databases for

    transactional data. A GoldenGate user requires a database user with the following privileges:

    User Privilege Extract (Source Side) Replicat (Target Side) CREATE SESSION, ALTER SESSION

    X X

    RESOURCE X X SELECT ANY DICTIONARY X X FLASHBACK ANY TABLE

    or FLASHBACK ON

    X

    SELECT ANY TABLE

    or SELECT ON

    X X

    INSERT, UPDATE, DELETE ON

    X

    CREATE TABLE X EXECUTE on DBMS_FLASHBACK package

    X

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 - Page 6

    5. Create a user, (gguser/oracle_4U), on both the AMER and EURO databases: Shell> sqlplus / as sysdba SQL> grant connect, resource, dba to gguser identified by oracle_4U; SQL> exit

    For the AMER database:

    For the EURO database:

    Exit SQL.

    6. On the AMER database, log out of SQL and log back in with the new user, gguser. Minimal supplemental logging must be enabled at the database level to allow GoldenGate to

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 - Page 7

    properly capture updates to primary keys and chained rows. To enable supplemental logging at the database level: a. Log in to SQL*Plus as gguser/oracle_4U. b. Enable minimal supplemental logging by executing the following command:

    ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;

    c. To ensure that the redo and archive logs contain supplemental log data, switch the logs by executing the following command: ALTER SYSTEM SWITCH LOGFILE;

    d. Verify that supplemental logging is enabled at the database level via the following command. (Note: Output of the query must be YES or IMPLICIT.) SELECT SUPPLEMENTAL_LOG_DATA_MIN FROM V$DATABASE;

    Exit SQL.

    7. On the EURO database, log out of SQL and log back in with the new user, gguser. Minimal supplemental logging must be enabled at the database level to allow GoldenGate to properly capture updates to primary keys and chained rows. To enable supplemental logging at the database level: a. Log in to SQL*Plus as gguser/oracle_4U.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 - Page 8

    b. Enable minimal supplemental logging by executing the following command: ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;

    c. To ensure that the redo and archive logs contain supplemental log data, switch the logs by executing the following command: ALTER SYSTEM SWITCH LOGFILE;

    d. Verify that supplemental logging is enabled at the database level via the following command. (Note: Output of the query must be YES or IMPLICIT.) SELECT SUPPLEMENTAL_LOG_DATA_MIN FROM V$DATABASE;

    Exit SQL.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 - Page 9

    Practice 5-2: Creating the GLOBALS Parameter File

    Overview On the target side, Replicat checkpoints to a table in the database that is defined in a special parameter file named GLOBALS. In this practice you will create a GLOBALS parameter file located on the target database (EURO).

    Tasks 1. In the GG_EURO_HOME terminal window, create a GLOBALS parameter file by executing the

    following commands: Shell> cd $GG_EURO_HOME Shell> . oraenv Shell> vi GLOBALS

    2. vi starts and opens a GLOBALS file, the file is located in the directory of your GoldenGate

    instance. Add the following run-time parameters to the file: checkpointtable GGS_CHECKPOINT

    3. Save and close the file.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 - Page 10

    Practice 5-3: Configuring and Starting the GoldenGate Manager

    Overview In this practice, you will configure and start the manager process on both instances of GoldenGate. The GoldenGate Manager process performs several important tasks that we must configure:

    Listens for incoming connectivity requests from Extract or Extract Data Pump Performs housekeeping functions to delete any consumed GoldenGate Trails

    Tasks 1. The first task is to configure and start the Manager processes on both the source and

    target. On the source server (AMER), start GGSCI from a shell prompt positioned inside the GoldenGate directory.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 - Page 11

    At the GGSCI prompt, enter: edit param mgr

    2. vi starts and opens an mgr.prm file. Add the following run-time parameters to the

    mgr.prm file: PORT 15000 PURGEOLDEXTRACTS ./dirdat/*, USECHECKPOINTS

    3. Using the GoldenGate Reference Manual (gg_wux_ref_11_1_1.pdf) located in the /home/oracle/labs/docs directory, what parameter is used to specify ports that Manager can allocate for dynamic communications? a. Add that parameter to the mgr.prm file, defining the dynamicportlist range to be

    15010 through 15020. b. Save and close the file.

    4. At the GGSCI prompt, start the Manager process by entering the command: start mgr

    To view the status of the Manager process, enter this command: info manager

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 - Page 12

    5. On the EURO instance, from the shell prompt positioned inside the GoldenGate directory, invoke GGSCI. Execute the following command:

    GGSCI> edit params mgr

    Add the following run-time parameters to the mgr.prm file: PORT 15001 PURGEOLDEXTRACTS ./dirdat/*, USECHECKPOINTS

    Save and close the file 6. At the GGSCI prompt, start the Manager process by entering the following command:

    start mgr

    To view the status of the Manager process, enter this command: info manager

    Exit GGSCI.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 - Page 13

    Practice 5-4: Using the TRANDATA option

    Overview In this practice, you will enable supplemental logging on the source database for the specified tables. Before you can start capturing real-time data, the Oracle database must be set to log the table key values whenever it logs a rows change, so they are available to GoldenGate in Redo. By default, the database only logs column values that change. This is required so GoldenGate can locate the correct row on the target for update and delete operations.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 - Page 14

    Tasks 1. In the GG_AMER_HOME terminal window (the source server), at the GGSCI prompt, type the

    following: GGSCI> dblogin userid gguser, password oracle_4U GGSCI> add trandata west.account GGSCI> add trandata west.account_trans GGSCI> add trandata west.branch GGSCI> add trandata west.branch_atm GGSCI> add trandata west.teller GGSCI> add trandata west.teller_trans

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 - Page 15

    2. Execute the following GGSCI command to verify that supplemental logging is enabled on each table:

    info trandata west.*

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 - Page 16

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 6: Configuring Change Capture Chapter 6 - Page 1

    Practices for Lesson 6: Configuring Change Capture Chapter 6

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 6: Configuring Change Capture Chapter 6 - Page 2

    Practices for Lesson 6: Overview

    Practices Overview In these practices, you will set up the Extract on the source (AMER) database, the EXTTRAIL, Data Pump Extract and the RMTTRAIL. The following diagram shows new objects that will be created: Extract, EXTTRAIL, Data Pump Extract, and RMTTRAIL.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 6: Configuring Change Capture Chapter 6 - Page 3

    Practice 6-1: Setting Up the Extract and the EXTTRAIL

    Overview In this practice you perform the following:

    Configure the primary Extract process that will capture changes. Add the local trail that will store these changes.

    Tasks 1. On the source server (GG_AMER_HOME terminal window), configure the change data

    capture extract from the GGSCI prompt by executing the edit command (confirm that you are in the installation directory and using AMER SID):

    Shell> $GG_AMER_HOME Shell> . oraenv Shell> ggsci GGSCI> edit param extwest

    vi starts and opens the extwest.prm file. Add the following run-time parameters to the text file: EXTRACT extwest EXTTRAIL ./dirdat/ew USERID gguser, PASSWORD oracle_4U TABLE west.*;

    Using the GoldenGate Reference Manual (gg_wux_ref_11_1_1.pdf file) located in the /home/oracle/labs/docs directory, find the parameters that perform the following and add them to the extwest.prm file before the TABLE listings:

    Controls whether or not statistics generated by the REPORT parameter are reset when a new process report is created

    Generates interim run-time statistics in a process report. Set this parameter to report at 1 minute after midnight daily.

    Force report files to age on a regular schedule, instead of when a process starts. Set this report roll-over parameter to occur at 1 minute after midnight daily.

    Report a count of transaction records processed since startup. Set this report parameter to occur every 60 seconds, and report the number of operations per second and the change in rate.

    Save and close the file. 2. Add the Extract Group by executing the following GGSCI commands:

    add extract extwest, tranlog, begin now

    This adds the extwest Extract to GoldenGate, specifying that it will read from Oracle Redo/Archive, with an initial Redo checkpoint of the current timestamp.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 6: Configuring Change Capture Chapter 6 - Page 4

    3. Add a local extract trail, with a maximum file size of 50 megabytes per trail, that links the trail to the extwest Extract:

    add exttrail ./dirdat/ew, extract extwest, megabytes 50 This adds the ./dirdat/ew local extract trail, with a maximum file size of 50 megabytes per trail, and links the trail to the extwest Extract. When the Extract is started, the ./dirdat/ew000000 file will be created. When that file is full, trail ew000001 will be created, and so on through ew999999.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 6: Configuring Change Capture Chapter 6 - Page 5

    Practice 6-2: Setting Up an Extract Data Pump and Starting the Two Extracts

    Overview In this practice you perform the following:

    Configure a data pump Extract to read the local trail and create a remote trail on the target.

    Add the remote trail. Start the two Extract processes.

    Tasks 1. At the GGSCI prompt on the source server (GG_AMER_HOME terminal window), configure

    the Extract Data Pump to read from the./dirdat/ew local extract trail, transmit the data to the target server (EURO), and write it to the./dirdat/pe remote trail:

    edit param pwest

    2. vi starts and opens the pwest.prm file. Add the following run-time parameters to the text file:

    EXTRACT pwest RMTHOST , MGRPORT 15001, COMPRESS RMTTRAIL ./dirdat/pe PASSTHRU TABLE west.*;

    Save and close the file.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 6: Configuring Change Capture Chapter 6 - Page 6

    3. Add the Extract Group by executing the following GGSCI commands: add extract pwest, exttrailsource ./dirdat/ew add rmttrail ./dirdat/pe, extract pwest, megabytes 50

    4. Start the primary Extract process, extwest, by issuing the following command in the

    GG_AMER_HOME window: GGSCI> start extract extwest

    5. Start the Data Pump Extract process, PWEST, by issuing the following command in the GG_AMER_HOME window:

    GGSCI> start extract pwest

    6. To verify the status, execute the command: GGSCI> info er *

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 6: Configuring Change Capture Chapter 6 - Page 7

    Both processes should display as RUNNING. If you see either STOPPED or ABENDED, view the report log (view report ), fix the error, and restart the process.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 6: Configuring Change Capture Chapter 6 - Page 8

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 7: Configuring Initial Load Chapter 7 - Page 1

    Practices for Lesson 7: Configuring Initial Load Chapter 7

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 7: Configuring Initial Load Chapter 7 - Page 2

    Practices for Lesson 7: Overview

    Practices Overview In these practices, you will set up the initial load of data using two different methods: File to Replicat and Direct Load.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 7: Configuring Initial Load Chapter 7 - Page 3

    Practice 7-1: Setting Up the Initial Load by Using the File to Replicat Method

    Overview In this practice you will:

    Configure a task to load the initial data from two source tables: ACCOUNT and BRANCH Configure the delivery of the data to the target Execute the initial load of data

    This File to Replicat method uses an Extract process to extract source data into flat files or trails on the target system. The initial load Replicat task then moves the data from the intermediate file to the target database.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 7: Configuring Initial Load Chapter 7 - Page 4

    Tasks 1. Configure the initial load Extract parameter file by executing the following commands on the

    source (GG_AMER_HOME terminal window) system to create an Extract named EFTOR: Shell> ggsci GGSCI> EDIT PARAMS EFTOR

    vi starts and opens the eftor.prm file. Add the following run-time parameters to the text file: SOURCEISTABLE USERID gguser, PASSWORD oracle_4U RMTHOST , MGRPORT 15001 RMTFILE ./dirdat/ACCOUNT.DAT, PURGE TABLE west.account; RMTFILE ./dirdat/BRANCH.DAT, PURGE TABLE west.branch;

    Save and close the file. Exit GGSCI.

    2. Execute the initial load capture process by starting the initial load Extract directly from a shell by using the following command:

    Shell> cd Shell> extract paramfile dirprm/eftor.prm reportfile dirrpt/eftor.rpt

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 7: Configuring Initial Load Chapter 7 - Page 5

    3. To view the report, navigate to the dirrpt directory and execute the following command: Shell> cd dirrpt GGSCI> more eftor.rpt

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 7: Configuring Initial Load Chapter 7 - Page 6

    4. Navigate towards the end of the report to view the number of inserts for the ACCOUNT and BRANCH tables (your results may vary):

    5. Configure the initial load delivery parameter file by executing the following commands on

    the target (GG_EURO_HOME terminal window) system. a. Navigate to the GG_EURO_HOME directory. Configure the data load parameters for

    ACCOUNT by executing the following command at GGSCI: Shell> cd $GG_EURO_HOME Shell> ggsci GGSCI> EDIT PARAMS LACCT

    vi starts and opens the lacct.prm file. Add the following run-time parameters to the text file: SPECIALRUN END RUNTIME USERID gguser, PASSWORD oracle_4U ASSUMETARGETDEFS EXTFILE ./dirdat/ACCOUNT.DAT MAP west.ACCOUNT, TARGET east.ACCOUNT;

    Save the file.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 7: Configuring Initial Load Chapter 7 - Page 7

    b. Repeat this process for the BRANCH initial load parameter file:

    GGSCI> EDIT PARAMS LBRANCH

    vi starts and opens the lbranch.prm file. Add the following run-time parameters to the text file: SPECIALRUN END RUNTIME USERID gguser, PASSWORD oracle_4U ASSUMETARGETDEFS EXTFILE ./dirdat/BRANCH.DAT MAP west.BRANCH, TARGET east.BRANCH;

    Save the file.

    c. Exit GGSCI.

    6. Execute the initial load delivery process by executing the following commands at the shell prompt from the installation directory:

    Shell> replicat paramfile dirprm/lacct.prm reportfile dirrpt/lacct.rpt Shell> replicat paramfile dirprm/lbranch.prm reportfile dirrpt/lbranch.rpt

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 7: Configuring Initial Load Chapter 7 - Page 8

    Wait 10 seconds and then verify the results: Shell> cd dirrpt Shell> more lacct.rpt Shell> more lbranch.rpt

    Results from the lacct.rpt:

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 7: Configuring Initial Load Chapter 7 - Page 9

    Results from lbranch.rpt:

    The numbers should match.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 7: Configuring Initial Load Chapter 7 - Page 10

    Practice 7-2: Setting Up the Initial Data Load by Using the Direct Load Method

    Overview In this practice you will:

    Configure a task to load the initial data from all of the source table(s) Configure the delivery of the data to the target

    Assumptions For this practice, target database instantiation will be performed via GoldenGate tasks. An Extract Task is a special process that, once started, reads from each source table row by row. This data is transmitted to the Replicat task on the target that inserts each row of data into the empty database tables. The Task will automatically shut down once all rows are read, transmitted, and inserted.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 7: Configuring Initial Load Chapter 7 - Page 11

    Tasks 1. Truncate the ACCOUNT and BRANCH tables. Note: This exercise assumes that you have

    completed an initial data load using the File to Replicat method. If this is not the case, you may skip to step 2.

    Execute the following commands on the target system (GG_EURO_HOME terminal window): Shell> sqlplus east/oracle_4U SQL> truncate table account; SQL> truncate table branch; SQL> commit; SQL> exit

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 7: Configuring Initial Load Chapter 7 - Page 12

    2. To add the initial load capture batch task group, at the GGSCI prompt on the source database (GG_AMER_HOME terminal window) in the installation directory, execute the following command:

    Shell> cd $GG_AMER_HOME Shell> ggsci GGSCI> add extract EINI, SOURCEISTABLE

    3. Configure the initial load capture parameter file by executing the following command on the

    source system (GG_AMER_HOME terminal window): GGSCI> EDIT PARAMS EINI

    vi starts and opens the eini.prm file. Add the following run-time parameters to the text file: EXTRACT EINI RMTHOST , MGRPORT 15001 RMTTASK Replicat, GROUP RINI USERID gguser, PASSWORD oracle_4U TABLE west.*;

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 7: Configuring Initial Load Chapter 7 - Page 13

    Save and close the file.

    4. Add the initial load delivery batch task by executing the following command on the target system (GG_EURO_HOME terminal window):

    Shell> cd $GG_EURO_HOME Shell> ggsci GGSCI> add replicat RINI, SPECIALRUN

    5. Configure the initial load delivery parameter file by executing the following command on the

    target system (GG_EURO_HOME terminal window): GGSCI> edit params RINI

    vi starts and opens the rini.prm file. Add the following run-time parameters to the text file: REPLICAT RINI

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 7: Configuring Initial Load Chapter 7 - Page 14

    ASSUMETARGETDEFS USERID gguser, PASSWORD oracle_4U DISCARDFILE ./dirrpt/RINI.dsc, PURGE MAP west.*, TARGET east.*;

    Note: In the MAP statement, the first owner/schema is for the source and the second is for the target.

    6. Execute the initial load process on the source system (GG_AMER_HOME terminal window):

    GGSCI> START EXTRACT EINI

    Exit GGSCI.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 7: Configuring Initial Load Chapter 7 - Page 15

    7. On the target system (GG_EURO_HOME terminal window), view the report by executing the following command:

    GGSCI> view report rini

    Exit GGSCI.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 7: Configuring Initial Load Chapter 7 - Page 16

    8. Return to the GG_AMER_HOME terminal window and verify that the count for the tables match (the numbers should match in both databases):

    Exit SQL.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 8: Configuring Change Delivery Chapter 8 - Page 1

    Practices for Lesson 8: Configuring Change Delivery Chapter 8

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 8: Configuring Change Delivery Chapter 8 - Page 2

    Practices for Lesson 8: Overview

    Practices Overview In these practices, you will configure change delivery. The components of change delivery include:

    Setting up the checkpoint table on the target system Creating a named group that includes the Replicat process and the checkpoint tables Configuring the Replicat group by adding parameters Starting the Replicat group Generating database activity and verifying the results

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 8: Configuring Change Delivery Chapter 8 - Page 3

    Practice 8-1: Setting Up the Checkpoint Table on the Target System

    Overview In this practice, you will create a checkpoint table on the target system.

    Assumptions Replicat checkpoints to this table in the database and ensures that the Replicat checkpoint is part of the transaction and is used to ensure data integrity. For this step, you will create a special table on the target server.

    Tasks 1. To create the Checkpoint Table, on the target server (GG_EURO_HOME terminal window),

    from the installation director, invoke GGSCI and execute the following command: GGSCI> dblogin userid gguser, password oracle_4U GGSCI> add checkpointtable

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 8: Configuring Change Delivery Chapter 8 - Page 4

    Practice 8-2: Setting Up GoldenGate Delivery

    Overview In this practice you will set up the Replicat delivery component.

    Tasks 1. On the target server (GG_EURO_HOME terminal window), invoke GGSCI and execute the

    following command: GGSCI> edit param reast

    vi starts and opens the reast.prm file. Add the following run-time parameters to the text file: REPLICAT REAST ASSUMETARGETDEFS DISCARDFILE ./dirrpt/reast.dsc, PURGE --HANDLECOLLISIONS --END RUNTIME USERID gguser, PASSWORD oracle_4U MAP west.*, TARGET east.*;

    Save and close the file. 2. Add the Replicat by executing the following GGSCI command:

    add replicat reast, exttrail ./dirdat/pe

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 8: Configuring Change Delivery Chapter 8 - Page 5

    3. Start the Replicat process and then verify the results: GGSCI> start replicat reast GGSCI> info replicat reast

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 8: Configuring Change Delivery Chapter 8 - Page 6

    Practice 8-3: Generating Data and Starting GoldenGate Processes

    Overview In this practice you will start the data generation process and begin real-time data capture.

    Assumptions For the accounts created when we created the database, random transactions are executed: point of sale debit card transactions, ATM deposits, ATM withdrawals, deposits with branch tellers, and withdrawals at branch tellers. Another script that will be used simulates a real-time banking system.

    Tasks 1. In the GG_AMER_HOME terminal window, navigate to the installation directory and invoke

    GGSCI. View the status of the EXTWEST Extract and the PWEST Data Pump Extract: Shell> cd $GG_AMER_HOME Shell> ggsci GGSCI> info er *

    Notice the RBA numbers for both of the Extracts:

    2. Open a new terminal window and navigate to the $GG_AMER_HOME directory. Execute the

    . oraenv command to ensure that you are using the AMER database.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 8: Configuring Change Delivery Chapter 8 - Page 7

    Shell> cd $GG_AMER_HOME Shell> . oraenv

    Then navigate to the /home/oracle/labs/Section8/sqlscripts directory.

    Run the transaction generator by executing the following command: Shell> sqlplus west/oracle_4U @trans_generator.sql

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 8: Configuring Change Delivery Chapter 8 - Page 8

    3. Return to your GG_AMER_HOME terminal window and verify the results (Note: The RBA numbers should be increasing.):

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 8: Configuring Change Delivery Chapter 8 - Page 9

    4. In the GG_EURO_HOME terminal window, view the Replicat statistics by executing the following command:

    GGSCI> info er *

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 8: Configuring Change Delivery Chapter 8 - Page 10

    5. In the GG_AMER_HOME terminal window, issue the info extwest command again. When the RBA value reported for Log Read Checkpoint no longer changes, Extract has captured all outstanding Redo records:

    If there is Oracle Redo activity, the RBA value will continue to change, because Extract must read Redo even if it has no data to capture. Execute the following GGSCI command: GGSCI> lag ewest

    When Extract returns At EOF, no more records to process, Extract has captured all outstanding redo records. Exit GGSCI.

    6. Start a sqlplus session for the west schema at a Linux shell by executing the following command:

    Shell> sqlplus west/oracle_4U Get the row counts for the following tables (select count(*) from ):

    ACCOUNT

    ACCOUNT_TRANS

    TELLER_TRANS

    BRANCH_ATM

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 8: Configuring Change Delivery Chapter 8 - Page 11

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 8: Configuring Change Delivery Chapter 8 - Page 12

    7. In the GG_EURO_HOME terminal window, issue the following command: GGSCI> info reast

    When the RBA value reported for Log Read Checkpoint no longer changes, Replicat has processed all records:

    Exit GGSCI.

    8. Start a sqlplus session for the east schema at a Linux shell by executing the following command:

    Shell> sqlplus east/oracle_4U Get the row counts for the following tables (select count(*) from ):

    ACCOUNT

    ACCOUNT_TRANS

    TELLER_TRANS

    BRANCH_ATM

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 8: Configuring Change Delivery Chapter 8 - Page 13

    If the row counts match those returned for the source tables, you have successfully completed this practice. Exit SQL.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 8: Configuring Change Delivery Chapter 8 - Page 14

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 9: Extract Trail and Files Chapter 9 - Page 1

    Practices for Lesson 9: Extract Trail and Files Chapter 9

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 9: Extract Trail and Files Chapter 9 - Page 2

    Practices for Lesson 9: Overview

    Practices Overview In these practices, you will be able to use the Logdump utility to look at records in a GoldenGate trail file. In this exercise you will:

    Identify the file header record Identify the trail record and its header area Use the header and detail attributes when displaying a record Use the Logdump help feature

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 9: Extract Trail and Files Chapter 9 - Page 3

    Practice 9-1: Using the Logdump Utility

    Tasks 1. In the GG_AMER_HOME terminal window, navigate to the installation directory and invoke

    Logdump: Shell> cd Shell> logdump Logdump> help

    Issue the help command to display a list of all commands available in Logdump:

    2. Open the /dirdat/000000 trail file (verify the name of

    the trail file in the dirdat directory): LOGDUMP> exit Shell> cd dirdat Shell> ls LOGDUMP> open dirdat/ew00000

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 9: Extract Trail and Files Chapter 9 - Page 4

    Identifying the File Headers 3. View the first record:

    LOGDUMP> n

    Note that this is the trail file header record.

    4. Turn on the FILEHEADER ON option and view the record again:

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 9: Extract Trail and Files Chapter 9 - Page 5

    LOGDUMP> fileheader on LOGDUMP> pos 0 LOGDUMP> n

    Scroll down and notice how you can view the detail on the trail, the machine being used, the Extract that produced the trail, the database information, etc.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 9: Extract Trail and Files Chapter 9 - Page 6

    Using the Head and Detail Attributes When Displaying a Record 5. View the first next record:

    LOGDUMP> n

    This is standard trail record:

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 9: Extract Trail and Files Chapter 9 - Page 7

    6. Position back to RBA 0 in the file, set the header and detail attributes to on, and view the same record again.

    LOGDUMP> pos 0 LOGDUMP> ghdr on LOGDUMP> detail on LOGDUMP> n LOGDUMP> n

    Note the difference in the display from the output in the last step (the trail record header area and detail on the columns has been added to the display):

    Exit Logdump.

    7. For more information on the Logdump utility, which reference manual would you use?

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 9: Extract Trail and Files Chapter 9 - Page 8

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 10: Oracle GoldenGate Parameters Chapter 10 - Page 1

    Practices for Lesson 10: Oracle GoldenGate Parameters Chapter 10

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 10: Oracle GoldenGate Parameters Chapter 10 - Page 2

    Practices for Lesson 10: Overview

    Practices Overview In this practice, you will modify the existing Manager and Extract processes by using more advanced parameters. During this practice, you will:

    Modify the source system Manager parameters Modify the target system Manager parameters Modify the Extract parameters and restart the Extract process

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 10: Oracle GoldenGate Parameters Chapter 10 - Page 3

    Practice 10-1: Modifying Source Manager Parameters

    Tasks 1. Following the instructions in the GoldenGate documentation

    (/home/oracle/labs/docs), modify the Manager parameter file on the source database (GG_AMER_HOME terminal window) with the following parameters:

    edit params mgr

    Have an Extract group automatically start when the Manager process started. _______________________________________________________________

    Have all Extract groups automatically restart after abending. Manager should retry the operation 3 times, waiting 1 minute between each attempt. _______________________________________________________________

    Report the current lag for each Extract/Replicat group every hour to the application log file. _______________________________________________________________

    Write an informational message to the application log file if the lag for any Extract/Replicat group exceeds 30 minutes. _______________________________________________________________

    Write a critical message to the application log file if the lag for any Extract/ Replicat group exceeds 45 minutes. _______________________________________________________________

    2. Activate the changes by stopping and restarting the Manager process: GGSCI> stop mgr GGSCI> start mgr

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 10: Oracle GoldenGate Parameters Chapter 10 - Page 4

    3. Verify that the Manager has started: GGSCI> info mgr

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 10: Oracle GoldenGate Parameters Chapter 10 - Page 5

    Practice 10-2: Modifying the Target Manager Parameters

    Tasks 1. Following the instructions in the GoldenGate documentation, modify the Manager

    parameter file on the target database (GG_EURO_HOME terminal window) with the following parameters:

    edit params mgr

    Use ports in the range of 7820 through 7840 when starting GoldenGate processes.

    _______________________________________________________________ Have all Replicat groups that have a group name of R* automatically start when the

    Manager process is started. _______________________________________________________________

    Have all Replicat groups automatically restart after abending. Manager should retry the operation 3 times, waiting 1 minute between each attempt. _______________________________________________________________

    Delete the remote trail files after the Replicat has finished processing them and the trail has been kept for at least 2 hours. _______________________________________________________________

    Report the current lag for each Extract/Replicat group every hour to the application log file. _______________________________________________________________

    Write an informational message to the application log file if the lag for any Extract/Replicat group exceeds 30 minutes. _______________________________________________________________

    Write a critical message to the application log file if the lag for any Extract/ Replicat group exceeds 45 minutes. _______________________________________________________________

    2. Activate the changes by stopping and restarting the Manager to activate the changes:

    GGSCI> stop mgr GGSCI> start mgr

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 10: Oracle GoldenGate Parameters Chapter 10 - Page 6

    3. Verify that the Manager has started:

    GGSCI> info mgr

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 10: Oracle GoldenGate Parameters Chapter 10 - Page 7

    Practice 10-3: Modifying the Extract Parameters on the Source Database

    Tasks 1. Modify the Extract parameter file on the source database (GG_AMER_HOME terminal

    window) for the following:

    GGSCI> EDIT PARAM extwest Write a message to the report file after processing every 1000 records.

    _______________________________________________________________ Only extract data from the ACCOUNT_TRANS table if the account_trans_type is equal

    to CR. _______________________________________________________________

    2. Activate the changes by stopping and restarting the Extract to have the changes take effect. Then verify that the Extract has started:

    GGSCI> stop extract extwest GGSCI> start extract extwest GGSCI> info er *

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 10: Oracle GoldenGate Parameters Chapter 10 - Page 8

    3. Clean up the GoldenGate environment by executing the following GGSCI commands on both the source and target servers:

    GGSCI> STOP er * GGSCI> DBLOGIN userid gguser, password oracle_4U GGSCI> DELETE er * (confirm the deletion) GGSCI> DELETE checkpointtable (only necessary on the EURO db, confirm the deletion) GGSCI> STOP mgr ! SHELL> rm ./dirdat/* SHELL> rm ./dirrpt/*

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 11: Data Selection and Filtering Chapter 11 - Page 1

    Practices for Lesson 11: Data Selection and Filtering Chapter 11

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 11: Data Selection and Filtering Chapter 11 - Page 2

    Practices for Lesson 11

    Overview There are no practices for this Lesson.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 12: Additional Transformation Topics Chapter 12 - Page 1

    Practices for Lesson 12: Additional Transformation Topics Chapter 12

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 12: Additional Transformation Topics Chapter 12 - Page 2

    Practices for Lesson 12: Overview

    Practices Overview In this practice, you will learn more about the structure and parameters that make up GoldenGate macros and user tokens. These will be used in subsequent labs.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 12: Additional Transformation Topics Chapter 12 - Page 3

    Practice 12-1: Modifying an Existing Set of Macros and User Tokens

    Overview In this practice, you will finish creating three macros. GoldenGate Macros provide functionality for sharing parameters or other run-time configuration settings across multiple components and externalizing complex configuration settings in order to streamline parameter file contents. Best practice is to create a file or series of files as a macro library and store them in a specific folder (for example, dirmac). 1. In the GG_AMER_HOME terminal window, at the Linux shell navigate to the

    /home/oracle/labs/Section12 directory. 2. Open the macrolib_shell.mac file in the vi editor. Referring to the GoldenGate

    documentation (Oracle GoldenGate Windows and UNIX Reference Guide 11g Release 1 (11.1.1) (gg_wux_ref_11_1_1.pdf)), fill in the with the appropriate values to complete the three macros, #dbconnect, #bpsettings, and #funcsmap: The key word that a macro body begins with The key word that a macro ends with To reset the statistics when a new report is generated Generate a report every day at 1 minute after midnight. Close the current report file and create a new one daily at 1 minute after minute. The key word that maps records between different source and target columns The function that is used to return information about the Oracle GoldenGate

    environment The function used to identify a user token

    MACRO #dbconnect

    userid gguser, password , encryptkey DEFAULT ;

    MACRO #bpsettings BEGIN

    REPORTCOUNT EVERY 60 SECONDS, RATE END;

    MACRO #funcsmap PARAMS (#src_table, #target_table) BEGIN MAP #src_table, TARGET #target_table, (usedefaults, gg_commit_ts = ("GGHEADER","COMMITTIMESTAMP"), lag_extract_ms = ("TKN-EXTLAG-MSEC"), lag_replicat_ms = @GETENV ("LAG", "MSEC"),

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 12: Additional Transformation Topics Chapter 12 - Page 4

    src_db_name = @TOKEN ("TKN-SRC-DBNAME"), src_db_version = @TOKEN ("TKN-SRC-DBVERSION"), src_txn_csn = @TOKEN ("TKN-TXN-CSN") ); END;

    After all of the parameters have been set correctly, save and close the file. Verify that it has the correct parameters by comparing it to the macrolib.mac file, also located in /home/oracle/labs/Section12 directory.

    3. Navigate to the $GG_AMER_HOME directory. Create a directory name dirmac. Copy the macrolib.mac file to this directory:

    4. Navigate to the $GG_EURO_HOME directory. Create a directory name dirmac. Copy the

    macrolib.mac file to this directory.

    Note: Both the macros and user tokens will be used in subsequent labs.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 1

    Practices for Lesson 13: Configuration Options Chapter 13

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 2

    Practices for Lesson 13: Overview

    Practices Overview In this practice, you will set up a configuration as depicted in the following graphic. You will also use the macros and tokens created in the previous practice, including password encryption, trail encryption, and SQLEXEC.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 3

    Practice 13-1: Setting Up the Database and Source Definitions File

    Overview In this practice, you set up the new databases and create a DEFGEN file.

    Tasks 1. Open your two terminal windows (GG_AMER_HOME and GG_EURO_HOME) and navigate to

    the home directories. Confirm that you are using the correct Oracle SID: Shell> cd $GG_AMER_HOME Shell> . oraenv

    Shell> cd $GG_EURO_HOME Shell> . oraenv

    2. On the source (GG_AMER_HOME terminal window), navigate to the

    /home/oracle/labs/Section13/sqlscripts directory. Execute the following command:

    Shell> sqlplus west/oracle_4U @source_database.sql 3. On the target (GG_EURO_HOME terminal window), navigate to the

    /home/oracle/labs/Section13/sqlscripts directory. Execute the following command

    Shell> sqlplus east/oracle_4U @target_database.sql 4. On the source database (GG_AMER_HOME terminal window) configure the database to log

    table key values by issuing the following commands: Shell> cd $GG_AMER_HOME Shell> ggsci GGSCI> dblogin userid gguser, password oracle_4U GGSCI> add trandata west.*

    Note: Supplemental logging has already been enabled for the existing tables in the database. Verify that supplemental logging has been enabled for the new ones: WEST.CUST_ZIP, WEST.WSHOP_ENCRYPT, and WEST.WSHOP_FUNCS.

    Generating Source Table Definitions 5. Because the target tables differ from the source, a source definitions file must be generated

    for use in Replicat to perform the table name, column name, and data type conversions. DEFGEN is the utility used to create this file. To create the DEFGEN file, on the source database (GG_AMER_HOME), execute the following command at the GGSCI prompt:

    GGSCI> edit params defgen

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 4

    vi starts and opens the defgen.prm file. Add the following run-time parameters to the text file: DEFSFILE ./dirdef/section13.defs, purge USERID gguser, PASSWORD oracle_4U TABLE west.wshop_encrypt; TABLE west.wshop_funcs; TABLE west.cust_zip;

    Save and close the file.

    6. In the GG_AMER_HOME terminal window, execute the command from the GGSCI prompt: GGSCI> shell ./defgen paramfile ./dirprm/defgen.prm

    DEFGEN will report run-time data to the screen. If any errors are reported, fix and rerun.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 5

    Exit the shell-out, and then exit GGSCI.

    7. Copy the./dirdef/section13.defs file to the same location on the target server:

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 6

    In the GG_EURO_HOME terminal window, verify that the file is there:

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 7

    Practice 13-2: GoldenGate Encryption

    Overview GoldenGate offers three types of encryption: GoldenGate Trail, Data Transmission, and password. In this practice, you will use the default GoldenGate encryption to encrypt the password for the database login.

    Tasks 1. Before data encryption can occur, encryption keys must be generated using the keygen

    utility. To run KEYGEN and create keys that will be used for password and data transmission encryption, start a Linux shell session in the GG_AMER_HOME terminal window and navigate to the installation directory. Using the KEYGEN utility, create five keys, with two having 64 bits and three having 128 bits. Then open the file with vi: Shell> cd $GG_AMER_HOME Shell> keygen 64 2 > ENKEYS Shell> keygen 128 3 >> ENKEYS Shell> vi ENKEYS

    2. Now you will need to name the keys MyKey1 through MyKey5. For this practice, we will only be using one of the 64 bit encryption keys. However, if you decided to use Blowfish, one of the 128 bit keys must be used. Save and close the file:

    3. Copy this file to the same location on the target (GG_EURO_HOME) system: Shell> cp ENKEYS /u01/app/oracle/gg_euro

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 8

    In the GG_EURO_HOME terminal window, verify that the file is there:

    Password Encryption Using GoldenGate Default Encryption 4. Having clear text database login credentials stored in edit files may be deemed a security

    violation. To solve this issue, GoldenGate provides a mechanism for encrypting the database access password stored in its configuration files.

    The encrypt password GGSCI command is used to accomplish this task. However, two different levels of encryption are offered, GoldenGate Default, and Blowfish. The encrypt password GGSCI command uses the default GoldenGate encryption key to encrypt the provided text. The returned encrypted text is then copied into the parameter file in place of the clear text password. For correct decryption, the default key must be specified in the parameter file as well. Navigate to the /home/oracle/labs/Section12 directory to retrieve the file that was completed in Practice 12 (macrolib.mac). To encrypt the password used by the GoldenGate macro #dbconnect do the following:

    a. On the source database (GG_AMER_HOME), at the GGSCI prompt, execute the following command: GGSCI> encrypt password oracle_4U

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 9

    b. Copy the encrypted password output. c. Use vi to edit the./dirmac/macrolib.mac file. d. In the #dbconnect macro, replace with the copied value.

    e. Be sure to specify the encryptkey as DEFAULT. f. Save the file and exit. g. Replace the same value in the macrolib.mac file on the EURO database

    (/u01/app/oracle/gg_euro/dirmac).

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 10

    Setting GoldenGate Change Data Capture (EFUNCS) 5. On the source server (GG_AMER_HOME terminal window), configure the change data

    capture extract from a GGSCI prompt: GGSCI> edit param efuncs

    vi starts and opens the efuncs.prm file. Add the following run-time parameters to the text file: NOLIST INCLUDE ./dirmac/macrolib.mac LIST EXTRACT EFUNCS ENCRYPTTRAIL EXTTRAIL ./dirdat/ex

    #dbconnect () #bpsettings () TABLE west.wshop_encrypt;

    NOENCRYPTTRAIL EXTTRAIL ./dirdat/ec TABLE west.wshop_encrypt; TABLE west.cust_zip; TABLE west.wshop_funcs, TOKENS ( TKN-EXTLAG-MSEC = @GETENV ("LAG", "MSEC"), TKN-SRC-DBNAME = @GETENV ("DBENVIRONMENT", "DBNAME"), TKN-SRC-DBVERSION = @GETENV ("DBENVIRONMENT", "DBVERSION"), TKN-TXN-CSN = @GETENV ("TRANSACTION", "CSN") );

    Save and close the file.

    6. Add the Extract Group and two Local Extract Trails by executing the following GGSCI commands:

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 11

    GGSCI> add extract efuncs, tranlog, begin now GGSCI> add exttrail ./dirdat/ex, extract efuncs, megabytes 1 GGSCI> add exttrail ./dirdat/ec, extract efuncs, megabytes 1

    Setting Up the First GoldenGate Extract Data Pump (PFUNCS) 7. On the source server (GG_AMER_HOME terminal window), configure the first Extract Data

    Pump to read from the Local Extract Trail ./dirdat/ex, transmit the data to the target server, and write it to the Remote Trail ./dirdat/px:

    GGSCI> edit param pfuncs

    vi starts and opens the pfuncs.prm file. Add the following run-time parameters to the text file: EXTRACT PFUNCS RMTHOST , MGRPORT 15001, COMPRESS RMTTRAIL ./dirdat/px PASSTHRU TABLE west.*;

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 12

    Save and close the file.

    8. Add the Extract Group by executing the following GGSCI commands: GGSCI> add extract pfuncs, exttrailsource ./dirdat/ex GGSCI> add rmttrail ./dirdat/px, extract pfuncs, megabytes 1

    Setting Up the Second GoldenGate Extract Data Pump (PFUNCA) 9. On the source server (GG_AMER_HOME terminal window), configure the second Extract Data

    Pump to read from the Local Extract Trail ./dirdat/ec, transmit the data to the target server, and write it to the Remote Trail ./dirdat/pc:

    GGSCI> edit param pfunca

    vi starts and opens the pfunca.prm file. Add the following run-time parameters to the text file: EXTRACT PFUNCA RMTHOST , MGRPORT 15001, COMPRESS RMTTRAIL ./dirdat/pc PASSTHRU TABLE west.*;

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 13

    10. Add the Extract Group by executing the following GGSCI commands:

    GGSCI> add extract pfunca, exttrailsource ./dirdat/ec GGSCI> add rmttrail ./dirdat/pc, extract pfunca, megabytes 1

    Creating the GoldenGate Checkpoint Table On the target server, Replicat checkpoints to a special table created in the database. This Checkpoint Table ensures that the Replicat checkpoint is part of the transaction and is used to ensure data integrity. If it does not already exist, create the Checkpoint Table: 11. On the target server (GG_EURO_HOME terminal window), start GGSCI and execute the

    following commands: GGSCI> dblogin userid gguser, password oracle_4U GGSCI> info checkpointtable GGSCI> add checkpointtable

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 14

    Setting Up GoldenGate Delivery (Two Replicats: RFUNCA and RFUNC) 12. On the target server (GG_EURO_HOME terminal window), configure the Replicat Delivery

    components: GGSCI> edit param rfunca

    vi starts and opens the rfunca.prm file. Add the following run-time parameters to the text file: NOLIST INCLUDE ./dirmac/macrolib.mac LIST REPLICAT RFUNCA #dbconnect () SOURCEDEFS ./dirdef/section13.defs DISCARDFILE ./dirrpt/rfunca.dsc, purge #bpsettings () #funcsmap (west.wshop_funcs, east.wshop_funcs) MAP west.cust_zip, TARGET east.cust_city_state, SQLEXEC (ID ZIPLKUP, QUERY " select zip_city, zip_state from east.zip_lookup where zip = :vzip ", PARAMS (vzip = cust_zip)), COLMAP (usedefaults, cust_city = @GETVAL (ZIPLKUP.zip_city), cust_state = @GETVAL (ZIPLKUP.zip_state) );

    Save and close the file.

    13. In the GG_EURO_HOME terminal window, at the GGSCI prompt execute the command:

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 15

    GGSCI> edit param rfunc

    vi starts and opens the rfunc.prm file. Add the following run-time parameters to the text file: REPLICAT RFUNC USERID gguser, PASSWORD oracle_4U ASSUMETARGETDEFS DISCARDFILE ./dirrpt/rfunc.dsc, PURGE DECRYPTTRAIL MAP west.*, TARGET east.*;

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 16

    Save and close the file.

    14. Add the Replicats by executing the following GGSCI command: GGSCI> dblogin userid gguser, password oracle_4U GGSCI> add replicat rfunc, exttrail ./dirdat/px GGSCI> add replicat rfunca, exttrail ./dirdat/pc

    Generating Transactions 15. Ensure on both systems that the manager is up and running (if not, start the Manager):

    GGSCI> info mgr GGSCI> start mgr

    16. In the GG_AMER_HOME window, start all of the extracts: GGSCI> start er *

    Verify that all process are running by executing the info er * command.

    17. In the GG_EURO_HOME window, start all of the Replicats:

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 17

    GGSCI> start er *

    Verify that all process are running by executing the info er * command. Exit GGSCI. Note: The Replicats may already be running if the mgr.prm was not deleted in an earlier lab.

    18. In the GG_AMER_HOME terminal window, navigate to the /home/oracle/labs/Section13/sqlscripts directory. At the Linux shelI prompt, generate source database transactions by executing the following command:

    Shell> sqlplus west/oracle_4U @trans_generator.sql Validating the Results Verify that the data applied to the target wshop_encrypt table from the encrypted GoldenGate Trails is the same as the source data. 19. In the GG_AMER_HOME terminal window, at the shell prompt start sqlplus and query the

    wshop_encrypt table: Shell> sqlplus west/oracle_4U SQL> select * from wshop_encrypt;

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 18

    20. In the GG_EURO_HOME terminal window, at the shell prompt start sqlplus and query the

    wshop_encrypt table: Shell> sqlplus east/oracle_4U SQL> select * from wshop_encrypt;

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 19

    Each table should contain 10 rows of encrypted equivalent data.

    Validating the Token, Macro and SQLEXEC Information 21. In the GG_AMER_HOME terminal window, view the efuncs.prm parameter file. Four user

    defined tokens will be added to each record captured for this table. TKN-EXTLAG-MSEC uses the function @GETENV (all GoldenGate function names begin

    with the @ character) to get the Extract database lag from the GoldenGate environment.

    TKN-SRC-DBNAME gets the source database name from the database environment. TKN-SRC-DBVERSION gets the source database version from the database

    environment. TKN-TXN-CSN gets the commit sequence number for the transaction from the

    database.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 20

    22. In the GG_EURO_HOME terminal window, view the rfunca.prm parameter file:

    The MAP statement for the wshop_funcs table utilizes the #funcsmap macro:

    This macro uses two column conversion functions: @GETENV to get the commit timestamp from the GoldenGate header record and Replicat lag from the GoldenGate environment, and @TOKEN to get the tokens set by the source Extract. Also notice that for the rfunca parameters, the map statement for east.cust_zip uses the SQLEXEC option to query a lookup table. For every west.cust_zip record, the query will be executed using the incoming data for the cust_zip column in the where clause. The returned data is mapped into the target zip_city and zip_state columns.

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 21

    23. On the target database (GG_EURO_HOME terminal window), execute the command from a shell prompt:

    Shell> sqlplus east/oracle_4U Verify that the token data was applied to the target by executing the following command: SQL> select src_db_name, src_db_version, src_txn_csn from wshop_funcs;

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 22

    Now execute the command: SQL> select lag_extract_ms, lag_replicat_ms from wshop_funcs;

    In the above example, Extract took 2642 milliseconds to capture each record from Oracle redo, while Replicat lag time (Replicat current time transaction commit timestamp) was around 6615 milliseconds. (Your values may vary.) To return the data that was recorded as the source record commit timestamp, execute the following command: SQL> select gg_commit_ts from wshop_funcs;

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 23

    Back in the GG_AMER_HOME terminal window, execute the following command: Shell> sqlplus west/oracle_4U SQL> select * from cust_zip;

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 13: Configuration Options Chapter 13 - Page 24

    Verify the SQLEXEC functionality by executing the following command in the GG_EURO_HOME terminal window: SQL> select * from cust_city_state;

    24. Clean up the GoldenGate environment by executing the following GGSCI commands on both the source and target servers:

    GGSCI> STOP er * GGSCI> DBLOGIN userid gguser, password oracle_4U GGSCI> DELETE er * GGSCI> DELETE checkpointtable (only for the EURO db) GGSCI> STOP mgr ! SHELL> rm ./dirdat/* SHELL> rm ./dirrpt/*

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 14: Bidirectional Replication Chapter 14 - Page 1

    Practices for Lesson 14: Bidirectional Replication Chapter 14

  • Copyright 2011, Oracle and/or its affiliates. All rights reserved.

    Practices for Lesson 14: Bidirectional Replication Chapter 14 - Page 2

    Practices for Lesson 14: Overview

    Practices Overview In this practice, we shall configure GoldenGate to perform real-time data capture and apply to two active databases with data segregated by location.

    In the preceding diagram, the AMER and EURO databases are exact copies of one another. Our application is load-balanced across the two data centers so that each data center services 50% of all active accounts. Each data center is also the backup to the other, so the two databases must always be in sync. This is accomplished by configuring GoldenGate in Active-Active mode, with Change Data Capture Extracts reading from each databases Redo and Archive lo