D66519GC20_ag

March 23, 2018 | Author: aeterom | Category: Oracle Database, Sql, Databases, Computer File, Parameter (Computer Programming)


Comments



Description

Fundamentals for OracleActivity Guide D66519GC20 Edition 2.0 June 2012 D77992 Oracle Internal & Oracle Academy Use Only Oracle GoldenGate 11g: Author Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Steve Friedberg Disclaimer Susan Jang Randy Richeson Doug Reid Chris Lawless Joe deBuzna Helen Haldeman Mark Geisler Kelly Carr Rick Green Kee Gan Volker Zell Editors Vijayalakshmi Narasimhan Anwesha Ray Richard Wallis Graphic Designer Rajiv Chandrabhanu Publishers Sujatha Nagendra Michael Sebastian 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. Government’s 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. Oracle Internal & Oracle Academy Use Only Technical Contributors and Reviewers Table of Contents Practices for Lesson 1: Introduction ........................................................................................................ 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 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-8 Practice 5-3: Configuring and Starting Oracle GoldenGate Manager ......................................................... 5-9 Practice 5-4: Using the TranData option................................................................................................... 5-11 Practices for Lesson 6: Configuring Change Capture ............................................................................. 6-1 Practices for Lesson 6: Overview............................................................................................................. 6-2 Practice 6-1: Setting Up the Extract and ExtTrail ...................................................................................... 6-3 Practice 6-2: Setting Up an Extract Data Pump and Starting the Two Extracts .......................................... 6-5 Practices for Lesson 7: Configuring Change Delivery ............................................................................. 7-1 Practices for Lesson 7: Overview............................................................................................................. 7-2 Practice 7-1: Setting Up the Checkpoint Table on the Target System ........................................................ 7-3 Practice 7-2: Setting Up Replicat Delivery ................................................................................................ 7-4 Practice 7-3: Generating Data and Starting GoldenGate Processes .......................................................... 7-5 Practice 7-4: Stopping Processes and Checking Statistics........................................................................ 7-10 Practices for Lesson 8: Extract Trail and Files ........................................................................................ 8-1 Practices for Lesson 8: Overview............................................................................................................. 8-2 Practice 8-1: Using the logdump Utility..................................................................................................... 8-3 Practices for Lesson 9: Configuring Initial Load...................................................................................... 9-1 Practices for Lesson 9: Overview............................................................................................................. 9-2 Practice 9-1: Setting Up the Initial Load by Using the File to Replicat Method............................................ 9-3 Practice 9-2: Setting Up the Initial Data Load by Using the Direct Load Method......................................... 9-8 Practice 9-3: Putting it All Together .......................................................................................................... 9-13 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-4 Practice 10-3: Modifying the Extract Parameters on the Source Database ................................................ 10-6 Practices for Lesson 11: Data Selection and Filtering ............................................................................. 11-1 Practices for Lesson 11 ........................................................................................................................... 11-2 Practice 11-1: Increasing Performance by Splitting Replication Loads....................................................... 11-3 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Oracle GoldenGate 11g: Fundamentals for Oracle Table of Contents iii Oracle Internal & Oracle Academy Use Only Practices for Lesson 4: Installing Oracle GoldenGate ............................................................................. 4-1 Practices for Lesson 4: Overview............................................................................................................. 4-2 Practice 4-1: Preparation......................................................................................................................... 4-3 Practice 4-2: Installing Oracle GoldenGate............................................................................................... 4-7 Practice 4-3: Introduction to the GGSCI Command Interface .................................................................... 4-11 .............. Oracle GoldenGate 11g: Fundamentals for Oracle Table of Contents iv Oracle Internal & Oracle Academy Use Only Practices for Lesson 14: Bidirectional Replication ....................................................... 14-1 Practices for Lesson 14: Overview ..................... 13-3 Practice 13-2: Oracle GoldenGate Encryption ............. 15-1 Practices for Lesson 15: Overview ........... 15-2 Practice 15-1: DDL Replication Database Setup .................................... 14-15 ........ 13-7 Practice 13-3: Generating Transactions and Validating Results ................. 13-2 Practice 13-1: Setting Up the Database and Source Definitions File...... 13-14 Practices for Lesson 15: DDL Replication... 12-3 Practices for Lesson 13: Configuration Options............................................................................................................................................................................................... 12-2 Practice 12-1: Modifying an Existing Set of Macros and User Tokens ................................................................................................................................... 15-7 Copyright © 2012....................................................................... 12-1 Practices for Lesson 12: Overview ........................................................ Oracle and/or its affiliates.................. 15-3 Practice 15-2: DDL Replication Oracle GoldenGate Setup....................................................................................................................... 14-2 Practice 14-1: Two-Way Active-Active Data Replication ................................................................................................................................ 14-3 Practice 14-2: Conflict Detection and Resolution ........................................................................................................................................................................... 13-1 Practices for Lesson 13: Overview ...........................................................................................................................Practices for Lesson 12: Additional Transformation Topics ................... All rights reserved.......................................................................................................................................... Chapter 1 Copyright © 2012. Practices for Lesson 1: Introduction Chapter 1 .Page 1 Oracle Internal & Oracle Academy Use Only Practices for Lesson 1: Introduction . Oracle and/or its affiliates. All rights reserved. Practices for Lesson 1: Introduction Chapter 1 . Copyright © 2012. Oracle and/or its affiliates. All rights reserved.Practices for Lesson 1 Overview Oracle Internal & Oracle Academy Use Only There are no practices for this lesson.Page 2 . Chapter 2 Copyright © 2012. Practices for Lesson 2: Technology Overview Chapter 2 .Page 1 Oracle Internal & Oracle Academy Use Only Practices for Lesson 2: Technology Overview . Oracle and/or its affiliates. All rights reserved. Practices for Lesson 2: Technology Overview Chapter 2 . All rights reserved.Practices for Lesson 2 Overview Oracle Internal & Oracle Academy Use Only There are no practices for this lesson.Page 2 . Copyright © 2012. Oracle and/or its affiliates. All rights reserved.Page 1 Oracle Internal & Oracle Academy Use Only Practices for Lesson 3: Oracle GoldenGate Architecture .Chapter 3 Copyright © 2012. Practices for Lesson 3: Oracle GoldenGate Architecture Chapter 3 . Oracle and/or its affiliates. Practices for Lesson 3: Oracle GoldenGate Architecture Chapter 3 . Copyright © 2012.Practices for Lesson 3 Overview Oracle Internal & Oracle Academy Use Only There are no practices for this lesson. All rights reserved. Oracle and/or its affiliates.Page 2 . Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 .Chapter 4 Copyright © 2012. Oracle and/or its affiliates. All rights reserved.Page 1 Oracle Internal & Oracle Academy Use Only Practices for Lesson 4: Installing Oracle GoldenGate . You also install the Oracle GoldenGate software to be used with both the AMER and EURO databases. Oracle and/or its affiliates.Practices for Lesson 4: Overview Practices Overview Oracle Internal & Oracle Academy Use Only In these practices. Copyright © 2012. Then you are briefly introduced to the command-line interface (GGSCI). you become familiar with the lab environment that you will be using for the duration of the class. All rights reserved.Page 2 . Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 . You should be able to ping both hosts. Oracle and/or its affiliates. and you should use those names in place of localhost so that you can clearly indicate source and target hosts. All rights reserved. each with its own structure and set of users. Conversely. the data tables in the EURO database are owned by the EAST user. These are physically different databases. as well as other users created specifically for this course. there are two host names defined in /etc/hosts: easthost and westhost.Practice 4-1: Preparation There are two databases configured on your machine: AMER and EURO. Operating System Type Linux <userid> oracle <password> oracle AMER Database (Source) <login> west <password> oracle_4U <oracle_sid> amer <GG_AMER_HOME> /u01/app/oracle/gg_amer Manager <port> 15000 EURO Database (Target) <login> east Copyright © 2012. enter the following command at the operating system prompt: [OS_prompt ~] sqlplus system@amer The password for all database accounts for this course is oracle_4U. Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 . you sometimes need to connect to one of your databases using SQL*Plus. Even though there is only one PC for each practice team. In the practices for this course. To connect to the AMER database as the system user using SQL*Plus. Each database has administrative users. such as system. 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. The data tables that you create and populate in the AMER database that you use in this course are owned by the WEST user.Page 3 Oracle Internal & Oracle Academy Use Only Overview . Page 4 Oracle Internal & Oracle Academy Use Only GoldenGate .source> /u01/app/oracle/gg_amer GoldenGate <install location . and a PDF version that you can view at /home/oracle/labs/docs/E28323_01/doc.com/cd/E28323_01/index. 3.target> /u01/app/oracle/gg_euro 1. To set up your working environment. You can view the online version at http://docs. Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 . [OS_prompt] cd /u01/app/oracle [OS_prompt] mkdir gg_amer [OS_prompt] mkdir gg_euro Copyright © 2012. Enter the following commands: [OS_prompt] cd ~/labs/docs [OS_prompt] unzip /stage/E28323_01. create two directories to hold the Oracle GoldenGate software. All rights reserved.zip 4. Oracle and/or its affiliates.<password> oracle_4U <oracle_sid> euro <GG_EURO_HOME> /u01/app/oracle/gg_euro Manager <port> 15001 <software location> /stage GoldenGate <install location .1121 using Adobe Reader or equivalent.htm . Log in to your designated Linux machine with the following information: 1) Username: oracle 2) Password: oracle 2. This created an HTML version that you can view with any web browser at /home/oracle/labs/docs/E28323_01/index. Double-click the Terminal icon located on your Linux desktop. create terminal windows to make it easier to navigate between the source and target databases: a. As the user oracle.htm. Create a local copy of the documentation.oracle. Copyright © 2012. select Set Title. Do whatever works best for you. (This is the directory where Oracle GoldenGate will be installed. In the GG_AMER_HOME window. keep both of these windows open to easily toggle between the two databases. All rights reserved.  GG_AMER_HOME [OS_prompt ~] cd $GG_AMER_HOME [OS_prompt gg_amer] pwd /u01/app/oracle/gg_amer 7.) Note: For many of the practices. . Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 . and EAST_SQLPLUS. Set the name of the terminal window to GG_AMER_HOME. Verify that you are in the proper directory. _ Create another terminal window for the euro database. EURO_GGSCI. 6. Navigate to the $GG_EURO_HOME directory. you could accept it without change by just pressing Enter. Note the leading period before the oraenv command. oraenv ORACLE_SID = [amer] ? amer The Oracle base remains unchanged with value /u01/app/oracle Note: Since the current value is already amer. Set the Oracle database environment variables for amer. 8. and then leave all four tabs open all the time.Page 5 Oracle Internal & Oracle Academy Use Only 5. WEST_SQLPLUS. naming it GG_EURO_HOME by performing the preceding steps.From the Terminal menu. Oracle and/or its affiliates. You can use separate windows or multiple tabs on a single window (whichever you prefer). enter the following commands: [OS_prompt gg_amer] pwd /u01/app/oracle/gg_amer [OS_prompt gg_amer] . You might find it easier to make four tabs in one full-screen window: AMER_GGSCI. Navigate to the $GG_AMER_HOME directory (where the Oracle GoldenGate software will be installed). enter the following commands: [OS_prompt gg_euro] pwd /u01/app/oracle/gg_euro [OS_prompt gg_euro] . Set the Oracle database environment variables for euro. Note the leading period before the oraenv command. Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 . This completes Practice 4-1. Copyright © 2012. You now continue with Practice 4-2. But if you ever run the command again in the same window/tab. Oracle and/or its affiliates. In the GG_EURO_HOME window. All rights reserved. oraenv ORACLE_SID = [amer] ? euro The Oracle base remains unchanged with value /u01/app/oracle Oracle Internal & Oracle Academy Use Only Note: The first time you must change the value to euro.Page 6 . you can accept euro without change by just pressing Enter.9. All rights reserved.HPUX UserExitExamples/ExitDemo_more_recs/Makefile_more_recs.2. bold monospace font.1. However.txt [OS_prompt gg_amer] Copyright © 2012. many lines omitted for clarity .zip [OS_prompt gg_amer] unzip /stage/V* Archive: /stage/V30796-01. Extract the . Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 .pdf inflating: Oracle GoldenGate 11.LINUX .h zlib. 1.sql usrdecs.tar inflating: OGG_WinUnix_Rel_Notes_11.Practice 4-2: Installing Oracle GoldenGate Overview In this practice. the commands that you should type are always indicated by full-sized. unzip the .. ucharset...0 README. Oracle and/or its affiliates.0.h ulg.zip inflating: fbo_ggs_Linux_x64_ora11g_64bit. Note: Some parts of the screenshot feedback may be in a smaller font for clarity.0. In the GG_AMER_HOME terminal window.zip file by executing the following command: [OS_prompt] cd $GG_AMER_HOME [OS_prompt gg_amer] ls /stage/V* /stage/V30796-01.tar UserExitExamples/ UserExitExamples/ExitDemo_more_recs/ UserExitExamples/ExitDemo_more_recs/Makefile_more_recs.2. you install two Oracle GoldenGate instances: one to be used with the AMER database and the other to be used with the EURO database.Page 7 Oracle Internal & Oracle Academy Use Only Tasks ..tar file to the same (gg_amer) directory: [OS_prompt gg_amer] tar -xvof *.SOLARIS UserExitExamples/ExitDemo_more_recs/Makefile_more_recs.txt [OS_prompt gg_amer] 2.1. The GGSCI CREATE SUBDIRS command creates some or all of the following Oracle GoldenGate subdirectories: Directory dirchk dirdat dirdef 5. 2012. x64. All rights reserved.0.3./ggsci Oracle GoldenGate Command Interpreter for Oracle Version 11. Contents Oracle GoldenGate checkpoint files Oracle GoldenGate trail and extract files Source data definitions produced by defgen and used to translate heterogeneous data dirpcs Process status files dirout Directory that is no longer used dirprm Oracle GoldenGate parameter (runtime configuration) files dirrpt Process report files dirsql SQL scripts dirtmp Temporary storage for transactions that exceed memory dirver An Oracle GoldenGate Veridata directory.Page 8 dirprm dirrpt Oracle Internal & Oracle Academy Use Only Creating subdirectories under current directory /u01/app/oracle/gg_amer . Create the required subdirectories in the installation directory: [OS_prompt gg_amer] . All rights reserved. Oracle and/or its affiliates. Oracle 11g on Feb 1 2012 00:55:59 Copyright (C) 1995. Oracle and/or its affiliates.1910_FBO Linux.1.0_PLATFORMS_120131. Copyright © 2012. Verify that the GoldenGate directories were created: [OS_prompt gg_amer] ls -d dir* dirchk dirdat dirdef dirjar dirsql dirtmp [OS_prompt gg_amer] dirout dirpcs Leave this window open and proceed to the next window.0.1.0 OGGCORE_11. GGSCI (AMER) 1> Create Subdirs Parameter files Report files Checkpoint files Process status files SQL script files Database definitions files Extract data files Temporary files Stdout files /u01/app/oracle/gg_amer/dirprm: /u01/app/oracle/gg_amer/dirrpt: /u01/app/oracle/gg_amer/dirchk: /u01/app/oracle/gg_amer/dirpcs: /u01/app/oracle/gg_amer/dirsql: /u01/app/oracle/gg_amer/dirdef: /u01/app/oracle/gg_amer/dirdat: /u01/app/oracle/gg_amer/dirtmp: /u01/app/oracle/gg_amer/dirout: already exists created created created created created created created created GGSCI (AMER) 2> Exit 4. 64bit (optimized).2. Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 .2. This directory is not used unless this software is installed in the Oracle GoldenGate location. 6. Repeat steps 1–5 for the other directory to install the Oracle GoldenGate software in the GG_EURO_HOME directory. In the GG_EURO_HOME terminal window, unzip the .zip file by executing the following command: [OS_prompt] cd $GG_EURO_HOME [OS_prompt gg_euro] unzip /stage/V* Archive: /stage/V30796-01.zip inflating: fbo_ggs_Linux_x64_ora11g_64bit.tar inflating: OGG_WinUnix_Rel_Notes_11.2.1.0.0.pdf inflating: Oracle GoldenGate 11.2.1.0 README.txt [OS_prompt gg_euro] 7. Extract the .tar file into the same (gg_euro) directory: UserExitExamples/ UserExitExamples/ExitDemo_more_recs/ UserExitExamples/ExitDemo_more_recs/Makefile_more_recs.HPUX UserExitExamples/ExitDemo_more_recs/Makefile_more_recs.SOLARIS UserExitExamples/ExitDemo_more_recs/Makefile_more_recs.LINUX ... many lines omitted for clarity ... ucharset.h ulg.sql usrdecs.h zlib.txt [OS_prompt gg_euro] 8. Create the required subdirectories in the installation directory: [OS_prompt gg_euro] ./ggsci Oracle GoldenGate Command Interpreter for Oracle Version 11.2.1.0.0 OGGCORE_11.2.1.0.0_PLATFORMS_120131.1910_FBO Linux, x64, 64bit (optimized), Oracle 11g on Feb 1 2012 00:55:59 Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved. GGSCI (EURO) 1> Create Subdirs Creating subdirectories under current directory /u01/app/oracle/gg_euro Parameter files Report files Checkpoint files Process status files SQL script files Database definitions files Extract data files Temporary files Stdout files /u01/app/oracle/gg_euro/dirprm: /u01/app/oracle/gg_euro/dirrpt: /u01/app/oracle/gg_euro/dirchk: /u01/app/oracle/gg_euro/dirpcs: /u01/app/oracle/gg_euro/dirsql: /u01/app/oracle/gg_euro/dirdef: /u01/app/oracle/gg_euro/dirdat: /u01/app/oracle/gg_euro/dirtmp: /u01/app/oracle/gg_euro/dirout: GGSCI (EURO) 2> Exit Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 9 already exists created created created created created created created created Oracle Internal & Oracle Academy Use Only [OS_prompt gg_euro] tar -xvof *.tar 9. Note: If you enter which ggsci at an OS prompt, you see that the search path happens to pick up the binary in amer first, even though you wanted the one in euro. If you had omitted ./ before the ggsci command, it would have appeared to work, but it would have created the directories under the wrong parent folder! The GGSCI CREATE SUBDIRS command creates the following Oracle GoldenGate subdirectories: Contents Oracle GoldenGate checkpoint files Oracle GoldenGate trail and extract files Source data definitions produced by defgen and used to translate heterogeneous data dirpcs Process status files dirout Directory that is no longer used dirprm Oracle GoldenGate parameter (runtime configuration) files dirrpt Process report files dirsql SQL scripts dirtmp Temporary storage for transactions that exceed memory dirver An Oracle GoldenGate Veridata directory. This directory is not used unless this software is installed in the Oracle GoldenGate location. 10. Verify that the Oracle GoldenGate directories were created: [OS_prompt gg_euro] ls -d dir* dirchk dirdat dirdef dirjar dirout dirpcs dirprm dirrpt dirsql dirtmp [OS_prompt gg_euro] Leave both windows open. This completes Practice 4-2. You now continue with Practice 4-3. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 10 Oracle Internal & Oracle Academy Use Only Directory dirchk dirdat dirdef Practice 4-3: Introduction to the GGSCI Command Interface Overview In this practice, you learn how to invoke the Oracle GoldenGate command interface (GGSCI) and how to access online help for all commands. This can be done using either the AMER database or the EURO database. Assumptions The interchangeability of the databases assumes that they are not currently running any GGSCI commands. 1. How you invoke GGSCI depends on the settings in your profile. From the /home/oracle directory, review the .bashrc file. Make certain that the ORACLE_HOME, GG_AMER_HOME, and GG_EURO_HOME system environment variables are set to the correct directories. The Oracle 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. [OS_prompt gg_amer] cd ~ [OS_prompt ~] more .bashrc # .bashrc # User specific aliases and functions # alias ll='ls -l' # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi ORACLE_BASE=/u01/app/oracle ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 GG_AMER_HOME=/u01/app/oracle/gg_amer GG_EURO_HOME=/u01/app/oracle/gg_euro GG_DS_HOME=/u01/app/oracle/gg_director_server GG_DC_HOME=/u01/app/oracle/gg_director_client GG_MONI_HOME=/u01/app/oracle/gg_moni JAVA_HOME=/usr/java/jdk1.6.0_25 PATH=$JAVA_HOME/bin:$ORACLE_HOME/bin:$GG_AMER_HOME:$GG_EURO_HOME:$PATH:$HOME/b in LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64/server/:$ORACLE_HOME/lib ORACLE_SID=amer PATH=$ORACLE_HOME/bin:$PATH:$LD_LIBRARY_PATH CLASSPATH=$ORACLE_HOME/jdbc/lib/ojdbc5.jar:$ORACLE_HOME/jlib/orai18n.jar export PATH export ORACLE_BASE ORACLE_HOME ORACLE_SID GG_AMER_HOME GG_EURO_HOME export GG_DC_HOME GG_DS_HOME GG_MONI_HOME Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 - Page 11 Oracle Internal & Oracle Academy Use Only Tasks 1. They are not used in this course. All rights reserved.Page 12 Oracle Internal & Oracle Academy Use Only [OS_prompt gg_amer] . All rights reserved.2. Oracle and/or its affiliates. 64bit (optimized). Be aware of the leading dot for oraenv: [OS_prompt ~] cd $GG_AMER_HOME [OS_prompt gg_amer] .0. Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 .2.0. x64. GGSCI (AMER) 1> Copyright © 2012. Oracle and/or its affiliates. Launch the GGSCI command interface./ggsci . Note: Some of the Management Pack variables for Director and Monitor are set as well.1. 2012. Oracle 11g on Feb 1 2012 00:55:59 Copyright (C) 1995.0_PLATFORMS_120131. oraenv ORACLE_SID = [amer] ? The Oracle base remains unchanged with value /u01/app/oracle Oracle GoldenGate Command Interpreter for Oracle Version 11.0 OGGCORE_11.1910_FBO Linux.export CLASSPATH LD_LIBRARY_PATH JAVA_HOME [OS_prompt ~] 2. ) i. KILL. SEND. or some kind of page-at-a-time pause command. INFO ADD. Oracle and/or its affiliates. VERSIONS. VIEW ADD. type HELP <command> <object>. STATUS. START. HISTORY. SEND. STATUS INFO EDIT. CLEANUP. KILL. ALTER.Page 13 Oracle Internal & Oracle Academy Use Only GGSCI Command Summary: . DELETE. DELETE. STOP ADD. START. STOP. HELP. INFO VIEW INFO. DELETE. INFO Commands without an object: (Database) DBLOGIN. STOP UNREGISTER ADD. SEND. there is no way to pipe the very long help output into more. ALTER.e. OBEY. INFO ADD. ! (note: you must type the word COMMAND after the ! to display the ! help topic. STATUS. Example: HELP ADD REPLICAT GGSCI (AMER) 2> Help All 4. ENCRYPT PASSWORD. View a HELP summary for all commands: GGSCI (AMER) 1> Help Object: SUBDIRS ER EXTRACT EXTTRAIL GGSEVT MANAGER MARKER PARAMS REPLICAT REPORT RMTTRAIL TRACETABLE TRANDATA SCHEMATRANDATA CHECKPOINTTABLE Command: CREATE INFO. Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 . Copyright © 2012. LIST TABLES. FLUSH SEQUENCE MININGDBLOGIN (DDL) DUMPDDL (Miscellaneous) FC. KILL. CLEANUP.: GGSCI (sys1)> help ! command For help on a specific command. STATUS. View a HELP summary for a command or entity (some of the screenshots are too long to include): GGSCI (AMER) 3> Help Add Extract GGSCI (AMER) 4> Help Add ExtTrail Unfortunately. LAG. STOP VIEW ADD.3. REGISTER. INFO ALL. SHOW. DELETE. ALTER. INFO ADD. DELETE. INFO. START. SEND. DELETE. START. STATS. All rights reserved. LAG. SHELL. INFO ADD. ALTER. DELETE. LAG. SET EDITOR. INFO. CLEANUP. DELETE. STATS. STATS. 5. the report becomes more interesting. All rights reserved. enter exclamation (bang) and the line number. To repeat a command (for example. Copyright © 2012. 7. the third one). View your command history: GGSCI (AMER) 5> History GGSCI Command History 1: 2: 3: 4: 5: Help Help All Help Add Extract Help Add ExtTrail History 6. Exit GGSCI. Practices for Lesson 4: Installing Oracle GoldenGate Chapter 4 . Oracle and/or its affiliates. Stop here. as in the following example: !3 View a brief informational summary of all processes: GGSCI (AMER) 6> Info All Program Status MANAGER STOPPED Group Lag at Chkpt Time Since Chkpt GGSCI (AMER) 7> You run this Info All command many times as the practices progress.Page 14 Oracle Internal & Oracle Academy Use Only GGSCI (AMER) 6> . This completes Practice 4-3. When other processes are configured and running. Oracle and/or its affiliates. Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 .Chapter 5 Copyright © 2012.Page 1 Oracle Internal & Oracle Academy Use Only Practices for Lesson 5: Configuration Overview and Preparing the Environment . All rights reserved. Oracle GoldenGate provides log-based change data capture (CDC) and replication of committed database transactions. you create the objects that are shaded (source database. In this practice. .Page 2 Oracle Internal & Oracle Academy Use Only In these practices. All rights reserved.prm files): Copyright © 2012. target database. and mgr. Oracle and/or its affiliates. You also configure and start the Manager process on both instances of Oracle GoldenGate. transformation. Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 . and delivery of transactional data across heterogeneous environments in real time. you begin the process of setting up one-way data replication by creating and populating your databases.Practices for Lesson 5: Overview Practices Overview Big Picture The following figure depicts the simplified Oracle GoldenGate implementation that you create. routing. The software provides capture. . Oracle Label Security. you can ignore those messages. As with many Oracle PL/SQL scripts. you run the source_database. you set up the databases (AMER and EURO) and configure Oracle GoldenGate to work specifically with the Oracle databases.Page 3 Oracle Internal & Oracle Academy Use Only Assumptions . However. Oracle Database Vault and Real Application Testing options Table dropped. navigate to the ~/labs/Section5/sqlscripts directory. Copyright © 2012.sql SQL*Plus: Release 11. In this practice. The AMER database (the source database) has the west/oracle_4U user already created.. Oracle and/or its affiliates. Data Mining. Oracle.sql script on the AMER database and the target_database. Connected to: Oracle Database 11g Enterprise Edition Release 11. many lines omitted for clarity .Practice 5-1: Preparing Your Environment Overview In this practice. All rights reserved.sql source_database. Two core databases are already installed: AMER and EURO.0 Production on Wed Apr 25 11:10:03 2012 Copyright (c) 1982. the commands that you should type are always indicated by full-sized. 2011. .0 .0. OLAP.3. At the OS prompt.0. Switch to the GG_AMER_HOME window. Tasks 1. bold monospace font.sql [OS_prompt] sqlplus west/oracle_4U @source_database. Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 . and the EURO database has the east/oracle_4U user also already created. issue the following command: [OS_prompt ~] cd ~/labs/Section5/sqlscripts/ [OS_prompt sqlscripts] ls seed_database. a first attempt to drop a non-existent table gives an “error” that the table or view does not exist.2. Both of these scripts 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.sql script on the EURO database. Note: Some parts of the screenshot feedback may be in a smaller font for clarity. All rights reserved..2. For these setup scripts.sql target_database.3. To create the source database for AMER.. The data tables in the EURO database are owned by the EAST user.64bit Production With the Partitioning. .. OLAP. An Oracle GoldenGate user requires a database user with at least the following privileges: User Privilege Extract (Source Side) Replicat (Target Side) CREATE SESSION.0. OLAP. 3. in the GG_EURO_HOME terminal window. Oracle Database Vault and Real Application Testing options Table dropped.. 2011. navigate to the /home/oracle/labs/Section5/sqlscripts directory.Page 4 X X Oracle Internal & Oracle Academy Use Only Table truncated. Data Mining. Connected to: Oracle Database 11g Enterprise Edition Release 11.table> X INSERT.0.64bit Production With the Partitioning.0. To create the data tables on the EURO database.2.0. Oracle. Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 . run the following command from the same directory (/home/oracle/labs/Section5/sqlscripts): [OS_prompt] sqlplus west/oracle_4U @seed_database.sql SQL*Plus: Release 11.. All rights reserved. Execute the following commands: [OS_prompt] cd ~/labs/Section5/sqlscripts/ [OS_prompt] sqlplus east/oracle_4U @target_database. .3. many lines omitted for clarity . Oracle.2.0 Production on Wed Apr 25 11:10:03 2012 Copyright (c) 1982.0 Production on Wed Apr 25 11:10:03 2012 Copyright (c) 1982. Don’t do this step―just read it! Create an Oracle GoldenGate user that can connect to the source and target databases for transactional data. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.table> X SELECT ANY TABLE or SELECT ON <owner. Oracle Label Security.0 . 4.. DELETE ON <target tables> Copyright © 2012. many lines omitted for clarity .. Oracle and/or its affiliates. Oracle Label Security.sql SQL*Plus: Release 11. UPDATE.64bit Production With the Partitioning. 2011. Data Mining.2.2..0 .3.3.3. .. Oracle Database Vault and Real Application Testing options . ALTER SESSION X X RESOURCE X X SELECT ANY DICTIONARY X X FLASHBACK ANY TABLE or FLASHBACK ON <owner. To populate the tables on the AMER database. All rights reserved.2. . SQL> exit For the EURO database: [OS_prompt sqlscripts] sqlplus / as sysdba SQL*Plus: Release 11. Oracle Database Vault and Real Application Testing options SQL> GRANT dba TO gguser IDENTIFIED BY oracle_4U.3. OLAP.Page 5 Oracle Internal & Oracle Academy Use Only EXEC DBMS_GOLDENGATE_AUTH. (shows "help" syntax text by convention) 5.User Privilege Extract (Source Side) Replicat (Target Side) X CREATE TABLE EXECUTE on DBMS_FLASHBACK package X In addition to the above privileges. 2011.64bit Production With the Partitioning.3. Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 .64bit Production With the Partitioning.2. Create a DBA-level user (gguser/oracle_4U) on both the AMER and EURO databases. Connected to: Oracle Database 11g Enterprise Edition Release 11. Oracle. In a real-world situation. you give ggsuser the DBA role (which is more than what would have been granted in the previous step).0.2. Oracle.TRUE).0.2. All rights reserved.2. Oracle Label Security.0 Production on Wed Apr 25 11:10:03 2012 Copyright (c) 1982. To make the practices easier in the classroom. Data Mining. Oracle Database Vault and Real Application Testing options Copyright © 2012. Data Mining. you would normally run: (Optional) To learn about DBMS_GOLDENGATE_AUTH syntax.3.'*'.0 Production on Wed Apr 25 11:10:03 2012 Copyright (c) 1982. OLAP. enter the following commands: [OS_prompt] sqlplus / as sysdba SQL> set pages 100 SQL> desc dbms_goldengate_auth SQL> SELECT text FROM all_source WHERE name='DBMS_GOLDENGATE_AUTH'.0 . Connected to: Oracle Database 11g Enterprise Edition Release 11. Oracle Label Security. you would not grant that many privileges.3. All rights reserved. Oracle and/or its affiliates. 2011. Instead of doing all that work.GRANT_ADMIN_PRIVILEGE('GGUSER'. All rights reserved. the next step will “cheat” for purposes of this practice.0 .0. Grant succeeded. For the AMER database: [OS_prompt sqlscripts] sqlplus / as sysdba SQL*Plus: Release 11.0. switch the logs by executing the following command: ALTER SYSTEM SWITCH LOGFILE. Log in to SQL*Plus as gguser/oracle_4U. All rights reserved. d. 2011. gguser. On the EURO database. log out of SQL and log back in with the new user.0.2. Data Mining. Verify that supplemental logging is enabled at the database level via the following command. 6. On the AMER database. All rights reserved. b. To enable supplemental logging at the database level. Oracle Database Vault and Real Application Testing options SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA. To ensure that the redo and archive logs contain supplemental log data. The results should look similar to this: [OS_prompt sqlscripts] sqlplus gguser/oracle_4U SQL*Plus: Release 11. Database altered. (Note: Output of the query must be YES or IMPLICIT. do the following: a.3. gguser. log out of SQL and then log back in with the new user. Grant succeeded. SQL> SELECT supplemental_log_data_min FROM v$database. Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 . c. Oracle and/or its affiliates.Page 6 Oracle Internal & Oracle Academy Use Only SQL> exit . OLAP.64bit Production With the Partitioning. Minimal supplemental logging must be enabled at the database level to allow Oracle GoldenGate to Copyright © 2012.3. Exit SQL. Enable minimal supplemental logging by executing the following command: ALTER DATABASE ADD SUPPLEMENTAL LOG DATA. SQL> ALTER SYSTEM SWITCH LOGFILE.2. Connected to: Oracle Database 11g Enterprise Edition Release 11. System altered. Minimal supplemental logging must be enabled at the database level to allow Oracle GoldenGate to properly capture updates to primary keys and chained rows. Oracle Label Security.0 .0 Production on Wed Apr 25 11:10:03 2012 Copyright (c) 1982.) SELECT supplemental_log_data_min FROM v$database.0. SUPPLEME -------YES SQL> exit 7. Oracle.SQL> GRANT dba TO gguser IDENTIFIED BY oracle_4U. (Note: Output of the query must be YES or IMPLICIT. . All rights reserved.c. Verify that supplemental logging is enabled at the database level via the following command. Log in or connect to SQL*Plus as gguser/oracle_4U.Page 7 Oracle Internal & Oracle Academy Use Only properly capture updates to primary keys and chained rows. You now continue with Practice 5-2. Copyright © 2012. To enable supplemental logging at the database level. do the following: a. switch the logs by executing the following command: ALTER SYSTEM SWITCH LOGFILE. b. Exit SQL. To ensure that the redo and archive logs contain supplemental log data. d. Enable minimal supplemental logging by executing the following command: ALTER DATABASE ADD SUPPLEMENTAL LOG DATA.) SELECT supplemental_log_data_min FROM v$database. Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 . Oracle and/or its affiliates. This completes Practice 5-1. also make use of the GLOBALS file. Oracle and/or its affiliates. [OS_prompt [OS_prompt ORACLE_SID The Oracle [OS_prompt ~] cd $GG_EURO_HOME gg_euro] . Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 . You now continue with Practice 5-3. In this practice. Start gedit (or vi if you prefer) to open a new GLOBALS file located in the directory of your Oracle GoldenGate instance. Add the following runtime parameters to the GLOBALS file. The file name must be all UPPERCASE with no extension. Replicat checkpoints to a table in the database that is defined in a special parameter file named GLOBALS. be sure to include the leading dot-space for oraenv. Tasks In the GG_EURO_HOME terminal window. All rights reserved. Other Oracle GoldenGate products. you create a GLOBALS parameter file located on the target database (EURO). create a GLOBALS parameter file by executing the following commands. This completes Practice 5-2. but it is not necessary at this time. As always. which you use in a later practice: CheckpointTable GGS_CHECKPOINT 3. Copyright © 2012. Save and close the file. .Practice 5-2: Creating the GLOBALS Parameter File Overview On the target side.Page 8 Oracle Internal & Oracle Academy Use Only 1. such as Monitor from the Management Pack. oraenv = [euro] ? euro base remains unchanged with value /u01/app/oracle gg_euro] gedit GLOBALS 2. Note: There is no harm or benefit in creating a GLOBALS file on the source side as well. 2. The Oracle GoldenGate Manager process performs several important tasks that you must configure: • Listens for incoming connectivity requests from Extract or Extract data pump • Performs housekeeping functions to delete any consumed Oracle GoldenGate trails 1. x64. [OS_prompt ~] cd $GG_AMER_HOME [OS_prompt gg_amer] . start GGSCI from a shell prompt positioned inside the Oracle GoldenGate directory.pdf) located in the /home/oracle/labs/docs/E28323_01/doc. Oracle and/or its affiliates. enter: GGSCI (AMER)> Edit Param mgr The text editor starts and opens a new mgr.Practice 5-3: Configuring and Starting Oracle GoldenGate Manager Overview In this practice. At the GGSCI prompt. Add that parameter to the mgr. Copyright © 2012. 4. oraenv ORACLE_SID = [amer] ? The Oracle base remains unchanged with value /u01/app/oracle [OS_prompt gg_amer] .1. 64bit (optimized).1. You cannot change the default. 3. defining the DynamicPortList range to be 15010 through 15020. Add the following runtime parameters to the empty mgr. 2012. you get vi as the default editor for Linux.prm file. Oracle and/or its affiliates.prm file. Using the Oracle GoldenGate Reference Manual (e27274.2.prm file: Port 15000 PurgeOldExtracts . Save and close the file./ggsci Oracle GoldenGate Command Interpreter for Oracle Version 11. All rights reserved. Oracle 11g on Feb 1 2012 00:55:59 Copyright (C) 1995. UseCheckpoints 5. Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 . On the source server (AMER).1910_FBO Linux.0. All rights reserved./dirdat/*. enter: GGSCI (AMER)> Set editor gedit If you do not do this Set. b.Page 9 Oracle Internal & Oracle Academy Use Only Tasks . The first task is to configure and start the Manager processes on both the source and target.0_PLATFORMS_120131. what parameter is used to specify ports that Manager can allocate for dynamic communications? a.0. (Optional) If you want to change the text editor for this session. you configure and start the Manager process on both instances of Oracle GoldenGate.0 OGGCORE_11.1121/ directory. GGSCI (AMER) 1> 2. 15001). enter this command: GGSCI (EURO)> Info Manager The results should look similar to the following example (your host name will be different).prm file: Port 15001 PurgeOldExtracts . Save and close the file. Notice that the EURO port number is one greater than the AMER port number. Copyright © 2012. Notice that you can substitute mgr for Manager. It is not very interesting yet. GGSCI (EURO) 4> Start Manager Manager started. Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 . You now continue with Practice 5-4. start the Manager process by entering the following command: GGSCI (EURO)> Start mgr To view the status of the Manager process. This completes Practice 5-3.15000).Page 10 Oracle Internal & Oracle Academy Use Only Manager is running (IP port WESTHOST.rpt in the dirrpt directory.6. All rights reserved. Oracle and/or its affiliates. At the GGSCI prompt. . On the EURO instance. start the Manager process by entering the following command: GGSCI (AMER)> Start mgr To view the status of the Manager process. UseCheckpoints 8. GGSCI (AMER) 5> Info Manager GGSCI (AMER) 6> 7. At the GGSCI prompt. invoke GGSCI./dirdat/*. especially for troubleshooting. but starting the Manager created a MGR. enter this command: GGSCI (AMER)> Info mgr The results should look similar to the following (your host name will be different): GGSCI (AMER) 4> Start Manager Manager started. It is a good habit to check those reports every so often. Execute the following command: GGSCI (EURO)> Edit Param mgr Add the following runtime parameters to the mgr. GGSCI (EURO) 5> Info Manager Manager is running (IP port EASTHOST. GGSCI (EURO) 6> Exit Exit GGSCI. from the shell prompt positioned inside the Oracle GoldenGate directory. 9. JUNK.ACCOUNT_TRANS. Password oracle_4U Successfully logged into database. WEST.* Copyright © 2012. you enable supplemental logging on the source database for the specified tables. If at this point you were to add a new table WEST. the Oracle database must be set to log the table key values whenever it logs a rows change. Before you can start capturing real-time data. WEST. Execute the following GGSCI command to verify that supplemental logging is enabled on each table: GGSCI> Info TranData WEST. This is required so Oracle GoldenGate can locate the correct row on the target for update and delete operations.Page 11 Oracle Internal & Oracle Academy Use Only 1.TELLER. GGSCI (AMER) 8> Add TranData WEST.ACCOUNT.ACCOUNT Logging of supplemental redo data enabled for table WEST.* Logging of supplemental WEST. If you did want to include future tables. WEST. enter the following: GGSCI> DBLogin UserID gguser. By default. at the GGSCI prompt. In the GG_AMER_HOME terminal window (the source server).BRANCH_ATM.ACCOUNT GGSCI> Add TranData WEST. GGSCI (AMER) 7> Add TranData WEST.BRANCH. Notice there is no harm in adding transaction data twice. GGSCI (AMER) 9> 2. Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 . it would not be picked up for adding transaction data even though you used the wildcard for the WEST schema. so that they are available to Oracle GoldenGate in Redo.ACCOUNT.ACCOUNT. All rights reserved. Oracle and/or its affiliates. use Add SchemaTranData instead of TranData. the database logs only those column values that change. as is the case for WEST. . Tasks You can add individual tables or use wildcards.Practice 5-4: Using the TranData option Overview In this practice. WEST. Logging of supplemental Logging of supplemental Logging of supplemental Logging of supplemental Logging of supplemental redo log data is already enabled for table redo redo redo redo redo data data data data data enabled enabled enabled enabled enabled for for for for for table table table table table WEST. Password oracle_4U GGSCI> Add TranData WEST.TELLER_TRANS.* The results should be similar to this: GGSCI (AMER) 6> DBLogin UserID gguser. Logging of supplemental redo log data is enabled for table WEST. TRANS_NUMBER. Logging of supplemental redo log data is enabled for table WEST.Logging of supplemental redo log data is enabled for table WEST. ATM_TRANS_TS.TELLER: TELLER_NUMBER.BRANCH. Stop here.ACCOUNT_TRANS. Practices for Lesson 5: Configuration Overview and Preparing the Environment Chapter 5 . ACCOUNT_TRANS_TS.BRANCH_ATM: BRANCH_NUMBER. Columns supplementally logged for table WEST. Logging of supplemental redo log data is enabled for table WEST. ATM_NUMBER. TRANS_NUMBER. Columns supplementally logged for table WEST.Page 12 Oracle Internal & Oracle Academy Use Only The results should be similar to the following: GGSCI (AMER) 9> Info TranData WEST.TELLER. Columns supplementally logged for table WEST.ACCOUNT: ACCOUNT_NUMBER. Columns supplementally logged for table WEST. Logging of supplemental redo log data is enabled for table WEST. TRANS_NUMBER. Oracle and/or its affiliates. Logging of supplemental redo log data is enabled for table WEST.ACCOUNT. GGSCI (AMER) 10> This completes Practice 5-4.TELLER_TRANS: TELLER_NUMBER. Copyright © 2012. Columns supplementally logged for table WEST. TELLER_TRANS_TS. Columns supplementally logged for table WEST.ACCOUNT_TRANS: ACCOUNT_NUMBER.* .BRANCH_ATM.TELLER_TRANS. All rights reserved.BRANCH: BRANCH_NUMBER. Chapter 6 Copyright © 2012. Oracle and/or its affiliates.Page 1 Oracle Internal & Oracle Academy Use Only Practices for Lesson 6: Configuring Change Capture . Practices for Lesson 6: Configuring Change Capture Chapter 6 . All rights reserved. data pump Extract. ExtTrail. Oracle and/or its affiliates. data pump Extract. . you set up the Extract on the source (AMER) database. Practices for Lesson 6: Configuring Change Capture Chapter 6 . and RmtTrail. This is only a convention rather than a requirement.Page 2 Oracle Internal & Oracle Academy Use Only Big Picture The following diagram shows the new objects that are created: Extract. The ew extract trail prefix is for ExtractWest.Practices for Lesson 6: Overview Practices Overview In these practices. All rights reserved. The pe remote trail prefix is for PumpEast. ExtTrail. and RmtTrail. Copyright © 2012. configure the change data capture extract from the GGSCI prompt by executing the edit command: (Confirm that you are in the proper installation directory and logged in to the database using AMER SID.Page 3 Oracle Internal & Oracle Academy Use Only 1. . Add a local extract trail.prm file. Set this report roll-over parameter to occur at one minute after midnight daily. you perform the following actions: • Configure the primary Extract process that captures changes./ggsci GGSCI (AMER) 1> DBLogin UserID gguser./dirdat/ew UserID gguser. Password oracle_4U Table WEST. All rights reserved. Tasks On the source server (GG_AMER_HOME terminal window). Add the Extract Group by executing the following GGSCI commands: GGSCI> Add Extract extwest.Practice 6-1: Setting Up the Extract and ExtTrail Overview In this practice. Add the following runtime parameters to the text file: Extract extwest ExtTrail .1121/ directory. Controls whether or not statistics generated by the REPORT parameter are reset when a new process report is created • Generates interim runtime statistics in a process report. with an initial Redo checkpoint of the current timestamp (now). Begin Now This adds the extwest Extract to Oracle GoldenGate. Oracle and/or its affiliates. specifying that it will read from Oracle Redo/Archive log.) [OS_prompt] cd $GG_AMER_HOME [OS_prompt] . and report the number of operations per second and the change in rate. 3. TranLog. • Add the local trail that stores these changes. oraenv [OS_prompt] . Practices for Lesson 6: Configuring Change Capture Chapter 6 ./dirdat/ew. Password oracle_4U GGSCI (AMER) 2> Edit Param extwest Your chosen text editor starts and opens the extwest.pdf file) located in the /home/oracle/labs/docs/E28323_01/doc.*. Megabytes 50 Copyright © 2012. instead of when a process starts. Extract extwest. with a maximum file size of 50 megabytes per trail that links the trail to the extwest Extract: GGSCI> Add ExtTrail . Save and close the file.prm file before the Table listings: • 2. • Force report files to age on a regular schedule. • Report a count of transaction records processed since startup. Using the Oracle GoldenGate Reference Manual (e27274. Set this parameter to report at one minute after midnight daily. find the parameters that perform the following and add them to the extwest. Set this report parameter to occur every 60 seconds. and so on through ew999999. When the Extract is started. Megabytes 50 EXTTRAIL added. and links the trail to the extwest Extract group. the ./dirdat/ew.This adds the . with a maximum file size of 50 megabytes per trail./dirdat/ew local extract trail. Practices for Lesson 6: Configuring Change Capture Chapter 6 . All rights reserved. Now continue with Practice 6-2. Oracle and/or its affiliates. GGSCI> Add ExtTrail . Begin Now EXTRACT added. Your results should be similar to the following: GGSCI (AMER) 2> Edit Param extwest GGSCI (AMER) 3> Add Extract extwest./dirdat/ew000000 file is created. trail ew000001 is created. You can look in the dirdat directory to prove to yourself that nothing has yet been created. This completes Practice 6-1.Page 4 Oracle Internal & Oracle Academy Use Only GGSCI> . Extract extwest. Copyright © 2012. When that file is full. TranLog. At the GGSCI prompt on the source server (GG_AMER_HOME terminal window). Your text editor of choice starts and opens the pwest. extwest./dirdat/pe Passthru Table WEST. • Add the remote trail. • Start the two Extract processes. transmit the data to the target server (EURO). Oracle and/or its affiliates.prm file. Practices for Lesson 6: Configuring Change Capture Chapter 6 . MgrPort 15001. Save and close the file. by issuing the following command in the GG_AMER_HOME window: GGSCI (AMER) > Start Extract pwest 6. configure the Extract data pump to read from the . Compress RmtTrail . by issuing the following command in the GG_AMER_HOME window: GGSCI (AMER) > Start Extract extwest 5. PWEST. To verify the status of all Extracts and Replicats (ER). you perform the following actions: • Configure a data pump Extract to read the local trail and create a remote trail on the target. Add the following runtime parameters to the text file: Extract pwest RmtHost easthost. GGSCI (AMER) > 4. Start the primary Extract process. Make sure you include the one trailing semicolon. Add the Extract Group by executing the following GGSCI commands: GGSCI (AMER) > Add Extract pwest.Practice 6-2: Setting Up an Extract Data Pump and Starting the Two Extracts Overview In this practice./dirdat/ew local extract trail. Megabytes 50 RMTTRAIL added. 3. and write it to the . GGSCI > Add RmtTrail ./dirdat/ew EXTRACT added.Page 5 Oracle Internal & Oracle Academy Use Only Tasks . All rights reserved.*./dirdat/pe remote trail: GGSCI> Edit Param pwest 2./dirdat/pe. Start the data pump Extract process. ExtTrailSource . execute the command: GGSCI (AMER) > Info ER * Copyright © 2012. 1. Extract pwest. ” If you see either “STOPPED” or “ABENDED. 7. All rights reserved. Look at the content of an Extract report. EXTRACT PWEST starting EXTRACT EXTWEST Checkpoint Lag Log Read Checkpoint Last Started 2012-05-11 06:44 Status RUNNING 00:00:00 (updated 00:00:05 ago) Oracle Redo Logs 2012-05-11 06:44:37 Seqno 20. RBA 294400 SCN 0. This completes Practice 6-2.Page 6 Oracle Internal & Oracle Academy Use Only GGSCI (AMER) > Info ER * . Use Info All for a one-line summary of process status without the details. 8. Stop here. Practices for Lesson 6: Configuring Change Capture Chapter 6 . EXTRACT EXTWEST starting GGSCI (AMER) > Start Extract pwest Sending START request to MANAGER . Look in the source dirdat directory and see if any local trails are started. and restart the process.. You examine the content of these trails in a later practice using logdump. 9. Oracle and/or its affiliates. Note that it includes the content of the associated parameter file at the time that the process was started..rpt) are all UPPERCASE file names even though the parameter (*. They should be. Look in the target dirdat directory and see if any remote trails are started. They should be.” view the report log (View report <extract_name>).1409976 (1409976) EXTRACT PWEST Checkpoint Lag Log Read Checkpoint Last Started 2012-05-11 06:44 Status RUNNING 00:00:00 (updated 00:00:02 ago) File .prm) files are lowercase file names. Look in the source dirrpt directory and see if any reports are started.Your results should look similar to this: GGSCI (AMER) > Start Extract extwest Sending START request to MANAGER . They should be. Copyright © 2012. 10./dirdat/ew000000 First Record RBA 0 GGSCI (AMER) > Both processes should display as “RUNNING. fix the error. Enter the Info command again and see if any numbers are increasing. They should be.. Note that the reports (*.. Practices for Lesson 7: Configuring Change Delivery Chapter 7 . Oracle and/or its affiliates. All rights reserved.Page 1 Oracle Internal & Oracle Academy Use Only Practices for Lesson 7: Configuring Change Delivery .Chapter 7 Copyright © 2012. All rights reserved. you will configure change delivery.Page 2 . Oracle and/or its affiliates. Practices for Lesson 7: Configuring Change Delivery Chapter 7 .Practices for Lesson 7: Overview Practices Overview In these practices. 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 Oracle Internal & Oracle Academy Use Only Big Picture Copyright © 2012. This completes Practice 7-1. you will create a checkpoint table on the target system. GGSCI (EURO) 5> If you try to add a checkpoint table to the same schema twice. All rights reserved.GGS_CHECKPOINT Found 1 tables matching list criteria... invoke GGSCI and execute the following commands: GGSCI (EURO) 1> DBLogin UserID gguser. To create the checkpoint table. from the installation directory. Continue with Practice 7-2. GGSCI (EURO) 3> Info CheckpointTable No checkpoint table specified. and is used to ensure data integrity. Practices for Lesson 7: Configuring Change Delivery Chapter 7 . GGSCI (EURO) 4> List Tables gg* GGUSER. using GLOBALS specification (GGS_CHECKPOINT). Successfully created checkpoint table GGS_CHECKPOINT. using GLOBALS specification (GGS_CHECKPOINT).Page 3 Oracle Internal & Oracle Academy Use Only Tasks . GGSCI (EURO) 2> Add CheckpointTable No checkpoint table specified. GGSCI will warn you. Assumptions Replicat checkpoints to this table in the database ensure that the Replicat checkpoint is part of the transaction. For this step. Password oracle_4U Successfully logged into database. on the target server (GG_EURO_HOME terminal window). Copyright © 2012. you will create a special checkpoint table on the target server. Oracle and/or its affiliates.Practice 7-1: Setting Up the Checkpoint Table on the Target System Overview In this practice.. Checkpoint table GGS_CHECKPOINT created 2012-05-11 04:38:37.. 1. Purge UserID gguser. 2. you can issue the set editor gedit command.*. and then verify the results: GGSCI (EURO) > Start Replicat reast Sending START request to MANAGER . Continue with Practice 7-3. you will set up the Replicat delivery component. On the target server (GG_EURO_HOME terminal window)./dirdat/pe REPLICAT added. Start the Replicat process. Practices for Lesson 7: Configuring Change Delivery Chapter 7 . Save and close the file.. invoke GGSCI and execute the following command: GGSCI (EURO) > Edit Param reast Replicat reast AssumeTargetDefs DiscardFile . (Remember. Add the Replicat by executing the following GGSCI command: GGSCI (EURO) > Add Replicat reast./dirdat/pe000000 First Record RBA 0 GGSCI (EURO) > This completes Practice 7-2. Target EAST. ExtTrail . All rights reserved. GGSCI (EURO) > 3. Tasks 1. Password oracle_4U Map WEST. Copyright © 2012.Practice 7-2: Setting Up Replicat Delivery Overview In this practice.prm file.Page 4 Oracle Internal & Oracle Academy Use Only vi starts and opens the reast. REPLICAT REAST starting GGSCI (EURO) > Info Replicat reast REPLICAT REAST Checkpoint Lag Log Read Checkpoint Last Started 2012-05-11 06:46 Status RUNNING 00:00:00 (updated 00:00:09 ago) File . if you do not like vi.*. Oracle and/or its affiliates./dirrpt/reast.) Add the following runtime parameters to the text file: ..dsc. GGSCI (AMER) 1> Info ER * EXTRACT EXTWEST Checkpoint Lag Log Read Checkpoint Last Started 2012-05-11 06:44 Status RUNNING 00:00:00 (updated 00:00:08 ago) Oracle Redo Logs 2012-05-11 06:47:20 Seqno 20.0. 64bit (optimized). Assumptions For the accounts created when you created the database./ggsci Oracle GoldenGate Command Interpreter for Oracle Version 11. Practices for Lesson 7: Configuring Change Delivery Chapter 7 ./dirdat/ew000000 First Record RBA 1038 GGSCI (AMER) 2> 2. All rights reserved.1410059 (1410059) EXTRACT PWEST Checkpoint Lag Log Read Checkpoint Last Started 2012-05-11 06:44 Status RUNNING 00:00:00 (updated 00:00:01 ago) File . oraenv ORACLE_SID = [amer] ? The Oracle base remains unchanged with value /u01/app/oracle Copyright © 2012. 1.0. ATM deposits. x64.1.1910_FBO Linux.2. All rights reserved. Another script will be used to simulate a real-time banking system. Oracle and/or its affiliates. and withdrawals at branch tellers.Practice 7-3: Generating Data and Starting GoldenGate Processes Overview In this practice. 2012. In the GG_AMER_HOME terminal window. [OS_prompt] cd $GG_AMER_HOME [OS_prompt gg_amer] .2. RBA 322048 SCN 0. ATM withdrawals. random transactions are executed: point-of-sale debit card transactions.Page 5 Oracle Internal & Oracle Academy Use Only Tasks . navigate to the installation directory and invoke GGSCI. Oracle 11g on Feb 1 2012 00:55:59 Copyright (C) 1995.1. View the status of the EXTWEST Extract and the PWEST Data Pump Extract: [OS_prompt ~] cd $GG_AMER_HOME [OS_prompt gg_amer] . Execute . deposits with branch tellers. Notice the RBA numbers for both of the Extracts: Open a new terminal window and navigate to the $GG_AMER_HOME directory.0 OGGCORE_11. oraenv command to ensure that you are using the AMER database. Oracle and/or its affiliates. you will start the data generation process and begin real-time data capture.0_PLATFORMS_120131. 3. Data Mining. Practices for Lesson 7: Configuring Change Delivery Chapter 7 . Return to your GG_AMER_HOME terminal window and verify the results.0 . .3.sql [OS_prompt] sqlplus west/oracle_4U @trans_branch Connected to: Oracle Database 11g Enterprise Edition Release 11. but the pump should stabilize. Oracle. Note the BEFORE count for the BRANCH table. All rights reserved. Oracle and/or its affiliates. Oracle Database Vault and Real Application Testing options 1 row created.64bit Production With the Partitioning. .many lines omitted for clarity.2.Then navigate to the /home/oracle/labs/Section7/sqlscripts directory and run the transaction generator by executing the following commands: [OS_prompt] cd ~/labs/Section7/sqlscripts/ [OS_prompt sqlscripts] ls trans_generator. 2011..Page 6 Oracle Internal & Oracle Academy Use Only SQL*Plus: Release 11...0 Production on Wed Apr 25 11:10:03 2012 Copyright (c) 1982. Note: The RBA numbers should be increasing for the Extract.2. OLAP.0. SQL> 3.. Oracle Label Security. Your timestamps and RBA numbers will be similar but different. All rights reserved. Copyright © 2012.0. EXTRACT EXTWEST Checkpoint Lag Log Read Checkpoint Last Started 2012-05-11 06:44 Status RUNNING 00:00:00 (updated 00:00:06 ago) Oracle Redo Logs 2012-05-11 06:52:14 Seqno 20, RBA 581120 SCN 0.1410370 (1410370) EXTRACT PWEST Checkpoint Lag Log Read Checkpoint Last Started 2012-05-11 06:44 Status RUNNING 00:00:00 (updated 00:00:08 ago) File ./dirdat/ew000000 2012-05-11 06:49:45.000000 RBA 1920 GGSCI (AMER) 5> ! EXTRACT EXTWEST Checkpoint Lag Log Read Checkpoint Last Started 2012-05-11 06:44 Status RUNNING 00:00:00 (updated 00:00:03 ago) Oracle Redo Logs 2012-05-11 06:53:14 Seqno 20, RBA 588800 SCN 0.1410399 (1410399) EXTRACT PWEST Checkpoint Lag Log Read Checkpoint Last Started 2012-05-11 06:44 Status RUNNING 00:00:00 (updated 00:00:07 ago) File ./dirdat/ew000000 2012-05-11 06:49:45.000000 RBA 1920 GGSCI (AMER) 6> 4. In the GG_EURO_HOME terminal window, view the Replicat statistics. Your timestamps and RBA numbers will be similar but different. Execute the following commands: GGSCI (EURO) > Info Replicat reast REPLICAT REAST Checkpoint Lag Log Read Checkpoint Last Started 2012-05-11 06:46 Status RUNNING 00:00:00 (updated 00:00:04 ago) File ./dirdat/pe000000 2012-05-11 06:49:44.981939 RBA 1967 GGSCI (EDRSR31P1) 13> Info ER * REPLICAT REAST Checkpoint Lag Log Read Checkpoint Last Started 2012-05-11 06:46 Status RUNNING 00:00:00 (updated 00:00:06 ago) File ./dirdat/pe000000 2012-05-11 06:49:44.981939 RBA 1967 GGSCI (EURO) > Notice that the RBA in EURO is now pretty close to the RBA in AMER. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Practices for Lesson 7: Configuring Change Delivery Chapter 7 - Page 7 Oracle Internal & Oracle Academy Use Only GGSCI (AMER) 4> Info ER * 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: GGSCI (AMER) 6> Info extwest EXTRACT EXTWEST Checkpoint Lag Log Read Checkpoint Last Started 2012-05-11 06:44 Status RUNNING 00:00:00 (updated 00:00:00 ago) Oracle Redo Logs 2012-05-11 06:56:49 Seqno 20, RBA 629248 SCN 0.1410540 (1410540) EXTRACT EXTWEST Checkpoint Lag Log Read Checkpoint Last Started 2012-05-11 06:44 Status RUNNING 00:00:00 (updated 00:00:04 ago) Oracle Redo Logs 2012-05-11 06:57:20 Seqno 20, RBA 643072 SCN 0.1410562 (1410562) GGSCI (AMER) 8> ! EXTRACT EXTWEST Checkpoint Lag Log Read Checkpoint Last Started 2012-05-11 06:44 Status RUNNING 00:00:00 (updated 00:00:07 ago) Oracle Redo Logs 2012-05-11 06:57:20 Seqno 20, RBA 643072 SCN 0.1410562 (1410562) GGSCI (AMER) 9> 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 (AMER) 9> Lag extwest Sending GETLAG request to EXTRACT EXTWEST ... Last record lag: 2 seconds. At EOF, no more records to process. GGSCI (AMER) 10> When Extract returns “At EOF, no more records to process”, Extract has captured all outstanding redo records. Exit GGSCI. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Practices for Lesson 7: Configuring Change Delivery Chapter 7 - Page 8 Oracle Internal & Oracle Academy Use Only GGSCI (AMER) 7> ! 6. Start a SQL*Plus session for the west schema by executing the following command: [OS_prompt] sqlplus west/oracle_4U Get the row counts for the BRANCH table: SQL> SELECT count(*) FROM west.branch; COUNT(*) ---------43 7. It is not critical that your numbers exactly match these numbers above, but it is critical that your number be three more than when you started. Start a SQL*Plus session for the east schema by executing the following command: [OS_prompt] sqlplus east/oracle_4U Get the row counts for the BRANCH table: SQL> SELECT count(*) FROM east.branch; COUNT(*) ---------3 SQL> Why do the counts not match? When you started, the source table had rows and the target was empty. If both tables were empty, this would not be a problem. If the target table was pre-populated outside of Oracle GoldenGate, this would not be a problem. If you were only interested in records from this point-in-time on, this would not be a problem. However, if you want all rows to be initially brought over by Oracle GoldenGate so the counts would match, then you would need to run an initial load before this lab. For the moment, assume this count-mismatch is not a problem and you will get to do the initial load in a later practice. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Practices for Lesson 7: Configuring Change Delivery Chapter 7 - Page 9 Oracle Internal & Oracle Academy Use Only SQL> . Start of Statistics at 2012-05-14 07:56:27.00 deletes 1...many lines omitted for clarity.00 updates 2.. In the target GGSCI.BRANCH: . All rights reserved..many lines omitted for clarity.BRANCH: .. Assumptions You have successfully completed the previous practices in this lab. *** Latest statistics since 2012-05-11 06:49:51 *** Total inserts 4..Page 10 Oracle Internal & Oracle Academy Use Only 1.rpt 2. Tasks Look at the three reports to see if there are any statistics about rows processed: [OS_prompt] more $GG_AMER_HOME/dirrpt/EXTWEST. Output to . Replicating from WEST. The reports are interesting and short./dirdat/ew: Extracting from WEST..BRANCH to WEST. GGSCI (AMER) > 3. . you will see the reports that are generated midstream and at the completion of a replication.BRANCH to EAST. This is because the processes are still running. check for statistics: GGSCI (AMER) > Stats extwest Sending STATS request to EXTRACT EXTWEST .. *** Latest Total Total Total Total Total statistics since 2012-05-11 06:49:47 *** inserts 4..00 End of Statistics. but contain no statistics. Start of Statistics at 2012-05-14 07:49:06..00 discards 0.rpt [OS_prompt] more $GG_AMER_HOME/dirrpt/PWEST.00 operations 7. Oracle and/or its affiliates. In the source GGSCI.Practice 7-4: Stopping Processes and Checking Statistics Overview In this practice.rpt [OS_prompt] more $GG_EURO_HOME/dirrpt/REAST. check for statistics: GGSCI (EURO) > Stats reast Sending STATS request to REPLICAT REAST ..00 Copyright © 2012. Practices for Lesson 7: Configuring Change Delivery Chapter 7 . x64.0.Page 11 Oracle Internal & Oracle Academy Use Only 4.. GGSCI (EURO) 16> 5.. *********************************************************************** * ** Run Time Statistics ** * *********************************************************************** Report at 2012-05-14 08:01:32 (activity since 2012-05-11 06:49:47) Output to .Total Total Total Total updates deletes discards operations 2. Oracle and/or its affiliates. you can use any editor or less. Oracle 11g on Feb 1 2012 01:04:34 Copyright (C) 1995./dirdat/ew: From Table WEST. Prove to yourself that the Stats command no longer works when the process is stopped. Stop the source processes: GGSCI (AMER) > Stop * 6. Note: Stopping with an asterisk does not stop the Manager. All rights reserved. Stop the target processes: GGSCI (EURO) > Stop * .1.00 1.2. The reports now contain lots and lots of statistics. You can only run the Stats command while the processes are running.0. Practices for Lesson 7: Configuring Change Delivery Chapter 7 . 2012. 4 2 1 0 Copyright © 2012..rpt [OS_prompt] more $GG_AMER_HOME/dirrpt/PWEST.. Oracle and/or its affiliates. Starting at 2012-05-11 06:44:36 *********************************************************************** ..many lines omitted for clarity.0_PLATFORMS_120131.1910_FBO Linux.BRANCH: # inserts: # updates: # deletes: # discards: . Look at the three reports again to see if there are now any statistics about rows processed: [OS_prompt] more $GG_AMER_HOME/dirrpt/EXTWEST.00 End of Statistics.many lines omitted for clarity.1.rpt [OS_prompt] more $GG_EURO_HOME/dirrpt/REAST.00 0.0 OGGCORE_11. These statistics should match source and target. 64bit (optimized)..00 7.2... Find the section that has similar statistics as the Stats command gave: *********************************************************************** Oracle GoldenGate Capture for Oracle Version 11. All rights reserved.rpt Instead of more. Oracle and/or its affiliates. This completes Practice 7-4. Stop here.Oracle Internal & Oracle Academy Use Only Each of the three reports contains slightly different information. but all three should contain the above common statistics. Practices for Lesson 7: Configuring Change Delivery Chapter 7 . All rights reserved. This completes Practice 7. Copyright © 2012.Page 12 . Page 1 Oracle Internal & Oracle Academy Use Only Practices for Lesson 8: Extract Trail and Files . Oracle and/or its affiliates.Chapter 8 Copyright © 2012. All rights reserved. Practices for Lesson 8: Extract Trail and Files Chapter 8 . In this exercise.Practices for Lesson 8: Overview Practices Overview In these practices. you will be able to use the logdump utility to look at records in an Oracle GoldenGate trail file. Practices for Lesson 8: Extract Trail and Files Chapter 8 .Page 2 . All rights reserved. Oracle and/or its affiliates. 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 Oracle Internal & Oracle Academy Use Only • Copyright © 2012. Similar to GGSCI. there is no good way to make help or any other command pause.550...2.....418 FileHeader Name: *FileHeader* 3000 01a3 3000 0008 4747 0d0a 544c 0a0d 0003 3200 0004 2000 0000 3300 0008 02f1 7552 3400 0027 0025 7572 693a 4544 5253 313a 3a75 3031 3a61 7070 3a6f 7261 636c 5f61 6d65 7236 0000 1300 112e 2f64 6972 6577 3030 3030 3030 3700 0001 0138 0000 0039 ff00 0800 0000 0000 0000 003a 0000 Len 3100 e5f0 5233 653a 6461 0400 8107 0002 86ad 3150 6767 742f 0000 3134 | | | | | | | 1030 RBA 0 0.. .1. In logdump. Issue the help command to display a list of all commands available in logdump.. ...... .... uR4.8../dirdat/ ew0000007.. 2012.. Note that this is the trail file header record../logdump Logdump 1 > help 2.3.1910 Copyright (C) 1995.. In the GG_AMER_HOME terminal window.. Turn on the FILEHEADER ON option and view the record again: Logdump Logdump Reading Logdump 4 > fileheader on 5 > pos 0 forward from RBA 0 6 > n Copyright © 2012..0. Oracle and/or its affiliates. Oracle and/or its affiliates.... All rights reserved.GG. Use the n (next) command: Logdump 3 > n 2012/05/11 06:44:37.9.%uri:EDRSR31P 1::u01:app:oracle:gg _amer6. open the <install_path>/dirdat/<trail_id>000000 trail file (verify the name of the trail file in the dirdat directory): Logdump 2 > open dirdat/ew000000 Current LogTrail is /u01/app/oracle/gg_amer/dirdat/ew000000 Identifying the File Headers 3. View the first record.. navigate to the installation directory and invoke logdump: [OS_prompt gg_amer] pwd /u01/app/oracle/gg_amer [OS_prompt gg_amer] ...... All rights reserved..0_PLATFORMS_120131.. ..0.:..Practice 8-1: Using the logdump Utility Tasks 1.1..Page 3 Oracle Internal & Oracle Academy Use Only Oracle GoldenGate Log File Dump Utility for Oracle Version 11.0 OGGCORE_11..TL. Practices for Lesson 8: Extract Trail and Files Chapter 8 .14 Logdump 4 > 4.2..0.2........'.1... Many lines omitted for clarity ... Oracle Internal & Oracle Academy Use Only .64bi | t Production.. A database type of NUMBER is not as easily readable as a VARCHAR...Produ | ction. | ..Page 4 b ..0 ...0 | Production..Production.....0... View the first next record: Logdump 7 > n 2012/05/11 06:49:45.d.1 | 1...0.4...0...0.0.0. Practices for Lesson 8: Extract Trail and Files Chapter 8 ..8..amer3........ Many lines omitted for clarity ....T | NS for Linux: Versio | n 11. | 39-100.el6uek..3. | .7. the Extract that produced the trail.0 . .....Produc | tion..5... GroupID x31 '1' 3100 0072 3000 0945 4452 5352 3339 2d31 3030 3836 5f36 3433 7520 5365 7020 5420 3230 3131 MachineInfo 0007 0005 4c69 3331 5031 3200 2e30 2e31 322e 0000 2500 2323 3239 2031 363a 3400 0008 0006 Info x00 Length 6e75 7831 0000 0b00 001f 001d 322e 362e 656c 3675 656b 2e78 3120 534d 5020 5468 3530 3a33 3820 4544 7838 114 | 1.._0..Scroll down and notice how you can view the detail on the trail.AMER | 2..2.CORE......1.3..<....r0.000 Insert Len 28 RBA 1038 Name: WEST..3.EDRSR31P12.0 .... Oracle and/or its affiliates.NLSRTL Version | 11.. the machine being used.....:....12....000.2. and so on. the database information.BRANCH After Image: Partition 4 G 0000 000a 0000 0000 0000 0000 0064 0001 000a 0000 | . Using the Head and Detail Attributes When Displaying a Record 5.3........6... | ..x8 GroupID x32 '2' 3200 015f 3000 3200 0006 0004 0002 000b 3500 6c65 2044 6174 7270 7269 7365 7365 2031 312e 7420 5072 6f64 5265 6c65 6173 2050 726f 6475 322e 302e 332e 4e53 2066 6f72 6e20 3131 2e32 6374 696f 6e0a 2031 312e 322e 7469 6f6e 0a37 312e 322e 302e 0200 003b 0000 1414 1414 1414 DatabaseInfo 0002 0007 3100 616d 6572 3300 0002 0002 3600 6162 6173 6520 2045 6469 7469 322e 302e 332e 7563 7469 6f6e 6520 3131 2e32 6374 696f 6e0a 3009 5072 6f64 204c 696e 7578 2e30 2e33 2e30 4e4c 5352 544c 302e 332e 3020 0000 0440 0000 332e 3039 0000 0400 0000 013c 1414 1414 14 Info x00 Length 0006 0004 414d 4552 0004 0000 0000 3400 00e7 00e5 4f72 6163 3131 6720 456e 7465 6f6e 2052 656c 6561 3020 2d20 3634 6269 0a50 4c2f 5351 4c20 2e30 2e33 2e30 202d 434f 5245 0931 312e 7563 7469 6f6e 0a54 3a20 5665 7273 696f 202d 2050 726f 6475 2056 6572 7369 6f6e 2d20 5072 6f64 7563 0038 0000 0c00 0a31 0400 0000 013a 0000 0000 1400 0000 1014 351 | 2...PL/SQL | Release 11........ All rights reserved...2.%.Linux1.. Copyright © 2012......6...3..2....0..2. 0000 0000 0000 292f | ...09..)/ Logdump 8 > This is standard trail record...2.. | .x | 86_643..11.... | 2....3..Orac | le Database 11g Ente | rprise Edition Relea | se 11...##1 SMP Th | u Sep 29 16:50:38 ED | T [email protected]. (x00) FormatType : R (x52) SyskeyLen : 0 (x00) Incomplete : .. Exit logdump.. 0000 0000 0000 292f | ..)/ Column 0 (x0000). Stop here. Notice that the history and the last prompt number is preserved in ~/logdump.000 Insert Len 28 RBA 1038 Name: WEST. Copyright © 2012. (Make sure you do next or n twice. That is. (x00) BeforeAfter: A (x41) RecLength : 28 (x001c) IO Time : 2012/05/11 06:49:45.Position back to RBA 0 in the file... Oracle and/or its affiliates. Len 10 (x000a) Column 1 (x0001). which reference manual would you use? ___________________________ This completes Practice 8-1.d.. (x04) UndoFlag : .. Len 10 (x000a) b Logdump > 7... and view the same trail record again. Practices for Lesson 8: Extract Trail and Files Chapter 8 ... For more information about the logdump utility.Page 5 Oracle Internal & Oracle Academy Use Only 6...hst.. Exit logdump again. but the session information is not preserved.. but the file is not currently opened.000 IOType : 5 (x05) OrigNode : 255 (xff) TransInd : . Prove this by entering next... .) Logdump Reading Logdump Logdump Logdump Logdump 8 > pos 0 forward from RBA 0 9 > ghdr on 10 > detail on 11 > n 12 > n ___________________________________________________________________ Hdr-Ind : E (x45) Partition : . (x00) AuditRBA : 20 AuditPos : 429584 Continued : N (x00) RecCount : 1 (x01) 2012/05/11 06:49:45.. Note the difference in the display from the output in the last step.. 8. set the header and detail attributes to on...000. This completes Practice 8. (The trail record header area and detail on the columns has been added to the display)..000. Restart logdump.BRANCH After Image: Partition 4 G 0000 000a 0000 0000 0000 0000 0064 0001 000a 0000 | . you can display the commands you ran last session to open a trail file. All rights reserved. Page 6 . Oracle and/or its affiliates. All rights reserved.Oracle Internal & Oracle Academy Use Only Copyright © 2012. Practices for Lesson 8: Extract Trail and Files Chapter 8 . Chapter 9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Practices for Lesson 9: Configuring Initial Load Chapter 9 - Page 1 Oracle Internal & Oracle Academy Use Only Practices for Lesson 9: Configuring Initial Load Practices for Lesson 9: Overview Practices Overview Oracle Internal & Oracle Academy Use Only In these practices, you will set up the initial load of data using two different methods: • File to Replicat • Direct Load Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Practices for Lesson 9: Configuring Initial Load Chapter 9 - Page 2 Practice 9-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 Big Picture The Extract naming convention is eftor (Extract File To Replicat). 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: [OS_prompt gg_amer] ./ggsci GGSCI (AMER) > Edit Param eftor Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Practices for Lesson 9: Configuring Initial Load Chapter 9 - Page 3 Oracle Internal & Oracle Academy Use Only • Configure the delivery of the data to the target • Execute the initial load of table 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. Purge Table WEST. Release 2.2.BRANCH.Page 4 Oracle Internal & Oracle Academy Use Only 2. you made a mistake). and all lowercase): [OS_prompt] cd $GG_AMER_HOME [OS_prompt gg_amer] . Add the following runtime parameters to the text file: SourceIsTable UserID gguser. Note: There is no message returned to the command line.prm reportfile dirrpt/eftor.1910_FBO Linux. All rights reserved. That information is in the source report.1. Purge Table WEST. MgrPort 15001 RmtFile . Oracle 11g on Feb 1 2012 01:04:34 Copyright (C) 1995. 2012.0./extract paramfile dirprm/eftor. RmtFile . Password oracle_4U RmtHost easthost.0 OGGCORE_11. Execute the initial load capture process by starting the initial load Extract directly from a shell by using the following command (all on one line.rpt [OS_prompt gg_amer] 3. To view the report. Note: If for any reason you need to rerun the extract (for example. Practices for Lesson 9: Configuring Initial Load Chapter 9 . . then rerun the extract.6. Oracle and/or its affiliates.x86_64 Node: EDRSR31P1 Machine: x86_64 --More—(25%) Copyright © 2012. a new report will not overlay the old one. navigate to the dirrpt directory and execute the following commands: [OS_prompt gg_amer] more dirrpt/eftor. You must first delete the old report.2.0_PLATFORMS_120131. All rights reserved./dirdat/ACCOUNT.0.DAT. Save and close the file. 64bit (optimized)./dirdat/BRANCH.rpt *********************************************************************** Oracle GoldenGate Capture for Oracle Version 11.39100.prm file. Starting at 2012-05-14 11:08:22 *********************************************************************** Operating System Version: Linux Version #1 SMP Thu Sep 29 16:50:38 EDT 2011.el6uek.ACCOUNT.1.DAT. x64.Your editor of choice starts and opens the eftor.12. neither good nor bad. Oracle and/or its affiliates. Exit GGSCI.0. Page 5 Oracle Internal & Oracle Academy Use Only Output to . Oracle and/or its affiliates. Navigate to the GG_EURO_HOME directory.4. it put them in a remote file./dirdat/BRANCH.DAT 5. Configure the initial load delivery parameter file by executing the following commands on the target (GG_EURO_HOME terminal window) system.DAT: ./ggsci GGSCI (EURO) > Edit Param lacct Copyright © 2012. Practices for Lesson 9: Configuring Initial Load Chapter 9 ./dirdat/ACCOUNT. Scroll to the end of the report to view the number of inserts for the ACCOUNT and BRANCH tables (your results may vary slightly): *********************************************************************** * ** Run Time Statistics ** * *********************************************************************** Report at 2012-05-14 11:08:30 (activity since 2012-05-14 11:08:24) From Table WEST. Configure the data load parameters for ACCOUNT by executing the following command at GGSCI: [OS_prompt] cd $GG_EURO_HOME [OS_prompt gg_euro] .ACCOUNT: # # # # inserts: updates: deletes: discards: 1000 0 0 0 Output to . All rights reserved. a.DAT: From Table WEST. You can see some of it by entering: [OS_prompt] strings $GG_EURO_HOME/dirdat/ACCOUNT.BRANCH: # # # # inserts: updates: deletes: discards: REDO Log Statistics Bytes parsed Bytes output 43 0 0 0 0 102009 [OS_prompt] Note: This did not put the rows in the remote table. ACCOUNT. Practices for Lesson 9: Configuring Initial Load Chapter 9 . Repeat this process for the BRANCH initial load parameter file: Your editor of choice starts and opens the lbranch. Oracle and/or its affiliates.prm file./dirdat/BRANCH. then rerun the replicat. c./replicat paramfile dirprm/lbranch. Wait ten seconds and then verify the results in the target report files: [OS_prompt gg_euro] more dirrpt/lacct. Add the following runtime parameters to the text file: SpecialRun End Runtime UserID gguser.Page 6 Oracle Internal & Oracle Academy Use Only GGSCI (EURO) > Edit Param lbranch .DAT Map WEST.prm reportfile dirrpt/lacct.ACCOUNT. neither good nor bad.Your editor of choice starts and opens the lacct. Target EAST.rpt [OS_prompt gg_euro] Note: There is no message returned to the command line./replicat paramfile dirprm/lacct.prm file. All rights reserved.rpt [OS_prompt gg_euro] .DAT Map WEST. 6. Password oracle_4U HandleCollisions AssumeTargetDefs ExtFile .BRANCH.prm reportfile dirrpt/lbranch.BRANCH.rpt Copyright © 2012. Exit GGSCI. You must first delete the old report. Execute the initial load delivery process by executing the following commands at the shell prompt from the installation directory (all on one line.rpt [OS_prompt gg_euro] more dirrpt/lbranch. Note: This differs from the lacct file in that it has HandleCollisions (ignore duplicates) to accommodate the three pre-existing rows from the previous lab. Target EAST. Note: If for any reason you need to rerun the replicat (for example. you made a mistake). and all lowercase): [OS_prompt gg_euro] . b./dirdat/ACCOUNT. Save the file. Add the following runtime parameters to the text file: SpecialRun End Runtime UserID gguser. Save the file. a new report will not overlay the old one. Password oracle_4U AssumeTargetDefs ExtFile . That information is in the target report. DAT RBA: 4874 TIMESTAMP: 2012-05-14 11:08:30./dirdat/BRANCH../dirdat/ACCOUNT.....DAT.DAT RBA: 99144 TIMESTAMP: 2012-05-14 11:08:30.ACCOUNT to EAST...078486 EOF: NO READERR: 400 .BRANCH ___________________________________________________________________ Reading . Results from lbranch.. Many lines omitted for clarity . Many lines omitted for clarity .Results from lacct.../dirdat/BRANCH. current RBA 99144.130964 EOF: NO READERR: 400 . This completes Practice 9-1. 1000 records Report at 2012-05-14 11:24:59 (activity since 2012-05-14 11:24:59) From Table WEST. depending on how you think about it.ACCOUNT: # inserts: 1000 # updates: 0 # deletes: 0 # discards: 0 . current RBA 4874./dirdat/ACCOUNT...Page 7 Oracle Internal & Oracle Academy Use Only . 43 records Report at 2012-05-14 11:54:26 (activity since 2012-05-14 11:54:26) From Table WEST. 2012-05-14 11:08:30.. Many lines omitted for clarity .rpt: Last log location read: FILE: .130964 Insert Len 28 RBA 4784 Name: WEST. Many lines omitted for clarity .DAT. Practices for Lesson 9: Configuring Initial Load Chapter 9 .ACCOUNT ___________________________________________________________________ Reading . Copyright © 2012. The number of inserts should be 1000. Oracle and/or its affiliates. The number of inserts should be 40 or 43... 2012-05-14 11:08:30.. Continue with Practice 9-2.rpt: . All rights reserved.BRANCH: # inserts: 43 # updates: 0 # deletes: 0 # discards: 0 # insert collisions: 3 Last log location read: FILE: .BRANCH to EAST.078486 Insert Len 29 RBA 99052 Name: WEST. transmitted. An Extract Task is a special process that. and inserted. target database instantiation will be performed via Oracle GoldenGate tasks. Truncate the ACCOUNT and BRANCH tables. If this is not the case. you may skip to step 2. All rights reserved.Page 8 Oracle Internal & Oracle Academy Use Only Big Picture . Tasks 1. Copyright © 2012. This data is transmitted to the Replicat task on the target that inserts each row of data into the empty database tables. once started.Practice 9-2: Setting Up the Initial Data Load by Using the Direct Load Method Overview In this practice. Practices for Lesson 9: Configuring Initial Load Chapter 9 . Oracle and/or its affiliates. Note: This exercise assumes that you have completed an initial data load using the File to Replicat method. reads from each source table row by row. The Task will automatically shut down once all rows are read. you will configure: • A task to load the initial data from all of the source table(s) • The delivery of the data to the target Assumptions For this practice. execute the following command: [OS_prompt] cd $GG_AMER_HOME [OS_prompt] . Practices for Lesson 9: Configuring Initial Load Chapter 9 . 4. at the GGSCI prompt on the source database (GG_AMER_HOME terminal window) in the installation directory. Table truncated.Execute the following commands on the target system (GG_EURO_HOME terminal window): SQL> conn east/oracle_4U Connected. SQL> TRUNCATE TABLE account./ggsci GGSCI (EURO) 1> DBLogin UserID gguser. SQL> TRUNCATE TABLE branch. All rights reserved. SpecialRun Copyright © 2012. Commit complete. SourceIsTable 3. Add the following runtime parameters to the text file: Extract eini RmtHost easthost. 2. Configure the initial load capture parameter file by executing the following command on the source system (GG_AMER_HOME terminal window): GGSCI (AMER) > Edit Param eini Your editor of choice starts and opens the eini. Password oracle_4U GGSCI (EURO) 2> Add Replicat rini. MgrPort 15001 RmtTask Replicat. Password oracle_4U Table WEST. Group rini UserID gguser. SQL> COMMIT. To add the initial load capture batch task group. Table truncated.prm file.Page 9 Oracle Internal & Oracle Academy Use Only SQL> exit . Save and close the file. Oracle and/or its affiliates./ggsci GGSCI (AMER) 1> DBLogin UserID gguser.*. Password oracle_4U GGSCI (AMER) 2> Add Extract eini. Add the initial load delivery batch task by executing the following command on the target system (GG_EURO_HOME terminal window): [OS_prompt] cd $GG_EURO_HOME [OS_prompt] . Copyright © 2012.. but does show up in Info Extract eini.*. nor Info with an asterisk. Target EAST./dirrpt/rini. Purge Map WEST. Add the following runtime parameters to the text file: Replicat rini AssumeTargetDefs UserID gguser. Configure the initial load delivery parameter file by executing the following command on the target system (GG_EURO_HOME terminal window): GGSCI (EURO) > Edit Param rini Your editor of choice starts and opens the rini. It will show with a Status of STOPPED (meaning already completed.dsc.prm file.Page 10 Oracle Internal & Oracle Academy Use Only GGSCI (AMER) > Start Extract eini ..*.5. Enter the commands: GGSCI (AMER) > Info All GGSCI (AMER) > Info Extract * GGSCI (AMER) > Info Extract eini Notice that this initial load Extract does not show up in Info All. EXTRACT EINI starting GGSCI (AMER) > 7.) Exit GGSCI. Practices for Lesson 9: Configuring Initial Load Chapter 9 . Password oracle_4U DiscardFile . Execute the initial load process on the source system (GG_AMER_HOME terminal window): Sending START request to MANAGER . All rights reserved. This task displays differently than other Extracts. 6. Oracle and/or its affiliates. BRANCH to EAST.ACCOUNT: # inserts: 1000 # updates: 0 # deletes: 0 # discards: 0 From Table WEST.. Many lines omitted for clarity . Make a note of the number of inserts...Page 11 Oracle Internal & Oracle Academy Use Only Report at 2012-05-14 12:27:16 (activity since 2012-05-14 12:27:08) . Note: If you entered List Tables WEST. but were empty. TELLER_TRANS. view the report by executing the following command: GGSCI (EURO) > View Report rini . ACCOUNT_TRANS. Many lines omitted for clarity ..BRANCH: # inserts: 43 # updates: 0 # deletes: 0 # discards: 0 From Table WEST. but only three of them came over in the initial load. Copyright © 2012. Exit GGSCI.TELLER: # inserts: 800 # updates: 0 # deletes: 0 # discards: 0 . On the target system (GG_EURO_HOME terminal window).. and BRANCH_ATM existed on source and target.*. you would see that there are six tables. Practices for Lesson 9: Configuring Initial Load Chapter 9 . *********************************************************************** * ** Run Time Statistics ** * *********************************************************************** From Table WEST.. they do not show up in the statistics nor the report.8.TELLER to EAST. The other three tables. All rights reserved. The truncated tables are examined by Oracle GoldenGate and then ignored.. the three that had rows in them.ACCOUNT to EAST.. Oracle and/or its affiliates. Connected to: Oracle Database 11g Enterprise Edition Release 11. From the AMER instance: GGSCI (AMER) > DBLogin UserID gguser. To unregister them from the database. Return to the GG_AMER_HOME terminal window and verify that the count for the tables matches (the numbers should match in both databases): [OS_prompt gg_amer] sqlplus west/oracle_4U SQL*Plus: Release 11. 10.Page 12 Oracle Internal & Oracle Academy Use Only SQL> SELECT count(*) FROM account. Oracle and/or its affiliates. Data Mining.3. All rights reserved.9.0.64bit Production With the Partitioning. 2011. delete them from both Oracle GoldenGate Instances. Because you will not need the initial load process groups again.2. OLAP. Password oracle_4U GGSCI (AMER) > Delete Extract eini From the EURO instance: GGSCI (EURO) > DBLogin UserID gguser.2.3. Password oracle_4U GGSCI (EURO) > Delete Replicat rini Copyright © 2012. GGSCI needs to be logged in to the database. Oracle Database Vault and Real Application Testing options COUNT(*) ---------1000 SQL> SELECT count(*) FROM branch. Practices for Lesson 9: Configuring Initial Load Chapter 9 . Oracle.0. All rights reserved. .0 . COUNT(*) ---------43 SQL> SELECT count(*) FROM teller. Oracle Label Security. COUNT(*) ---------800 SQL> Exit SQL.0 Production on Wed Apr 25 11:10:03 2012 Copyright (c) 1982. There is no harm if you log in to the database more than once. Tasks On the source system (GG_AMER_HOME terminal window). On the source system.. and run a transaction generator to verify that all the data flows from source tables to target tables.Page 13 Oracle Internal & Oracle Academy Use Only 1. Oracle and/or its affiliates. EXTRACT PWEST starting GGSCI (AMER) 4> Info All Program MANAGER EXTRACT EXTRACT Status RUNNING RUNNING RUNNING Group Lag at Chkpt Time Since Chkpt EXTWEST PWEST 00:00:00 00:01:00 00:00:05 00:00:02 GGSCI (AMER) 5> Copyright © 2012. Practices for Lesson 9: Configuring Initial Load Chapter 9 . start GGSCI and log in to the database: [OS_prompt gg_euro] . you will restart the Extract and Replicat from earlier practices. All rights reserved.Practice 9-3: Putting it All Together Overview In this practice.. start all the processes and make sure they are all running: GGSCI (AMER) 3> Start ER * Sending START request to MANAGER . The source and target tables in the WEST and EAST schemas are now identical as a result of the successful initial load. . Password oracle_4U 2. start GGSCI and log in to the database: [OS_prompt gg_amer] .. Password oracle_4U 3./ggsci GGSCI (AMER) > DBLogin UserID gguser. Assumptions You successfully completed the previous practices. EXTRACT EXTWEST starting Sending START request to MANAGER . On the target system (GG_EURO_HOME terminal window)./ggsci GGSCI (EURO) > DBLogin UserID gguser.. All rights reserved. gather information: GGSCI (AMER) 6> ! Info All Program MANAGER EXTRACT EXTRACT Status RUNNING RUNNING RUNNING Group Lag at Chkpt Time Since Chkpt EXTWEST PWEST 00:00:00 00:00:00 00:00:01 00:00:00 GGSCI (AMER) 7> Copyright © 2012. In a separate terminal session. OLAP. Practices for Lesson 9: Configuring Initial Load Chapter 9 .4.sql SQL*Plus: Release 11. Oracle. REPLICAT REAST starting GGSCI (EURO) 4> Info All Program MANAGER REPLICAT Status RUNNING RUNNING Group Lag at Chkpt Time Since Chkpt REAST 00:00:00 00:00:05 5. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11. On the target system. Disconnected from Oracle Database 11g Enterprise Edition Release 11. Make sure your Oracle GoldenGate processes are still running. Oracle Database Vault and Real Application Testing options PL/SQL procedure successfully completed. The PL/SQL procedure takes a few seconds to complete. go to ~/labs/Section9/sqlscripts and run the transaction generator as the owner of the source schema: [OS_prompt] cd ~/labs/Section9/sqlscripts [OS_prompt] sqlplus west/oracle_4U @trans_generator.64bit Production With the Partitioning. OLAP.Page 14 Oracle Internal & Oracle Academy Use Only GGSCI (EURO) 5> . Oracle Label Security. Data Mining. Data Mining.  On the source system GGSCI.0 . Oracle Label Security..2.0.2..0 Production on Tue May 15 12:22:03 2012 Copyright (c) 1982. Oracle Database Vault and Real Application Testing options [oracle@EDRSR31P1 sqlscripts] 6. Oracle and/or its affiliates.2.3.3. 2011.0 64bit Production With the Partitioning.0.3.0. start all the processes and make sure they are all running: GGSCI (EURO) 3> Start ER * Sending START request to MANAGER . Page 15 Oracle Internal & Oracle Academy Use Only SQL> SELECT count(*) FROM account. All rights reserved. Copyright © 2012. COUNT(*) ---------594 SQL> SELECT count(*) FROM branch_atm. COUNT(*) ---------531 SQL> Source and target row counts should match. . On the target system GGSCI. Examine the row count on the source and target tables: COUNT(*) ---------1060 SQL> SELECT count(*) FROM account_trans. Practices for Lesson 9: Configuring Initial Load Chapter 9 . gather information: GGSCI (EURO) 6> ! Info All Program MANAGER REPLICAT Status RUNNING RUNNING Group Lag at Chkpt Time Since Chkpt REAST 00:00:00 00:00:04 GGSCI (EURO) 7> 7. Oracle and/or its affiliates. Your numbers may be slightly different. COUNT(*) ---------1500 SQL> SELECT count(*) FROM teller_trans. . Oracle and/or its affiliates.. Five of the six tables had activity: a.TELLER_TRANS: *** Total statistics since 2012-05-15 12:11:20 *** Total inserts 594..00 Extracting from WEST.00 . On the source system GGSCI.00 ./dirdat/pe: Extracting from WEST.00 Extracting from WEST. GGSCI (AMER) 9> Copyright © 2012.ACCOUNT_TRANS to WEST. All rights reserved.ACCOUNT to WEST...many lines have been omitted for clarity. Start of Statistics at 2012-05-15 12:55:44.BRANCH: *** Total statistics since 2012-05-15 12:11:20 *** Total deletes 3.BRANCH_ATM to WEST.Page 16 Oracle Internal & Oracle Academy Use Only Extracting from WEST.ACCOUNT: *** Total statistics since 2012-05-15 12:11:20 *** Total inserts 60. Practices for Lesson 9: Configuring Initial Load Chapter 9 . Output to .BRANCH to WEST.. gather statistics: GGSCI (AMER) 8> Stats pwest Sending STATS request to EXTRACT PWEST . Examine the statistics.TELLER_TRANS to WEST.00 Extracting from WEST.8. End of Statistics.ACCOUNT_TRANS: *** Total statistics since 2012-05-15 12:11:20 *** Total inserts 1500.BRANCH_ATM: *** Total statistics since 2012-05-15 12:11:20 *** Total inserts 531. On the target system GGSCI..BRANCH_ATM: *** Total statistics since 2012-05-15 12:11:22 *** Total inserts 531. Your counts may be slightly different. All rights reserved. This completes Practice 9. Practices for Lesson 9: Configuring Initial Load Chapter 9 .00 Replicating from WEST..Page 17 Oracle Internal & Oracle Academy Use Only Replicating from WEST.TELLER_TRANS to EAST. Start of Statistics at 2012-05-15 12:59:20. gather statistics: GGSCI (EURO) 8> Stats reast Sending STATS request to REPLICAT REAST .00 Replicating from WEST. Replicating from WEST. End of Statistics. but the Replicat reast is from WEST to EAST.BRANCH: *** Total statistics since 2012-05-15 12:11:22 *** Total deletes 3. Copyright © 2012. the important thing is that WEST matches EAST. Also notice that the Replicat is lagging 2 seconds behind the pump.ACCOUNT_TRANS: *** Total statistics since 2012-05-15 12:11:22 *** Total inserts 1500. This completes Practice 9-3.ACCOUNT to EAST. Stop here.BRANCH to EAST. Oracle and/or its affiliates.TELLER_TRANS: *** Total statistics since 2012-05-15 12:11:22 *** Total inserts 594.00 .ACCOUNT: *** Total statistics since 2012-05-15 12:11:22 *** Total inserts 60. GGSCI (EURO) 9> Notice that the pump pwest is from WEST to WEST.00 ...many lines have been omitted for clarity.b..00 Replicating from WEST.ACCOUNT_TRANS to EAST.BRANCH_ATM to EAST.. All rights reserved. Practices for Lesson 9: Configuring Initial Load Chapter 9 .Oracle Internal & Oracle Academy Use Only Copyright © 2012.Page 18 . Oracle and/or its affiliates. Oracle and/or its affiliates.Chapter 10 Copyright © 2012. All rights reserved. Practices for Lesson 10: Oracle GoldenGate Parameters Chapter 10 .Page 1 Oracle Internal & Oracle Academy Use Only Practices for Lesson 10: Oracle GoldenGate Parameters . During this practice. Oracle and/or its affiliates. All rights reserved.Page 2 . you will modify the existing Manager and Extract processes by using more advanced parameters. you will modify: • The source system Manager parameters • The target system Manager parameters Oracle Internal & Oracle Academy Use Only • The Extract parameters and restart the Extract process You can check your work by looking in /home/oracle/labs/Section10/solutions for answers. Practices for Lesson 10: Oracle GoldenGate Parameters Chapter 10 . Copyright © 2012.Practices for Lesson 10: Overview Practices Overview In this practice. Are you sure you want to stop it (y/n)? y Sending STOP request to MANAGER .Page 3 Oracle Internal & Oracle Academy Use Only • ..15000). and starting or restarting the Manager process: GGSCI (AMER) 2> Stop Manager Manager process is required by other GGS processes. Answer:__________________________________________________________ • Write an informational message to the application log file if the lag for any Extract/Replicat group exceeds 30 minutes. Answer:__________________________________________________________ • Report the current lag for each Extract/Replicat group every hour to the application log file. Oracle and/or its affiliates. Note: You do not have to stop any of the Extracts or Replicats. GGSCI (AMER) 3> Start Manager Manager started. Request processed. modify the Manager parameter file on the source database (GG_AMER_HOME terminal window) with the following parameters: GGSCI (AMER) > Edit Param mgr 2. Have an Extract group automatically start when the Manager process is started. they are independent of the Manager.Practice 10-1: Modifying Source Manager Parameters Tasks 1. Manager stopped.. This completes Practice 10-1. GGSCI (AMER) 4> 3. Continue with Practice 10-2. Answer:__________________________________________________________ Activate the changes by stopping. Verify that the Manager has started: GGSCI (AMER) 4> Info mgr Manager is running (IP port westhost. After the Extracts are running. Answer:__________________________________________________________ • Write a critical message to the application log file if the lag for any Extract/ Replicat group exceeds 45 minutes. GGSCI (AMER) 5> Your host name will be different. Answer:__________________________________________________________ • Have all Extract groups automatically restart after abending. Following the instructions in the Oracle GoldenGate documentation (/home/oracle/labs/docs). Manager should retry the operation three times. Practices for Lesson 10: Oracle GoldenGate Parameters Chapter 10 . waiting one minute between each attempt. Copyright © 2012. All rights reserved. Are you sure you want to stop it (y/n)? y Sending STOP request to MANAGER . GGSCI (EURO) 3> Start Manager Manager started. Answer:__________________________________________________________ • Report the current lag for each Extract/Replicat group every hour to the application log file. Answer:__________________________________________________________ • Write an informational message to the application log file if the lag for any Extract/Replicat group exceeds 30 minutes. modify the Manager parameter file on the target database (GG_EURO_HOME terminal window) with the following parameters: GGSCI (EURO) > Edit Param mgr 2. Answer:__________________________________________________________ • Delete the remote trail files after the Replicat has finished processing them and the trail has been kept for at least two hours. Request processed. Practices for Lesson 10: Oracle GoldenGate Parameters Chapter 10 .Practice 10-2: Modifying the Target Manager Parameters Tasks 1. All rights reserved. Answer:__________________________________________________________ • Have all Replicat groups automatically restart after abending.Page 4 Oracle Internal & Oracle Academy Use Only • . Copyright © 2012. Manager stopped. Use ports in the range of 7820 through 7840 when starting Oracle GoldenGate processes. and starting or restarting the Manager to activate the changes: GGSCI (EURO) 2> Stop Manager Manager process is required by other GGS processes. Following the instructions in the Oracle GoldenGate documentation. Answer:__________________________________________________________ • Have all Replicat groups that have a group name of R* automatically start when the Manager process is started. Answer:__________________________________________________________ • Write a critical message to the application log file if the lag for any Extract/ Replicat group exceeds 45 minutes.. Manager should retry the operation three times. Oracle and/or its affiliates. they are independent of the Manager. GGSCI (EURO) 4> Note: You do not have to stop any of the Extracts or Replicats. After they are running. Answer:__________________________________________________________ Activate the changes by stopping.. waiting one minute between each attempt. All rights reserved.Page 5 . This completes Practice 10-2. Practices for Lesson 10: Oracle GoldenGate Parameters Chapter 10 .15001). Note: If you do Stop mgr ! then it will not prompt you for “Are you sure?” Verify that the Manager has started: GGSCI (EURO) 4> Info mgr Manager is running (IP port easthost.3. Continue with Practice 10-3. GGSCI (EURO) 5> Oracle Internal & Oracle Academy Use Only Your host name will be different. Copyright © 2012. Oracle and/or its affiliates. All rights reserved. Modify the Extract parameter file on the source database (GG_AMER_HOME terminal window) for the following: GGSCI (AMER) > Edit Param extwest Write a message to the report file after processing every 1000 records../dirdat/ew000000 2011-11-04 14:02:46. EXTRACT EXTWEST starting GGSCI (AMER) 7> Info ER * EXTRACT EXTWEST Checkpoint Lag Log Read Checkpoint Last Started 2011-11-07 09:31 Status RUNNING 00:01:02 (updated 00:00:06 ago) Oracle Redo Logs 2011-11-07 09:30:43 Seqno 67.. Answer:__________________________________________________________ • Only extract data from the ACCOUNT_TRANS table if the account_trans_type is equal to “CR”.000000 RBA 783171 GGSCI (AMER) 8> Copyright © 2012.Page 6 Oracle Internal & Oracle Academy Use Only • .Practice 10-3: Modifying the Extract Parameters on the Source Database Tasks 1. Answer:__________________________________________________________ 2. Request processed. and starting or restarting the Extract to have the changes take effect.. Oracle and/or its affiliates. Practices for Lesson 10: Oracle GoldenGate Parameters Chapter 10 . Activate the changes by stopping. RBA 38370304 EXTRACT PWEST Checkpoint Lag Log Read Checkpoint Last Started 2011-11-04 11:04 Status RUNNING 00:00:00 (updated 00:00:09 ago) File . Then verify that the Extract has started: GGSCI (AMER) 5> Stop Extract extwest Sending STOP request to EXTRACT EXTWEST .. GGSCI (AMER) 6> Start Extract extwest Sending START request to MANAGER . GGSCI (EURO) 23> Delete ER * Are you sure you want to delete all groups? y Deleted REPLICAT REAST..sh This is also a good example of a shell script that invokes GGSCI commands.sh. using GLOBALS specification (GGS_CHECKPOINT).Page 7 Oracle Internal & Oracle Academy Use Only 3. This completes Practice 10-3. Practices for Lesson 10: Oracle GoldenGate Parameters Chapter 10 . make sure that no GGSCI is running in any window. All rights reserved. . Password oracle_4U Successfully logged into database.. This checkpoint table may be required for other installations. Are you sure you want to delete this checkpoint table? y Successfully deleted checkpoint table GGS_CHECKPOINT. This completes Practice 10. To run it for the Amer source server. Password oracle_4U GGSCI> Delete ER * (confirm the deletion) GGSCI> Delete CheckpointTable (only necessary on the EURO db GGSCI> Stop mgr ! GGSCI> Exit OS_prompt> rm $GG_EURO_HOME/dirdat/* OS_prompt> rm $GG_EURO_HOME/dirrpt/* Shown below is an example of the dialog from the target (Euro) server: GGSCI (EURO) 21> Stop ER * Sending STOP request to REPLICAT REAST . GGSCI (EURO) 26> Exit [OS_prompt gg_euro]$ rm $GG_EURO_HOME/dirdat/* [OS_prompt gg_euro]$ rm $GG_EURO_HOME/dirrpt/* 4.Clean up the Oracle GoldenGate environment by executing the following GGSCI commands on the target server: GGSCI> Stop ER * GGSCI> DBLogin Userid gguser./kill-all-ogg. You can check your work by looking in ~/labs/Section10/solutions for answers. Copyright © 2012. GGSCI (EURO) 24> Delete CheckpointTable No checkpoint table specified. You can find it as a shell script in ~/labs/setup/kill-all-ogg.. Stop here. Request processed... This cleanup script above will be run in future labs as well. Oracle and/or its affiliates. then from any OS prompt enter: [OS_prompt] cd ~/labs/setup [OS_prompt] . Manager stopped. GGSCI (EURO) 22> DBLogin Userid gguser. GGSCI (EURO) 25> Stop mgr ! Sending STOP request to MANAGER .. Request processed. Page 8 . Oracle and/or its affiliates. All rights reserved.Oracle Internal & Oracle Academy Use Only Copyright © 2012. Practices for Lesson 10: Oracle GoldenGate Parameters Chapter 10 . Page 1 Oracle Internal & Oracle Academy Use Only Practices for Lesson 11: Data Selection and Filtering .Chapter 11 Copyright © 2012. Oracle and/or its affiliates. All rights reserved. Practices for Lesson 11: Data Selection and Filtering Chapter 11 . All processes are currently stopped. .Page 2 Oracle Internal & Oracle Academy Use Only In these practices. which computes a hash value of the columns specified in the input. All rights reserved. allows the Extract/Replicat processes to split the flow of replicated data into two or more streams. Oracle and/or its affiliates. combined with the FILTER option. One of the techniques used to achieve parallelism is based on the @RANGE function. The @RANGE function. Copyright © 2012. Nothing is running in GGSCI at the moment.Practices for Lesson 11 Overview Practices Overview Overview Assumptions • • You completed the lab practices for all previous lessons. Practices for Lesson 11: Data Selection and Filtering Chapter 11 . you will increase the performance of Oracle GoldenGate replication by configuring multiple replication streams running in parallel. • You have two configured Extract processes (extwest and pwest) and one configured Replicat process (reast). 2011. 2. Oracle and/or its affiliates.0. View the PL/SQL code: [OS prompt] cat populate_range_split.many lines omitted for clarity. 3. split_date TIMESTAMP DEFAULT systimestamp ). split_text VARCHAR2(128) NOT NULL .3. In the Amer terminal window.. Oracle.0 Production on Thu May 17 13:57:30 2012 Copyright (c) 1982.0 . then loops until the number of rows to be created has been reached. split_value NUMBER NOT NULL .Page 3 Oracle Internal & Oracle Academy Use Only 1.0. All rights reserved.3..sql CREATE OR REPLACE PROCEDURE populate_range_split ( num_rows IN NUMBER .sql DROP TABLE range_split. Data Mining.. OLAP. generating random numbers and random strings and storing them into the RANGE_SPLIT table. The stored procedure takes two parameters: − The number of rows to be created − The commit interval (in number of rows) The PL/SQL stored procedure defines a cursor used to generate random strings.sql file. CREATE TABLE range_split ( ROW_ID NUMBER NOT NULL PRIMARY KEY. Its definition is stored in the range_split.. The content of the table is replicated using an Extract process which writes three remote trail files.64bit Production With the Partitioning. You also will create the populate_range_split stored procedure.sql. Navigate to the Section 11 directory. Oracle Database Vault and Real Application Testing options SQL> Copyright © 2012. connect to the source Oracle database using SQL*Plus: [OS prompt] sqlplus west/oracle_4U SQL*Plus: Release 11.2. Connected to: Oracle Database 11g Enterprise Edition Release 11. and view the script: [OS prompt] cd ~/labs/Section11/sqlscripts [OS prompt] cat range_split.2. Tasks You will create the source and target table range_split.Practice 11-1: Increasing Performance by Splitting Replication Loads Overview In this practice. defined in the file populate_range_split. All rights reserved. commit_interval IN NUMBER ) . . Oracle Label Security. Practices for Lesson 11: Data Selection and Filtering Chapter 11 . each consumed on the target environment by three dedicated Replicat processes. you create a new source table and a stored procedure which populates that table with random data. you get an error that you can ignore. Oracle 11g on Feb 1 2012 00:55:59 Copyright (C) 1995.1. Password oracle_4U Table WEST. All rights reserved.2.0 OGGCORE_11. Oracle and/or its affiliates.RANGE_SPLIT. 2012. 6.sql Table created. All rights reserved.0 64bit Production .0.1910_FBO Linux. You must set the additional logging for the new RANGE_SPLIT table: GGSCI (AMER) 1> DBLogin UserID gguser. Use the @ command while in SQL*Plus to create the RANGE_SPLIT table: SQL> @/home/oracle/labs/Section11/sqlscripts/range_split. GGSCI (AMER) 3> Info TranData WEST. As long as it says Table created at the end.0. Load and compile the stored procedure using the @ command: SQL> @/home/oracle/labs/Section11/sqlscripts/populate_range_split. 64bit (optimized). Edit the parameters for defgen and add the RANGE_SPLIT table: GGSCI (AMER) 4> Edit Param defsrc DefsFile .1./ggsci Oracle GoldenGate Command Interpreter for Oracle Version 11.Page 4 Oracle Internal & Oracle Academy Use Only Disconnected from Oracle Database 11g Enterprise Edition Release 11.R* 9.RANGE_SPLIT. and start the GGSCI command interpreter: [OS prompt] cd $GG_AMER_HOME [OS prompt] . it worked. 5. Purge UserID gguser. Password oracle_4U Successfully logged into database./dirdef/rangesplit. Change directory to the Oracle GoldenGate Amer source directory. Practices for Lesson 11: Data Selection and Filtering Chapter 11 .2.sql Procedure created. As always.2. Disconnect the current Oracle session from the source database: SQL> exit 7. Copyright © 2012.def.RANGE_SPLIT Logging of supplemental redo data enabled for table WEST.0_PLATFORMS_120131. GGSCI (AMER) 2> Add TranData WEST.4. GGSCI (AMER) 1> 8. if the initial table to be dropped does not exist.3. x64. Oracle and/or its affiliates.0. In the AMER terminal session./defgen paramfile dirprm/defsrc. Create three Extract processes (erangea. Password oracle_4U RmtHost easthost. All rights reserved.RANGE_SPLIT./ggsci GGSCI (AMER) 1> 15..Page 5 Oracle Internal & Oracle Academy Use Only *********************************************************************** ** Running with the following parameters ** *********************************************************************** DefsFile . Definitions generated for 1 table in . Practices for Lesson 11: Data Selection and Filtering Chapter 11 ./dirdef/rangesplit.sql Table created. then disconnect: SQL> @/home/oracle/labs/Section11/sqlscripts/range_split. which will be processed by three separate Replicat processes.def $GG_EURO_HOME/dirdef 12. Note where the files differ by a. Copy the rangesplit. Change to the EURO terminal window and connect to the target EURO database using SQL*Plus in order to create the target RANGE_SPLIT table: [OS prompt] sqlplus east/oracle_4U 13. 3)). Oracle and/or its affiliates. go to the AMER source directory. c. thus achieving parallelism and significantly improving load performance. Copyright © 2012. Leave GGSCI.. MgrPort 15001 RmtTrail . Purge UserID gguser../dirdef/rangesplit.prm . Create the empty target RANGE_SPLIT table.RANGE_SPLIT . Password ********* Table WEST. under the dirdef directory: [OS prompt] cp ./dirdat/ea Table WEST. change directory to the Oracle GoldenGate source directory for the Oracle database. Retrieving definition for WEST. 3: GGSCI (AMER) 1> Start Manager GGSCI (AMER) 2> DBLogin UserID gguser. Filter (@RANGE (1.RANGE_SPLIT.def file to the EURO target environment.def. and run the defgen utility: GGSCI (AMER) > Exit [OS prompt] cd $GG_AMER_HOME [OS prompt] .many lines omitted for clarity..def 11. SQL> exit 14. Password oracle_4U GGSCI (AMER) 3> Edit Param erangea Extract erangea UserID gguser.10. 2. and by 1. and start GGSCI: [OS prompt] cd $GG_AMER_HOME [OS prompt] . b./dirdef/rangesplit. erangeb and erangec) which use the FILTER command combined with the @RANGE function to create three separate trail files. Begin Now EXTRACT added./dirdat/eb./dirdat/ea. 3)). Filter (@RANGE (3. 3)). Password oracle_4U RmtHost easthost. Oracle and/or its affiliates. Extract erangec UserID gguser. Password oracle_4U RmtHost easthost. TranLog. MgrPort 15001 RmtTrail . Add the three remote trail definitions: GGSCI (AMER) 9> Add RmtTrail . TranLog. Save the parameter file erangeb and create the third parameter file: GGSCI (AMER) 5> Edit Param erangec . Extract erangea RMTTRAIL added. Add the three Extract processes: GGSCI (AMER) 6> Add Extract erangea. 19.RANGE_SPLIT./dirdat/eb Table WEST. GGSCI (AMER) 7> Add Extract erangeb. Extract erangeb RMTTRAIL added. GGSCI (AMER) 8> Add Extract erangec. Practices for Lesson 11: Data Selection and Filtering Chapter 11 . Begin Now EXTRACT added. Save the parameter file erangea and create the second parameter file: GGSCI (AMER) 4> Edit Param erangeb Extract erangeb UserID gguser./dirdat/ec Table WEST. Extract erangec RMTTRAIL added.RANGE_SPLIT.16. Assess the current situation of your Extract processes by entering Info All: GGSCI (AMER) 12> Info All Program MANAGER EXTRACT EXTRACT EXTRACT Status RUNNING STOPPED STOPPED STOPPED Group Lag at Chkpt Time Since Chkpt ERANGEA ERANGEB ERANGEC 00:00:00 00:00:00 00:00:00 00:02:35 00:02:28 00:02:20 Copyright © 2012. MgrPort 15001 RmtTrail . GGSCI (AMER) 10> Add RmtTrail . GGSCI (AMER) 11> Add RmtTrail ./dirdat/ec. All rights reserved. Filter (@RANGE (2.Page 6 Oracle Internal & Oracle Academy Use Only 17. Begin Now EXTRACT added. 18. 20. TranLog. . Password oracle_4U GGSCI (EURO) 2> Start Manager GGSCI (EURO) 3> Info CheckpointTable If the checkpoint table exists. Save the parameter file rrangea and create the second parameter file: GGSCI (EURO) 6> Edit Param rrangeb Replicat rrangeb UserID gguser. Do basic housekeeping in preparation for configuration. EXTRACT ERANGEA starting Sending START request to MANAGER ./dirrpt/rrangea.RANGE_SPLIT. rrangeb and rrangec) which source their data from the trail files created by the three Extract processes created previously.dsc.def Copyright © 2012.def DiscardFile .. Create three Replicat processes (rrangea. otherwise create the checkpoint table. In the Euro target window. Password oracle_4U SourceDefs . GGSCI (EURO) 5> Edit Param rrangea Replicat rrangea UserID gguser.. Append Map WEST.21./dirdef/rangesplit. Oracle and/or its affiliates./ggsci 24.RANGE_SPLIT.. look at ~/labs/setup/startup./dirdef/rangesplit. log in to the database. and make sure there is a Checkpoint table. EXTRACT ERANGEB starting Sending START request to MANAGER . Target EAST. 25. Password oracle_4U SourceDefs .. Start the three new Extract processes: GSCI (AMER) 13> Start Extract erange* Sending START request to MANAGER .oby. 26. All rights reserved.. Practices for Lesson 11: Data Selection and Filtering Chapter 11 . start GGSCI: [OS prompt] cd $GG_EURO_HOME [OS prompt] . GGSCI (EURO) 4> Add CheckpointTable Optional: If this housekeeping seems repetitive for each time you start a new GGSCI session.Page 7 Oracle Internal & Oracle Academy Use Only 22. to verify that no process is in the ABENDED status GGSCI (AMER) 14> Info All . EXTRACT ERANGEC starting Program MANAGER EXTRACT EXTRACT EXTRACT Status RUNNING RUNNING RUNNING RUNNING Group Lag at Chkpt Time Since Chkpt ERANGEA ERANGEB ERANGEC 00:00:00 00:00:00 00:00:00 00:05:53 00:05:46 00:05:38 23. then skip the next line. Issue info all once again. Start the Manager. GGSCI (EURO) 1> DBLogin UserID gguser. dsc. Start the Replicat processes and enter info all to verify that they started successfully: GGSCI (EURO) 11> Start Replicat rrange* Sending START request to MANAGER .RANGE_SPLIT..RANGE_SPLIT.RANGE_SPLIT..RANGE_SPLIT: [OS prompt] sqlplus west/oracle_4U SQL> exec populate_range_split(1000000. Target EAST. Practices for Lesson 11: Data Selection and Filtering Chapter 11 . REPLICAT RRANGEA starting Sending START request to MANAGER .1000). and execute the stored procedure which populates the table WEST. start SQL*Plus..Page 8 Oracle Internal & Oracle Academy Use Only Replicat rrangec UserID gguser. Save the parameter file rrangeb and create the third parameter file: GGSCI (EURO) 7> Edit Param rrangec 28.. Add the three Replicat processes. Password oracle_4U SourceDefs ./dirdat/eb REPLICAT added./dirdef/rangesplit.. You will not see anything while it executes. exttrail .def DiscardFile .RANGE_SPLIT. connecting them to their respective trail files: GGSCI (EURO) 8> Add Replicat rrangea. All rights reserved. REPLICAT RRANGEC starting GGSCI (EURO) 12> Info All Program MANAGER REPLICAT REPLICAT REPLICAT Status RUNNING RUNNING RUNNING RUNNING Group Lag at Chkpt Time Since Chkpt RRANGEA RRANGEB RRANGEC 00:00:00 00:00:00 00:00:00 00:00:02 00:00:02 00:00:02 30. . Append Map WEST. exttrail . Copyright © 2012./dirdat/ea REPLICAT added. REPLICAT RRANGEB starting Sending START request to MANAGER ./dirrpt/rrangec. Go to the Amer source terminal session. GGSCI (EURO) 10> Add Replicat rrangec./dirdat/ec REPLICAT added. Target EAST. GGSCI (EURO) 9> Add Replicat rrangeb../dirrpt/rrangeb. Oracle and/or its affiliates. Append Map WEST.dsc. exttrail . 29.DiscardFile . Keep reading the next steps. 27. It takes a few minutes to complete.. All rights reserved.00 Total operations 92846.00 Total deletes 0.00 operations 92846. Extracting from WEST. committing every one thousand rows.00 Total operations 92846.00 *** Latest statistics since 2012-05-17 14:43:14 *** Total inserts 92846. Activate the windows where you are running GGSCI for the source Oracle GoldenGate installation and use the statistics command to show total DMLs on the required Extract process: GGSCI (AMER) 10> Stats Extract erangea Sending STATS request to EXTRACT ERANGEA .00 *** Daily Total Total Total Total Total statistics since 2012-05-17 14:43:14 *** inserts 92846.00 Total updates 0. Copyright © 2012.00 deletes 0.RANGE_SPLIT: *** Total Total Total Total Total Total statistics since 2012-05-17 14:43:14 *** inserts 92846.Page 9 Oracle Internal & Oracle Academy Use Only Output to .00 Total deletes 0.00 operations 92846. during its execution you can monitor the Extract and Replicat processes to verify that data is being replicated. Practices for Lesson 11: Data Selection and Filtering Chapter 11 .00 End of Statistics. The stored procedure inserts one million rows.00 *** Hourly statistics since 2012-05-17 14:43:14 *** Total inserts 92846./dirdat/ea: .00 discards 0.00 Total discards 0..31.00 Total discards 0.00 deletes 0.00 Total updates 0.RANGE_SPLIT to WEST. Oracle and/or its affiliates.00 updates 0.00 discards 0.00 updates 0. Start of Statistics at 2012-05-17 14:43:37. All rights reserved. Start of Statistics at 2012-05-17 14:44:50.00 updates 0. Copyright © 2012. Oracle and/or its affiliates.00 Total deletes 0.00 Total discards 0.00 Total operations 28964.00 deletes 0.00 Total deletes 0. and display statistics for the Replicat processes: GGSCI (EAST) 11> Stats Replicat rrangea Sending STATS request to REPLICAT RRANGEA.Page 10 Oracle Internal & Oracle Academy Use Only Replicating from WEST. *** Total Total Total Total Total Total statistics since 2012-05-17 14:43:17 *** inserts 28964.00 *** Latest statistics since 2012-05-17 14:43:17 *** Total inserts 28964..00 discards 0. Practices for Lesson 11: Data Selection and Filtering Chapter 11 .00 *** Hourly statistics since 2012-05-17 14:43:17 *** Total inserts 28964.00 discards 0.00 Total discards 0.00 End of Statistics.32.00 Total updates 0.RANGE_SPLIT: .00 updates 0.RANGE_SPLIT to EAST.00 operations 28964. Go to the window where you are running GGSCI for the Euro target environment..00 operations 28964.00 deletes 0.00 Total updates 0.00 Total operations 28964.00 *** Daily Total Total Total Total Total statistics since 2012-05-17 14:43:17 *** inserts 28964. Page 11 Oracle Internal & Oracle Academy Use Only GGSCI (EURO) 12> Stats Replicat rrangeb [omitted output…] GGSCI (EURO) 13> Stats Replicat rrangec [omitted output…] 33. Stop here.The report will not contain final stats until you stop the processes with Stop ER * or equivalent. View the report produced for all Extract processes (erangea. This completes Practice 11. erangeb and erangec) and all Replicat processes (rrangea. Copyright © 2012. A short time after the stored procedure finishes its execution. You can assess the status of your replicated rows by viewing the reports on the Extract and Replicat processes from GGSCI: GGSCI (AMER) 14> View Report erangea . 34. All rights reserved. and no rows were missed. Practices for Lesson 11: Data Selection and Filtering Chapter 11 . Were all the Extracts identical in count? Why or why not? This completes Practice 11-1. Oracle and/or its affiliates. rrangeb and rrangec) and make sure that replication was successful at both ends. the replication process ends. Page 12 . All rights reserved. Oracle and/or its affiliates. Practices for Lesson 11: Data Selection and Filtering Chapter 11 .Oracle Internal & Oracle Academy Use Only Copyright © 2012. Page 1 Oracle Internal & Oracle Academy Use Only Practices for Lesson 12: Additional Transformation Topics . All rights reserved. Oracle and/or its affiliates. Practices for Lesson 12: Additional Transformation Topics Chapter 12 .Chapter 12 Copyright © 2012. Page 2 . Oracle and/or its affiliates. Practices for Lesson 12: Additional Transformation Topics Chapter 12 . you will learn more about the structure and parameters that make up Oracle GoldenGate macros and user tokens. These will be used in subsequent labs. All rights reserved.Practices for Lesson 12: Overview Practices Overview Oracle Internal & Oracle Academy Use Only In this practice. Copyright © 2012. mac file in the vi editor (or your editor of choice). 2. .pdf). Oracle and/or its affiliates. and #funcsmap: <a> The keyword that starts a macro body <b> The keyword that finishes a macro <c> Reset the statistics when a new report is generated <d> Generates a report every day at one minute after midnight <e> Close the current report file and create a new one daily at one minute after midnight <f> The keyword that maps records between different source and target columns <g> The function that is used to return information about the Oracle GoldenGate environment <h> The function used to identify a user token Copyright © 2012. Referring to the documentation (Oracle GoldenGate Windows and UNIX Reference Guide 11g. fill in the <blanks> with the appropriate values to complete the three macros. navigate to the ~/labs/Section12 directory. at the OS prompt. you will finish creating three macros. dirmac).Practice 12-1: Modifying an Existing Set of Macros and User Tokens Overview In this practice. #bpsettings. (e27274. Oracle GoldenGate Macros provide functionality for sharing parameters or other runtime configuration settings across multiple components and externalizing complex configuration settings in order to streamline parameter file contents. Practices for Lesson 12: Additional Transformation Topics Chapter 12 .Page 3 Oracle Internal & Oracle Academy Use Only 1. Open the macrolib_shell. #dbconnect. The best practice is to create a file or series of files as a macro library and store them in a specific folder (for example. In the GG_AMER_HOME terminal window. All rights reserved. src_txn_csn = @TOKEN ("TKN-TXN-CSN") ). Oracle and/or its affiliates. Navigate to the $GG_AMER_HOME directory. src_db_name = @TOKEN ("TKN-SRC-DBNAME"). lag_replicat_ms = @GETENV ("LAG".mac [OS_prompt dirmac] Copyright © 2012. All rights reserved. TARGET #target_table. src_db_version = @TOKEN ("TKN-SRC-DBVERSION"). Create a directory named dirmac. Practices for Lesson 12: Additional Transformation Topics Chapter 12 . .MACRO #dbconnect <a> UserID gguser. After all of the parameters have been set correctly. Password <encrypted_pswd> AES256. Copy the macrolib. Verify that it has the correct parameters by comparing it to the macrolib. also located in ~/labs/Section12 directory. END. EncryptKey MyKey3 <b>. 3. gg_commit_ts = <g> ("GGHEADER". #target_table) BEGIN MAP #src_table. MACRO #funcsmap PARAMS (#src_table. <f> (usedefaults.mac dirmac [OS_prompt gg_amer] cd dirmac/ [OS_prompt dirmac] ls macrolib.mac file.mac file to this directory: [OS_prompt Section12] cd $GG_AMER_HOME [OS_prompt gg_amer] mkdir dirmac [OS_prompt gg_amer] cp ~/labs/Section12/macrolib.Page 4 Oracle Internal & Oracle Academy Use Only MACRO #bpsettings BEGIN <c> <d> <e> REPORTCOUNT EVERY 60 SECONDS."COMMITTIMESTAMP"). save and close the file. "MSEC"). RATE END. lag_extract_ms = <h> ("TKN-EXTLAG-MSEC"). Page 5 . Stop here. Create a directory named dirmac. Copy the macrolib.mac file to this directory.mac dirmac [OS_prompt gg_euro] cd dirmac/ [OS_prompt dirmac] ls macrolib. Oracle and/or its affiliates. Navigate to the $GG_EURO_HOME directory to perform the same steps. [OS_prompt dirmac] cd $GG_EURO_HOME [OS_prompt gg_euro] mkdir dirmac [OS_prompt gg_euro] cp ~/labs/Section12/macrolib. This completes Practice 12.4. Practices for Lesson 12: Additional Transformation Topics Chapter 12 .mac [OS_prompt dirmac] Oracle Internal & Oracle Academy Use Only Note: Both the macros and user tokens will be used in subsequent labs. This completes Practice 12-1. Copyright © 2012. All rights reserved. Oracle Internal & Oracle Academy Use Only Copyright © 2012.Page 6 . Oracle and/or its affiliates. Practices for Lesson 12: Additional Transformation Topics Chapter 12 . All rights reserved. Oracle and/or its affiliates. All rights reserved. Practices for Lesson 13: Configuration Options Chapter 13 .Page 1 Oracle Internal & Oracle Academy Use Only Practices for Lesson 13: Configuration Options .Chapter 13 Copyright © 2012. Oracle Internal & Oracle Academy Use Only Big Picture Copyright © 2012.Page 2 . and SQLEXEC. Oracle and/or its affiliates. trail encryption. including password encryption. Practices for Lesson 13: Configuration Options Chapter 13 . You will also use the macros and tokens created in the previous practice.Practices for Lesson 13: Overview Practices Overview In this practice. you will set up a configuration as depicted in the following graphic. All rights reserved. All rights reserved. navigate to the /home/oracle/labs/Section13/sqlscripts directory.sql 3. On the source database (GG_AMER_HOME terminal window). WEST./ggsci GGSCI (AMER) 1> DBLogin UserID gguser. configure the database to log table key values by issuing the following commands: [OS_prompt] cd $GG_AMER_HOME [OS_prompt] . Assumptions You have successfully completed the previous lab where you created the macros. 1. Oracle and/or its affiliates.Page 3 Oracle Internal & Oracle Academy Use Only Tasks .CUST_ZIP. Verify that supplemental logging has been enabled for the new tables: WEST. you set up the new databases and create a defgen file.sql 4.WSHOP_ENCRYPT.WSHOP_FUNCS. Confirm that you are using the correct Oracle SID: [OS_prompt] cd $GG_AMER_HOME [OS_prompt] . Execute the following command: [OS_prompt gg_amer] cd ~/labs/Section13/sqlscripts [OS_prompt] sqlplus west/oracle_4U @source_database. Open your two terminal windows (GG_AMER_HOME and GG_EURO_HOME) and navigate to the home directories. On the target (GG_EURO_HOME terminal window). and WEST. Practices for Lesson 13: Configuration Options Chapter 13 . oraenv [OS_prompt] cd $GG_EURO_HOME [OS_prompt] . oraenv 2. The responses should be the proper Oracle SID for each environment. On the source (GG_AMER_HOME terminal window). Copyright © 2012. Password oracle_4U GGSCI (AMER) 2> Add TranData WEST.* Note: Supplemental logging has already been enabled for the existing tables in the database. Execute the following command [OS_prompt gg_euro] cd ~/labs/Section13/sqlscripts [OS_prompt] sqlplus east/oracle_4U @target_database.Practice 13-1: Setting Up the Database and Source Definitions File Overview In this practice. navigate to the /home/oracle/labs/Section13/sqlscripts directory. cust_zip. Purge UserID gguser. Save and close the file. Table WEST. a source definitions file must be generated for use in Replicat to perform the table name./dirdef/section13. Practices for Lesson 13: Configuration Options Chapter 13 .Page 4 Oracle Internal & Oracle Academy Use Only vi starts and opens the defgen.wshop_funcs. Oracle and/or its affiliates. column name. and data type conversions. To create the defgen file. Add the following runtime parameters to the text file: . on the source database (GG_AMER_HOME).wshop_encrypt.Generating Source Table Definitions 5. Password oracle_4U Table WEST.prm file. Copyright © 2012. Table WEST. DEFGEN is the utility used to create this file. Because the target tables differ from the source. execute the following command at the GGSCI prompt: GGSCI (AMER) 3> Edit Param defgen DefsFile .defs. All rights reserved. 0 OGGCORE_11. Password ********* Table WEST. Oracle and/or its affiliates.39100./defgen paramfile . Starting at 2012-05-18 07:48:31 *********************************************************************** . 64bit (optimized).6./dirdef/section13.2.CUST_ZIP Definitions generated for 3 tables in . execute the command from the GGSCI prompt: GGSCI (AMER) 4> shell .0.1.6.0.cust_zip. If any errors are reported.defs GGSCI (AMER) 5> defgen will report runtime data to the screen. and then exit GGSCI.wshop_funcs.2.wshop_encrypt./dirdef/section13. x64.x86_64 Node: EDRSR31P1 Machine: x86_64 soft limit hard limit Address Space Size : unlimited unlimited Heap Size : unlimited unlimited File Size : unlimited unlimited CPU Time : unlimited unlimited Process id: 17041 *********************************************************************** ** Running with the following parameters ** *********************************************************************** DefsFile . Retrieving definition for WEST.1910 Linux. Retrieving definition for WEST. All rights reserved. Purge UserID gguser. All rights reserved.defs. 2012. Oracle 11g on Jan 31 2012 21:49:39 Copyright (C) 1995./dirprm/defgen. Release 2.WSHOP_FUNCS Table WEST. Copyright © 2012. Exit the shell-out.el6uek. Retrieving definition for WEST. fix and rerun.WSHOP_ENCRYPT Table WEST.Page 5 Oracle Internal & Oracle Academy Use Only *********************************************************************** Oracle GoldenGate Table Definition Generator for Oracle Version 11.prm Operating System Version: Linux Version #1 SMP Thu Sep 29 16:50:38 EDT 2011.1. In the GG_AMER_HOME terminal window.12. Practices for Lesson 13: Configuration Options Chapter 13 .0_PLATFORMS_120131.0. Oracle and/or its affiliates. Oracle and/or its affiliates. Copyright © 2012. Practices for Lesson 13: Configuration Options Chapter 13 . verify that the section13 file is there: .defs file to the same location on the target server: GGSCI 5> Exit [OS_prompt gg_amer] cd dirdef [OS_prompt dirdef] ls s* section13./dirdef/section13.defs [OS_prompt dirdef] cp section13. All rights reserved.Page 6 Oracle Internal & Oracle Academy Use Only In the GG_EURO_HOME terminal window.defs $GG_EURO_HOME/dirdef [OS_prompt dirdef] [OS_prompt dirdef] cd $GG_EURO_HOME/dirdef [OS_prompt dirdef] pwd /u01/app/oracle/gg_euro/dirdef [OS_prompt dirdef] ls -al s* -rw-r--r-.defs [OS_prompt dirdef] This completes Practice 13-1. Continue with Practice 13-2.1 oracle oinstall 1871 May 18 07:51 section13. Copy the.7. Copyright © 2012. Save and close the file: MyKey1 MyKey2 MyKey3 MyKey4 MyKey5 3. Name the keys MyKey1 through MyKey5. Then open the file with your text editor of choice: [OS_prompt ~] cd $GG_AMER_HOME [OS_prompt gg_amer] . Oracle and/or its affiliates.Practice 13-2: Oracle GoldenGate Encryption Overview Oracle GoldenGate offers three types of encryption: Oracle GoldenGate Trail. and password. 0x449FFE730EF5634F 0x1F1914181FDE5B2048A11E5B0F712377 0xBEE3A6170DCA34671DBF8D12524DD403312ECE240529CA5C37A7540C7F790642 0xB177611C9714FB1DC1A6936BA8CAE2359B0D642EF3FB1609CAD9914DA13BA45E 0x4EB616219242DA1B110026107AAB910530AC224BC874E40E0421B9113114A008 Copy this file to the same location on the target (GG_EURO_HOME) system: [OS_prompt gg_amer] cp ENCKEYS $GG_EURO_HOME In the GG_EURO_HOME terminal window. In this practice.Page 7 Oracle Internal & Oracle Academy Use Only Tasks . All rights reserved./keygen 64 1 > ENCKEYS [OS_prompt gg_amer] . encryption keys must be generated using the keygen utility. Using the keygen utility. To solve this issue. 1. Practices for Lesson 13: Configuration Options Chapter 13 . one with 128 bits./keygen 128 1 >> ENCKEYS [OS_prompt gg_amer] . Oracle GoldenGate provides a mechanism for encrypting the database access password stored in its configuration files. with one having 64 bits. create five keys. Having clear text database login credentials stored in edit files may be deemed a security violation. start a Linux shell session in the GG_AMER_HOME terminal window and navigate to the installation directory./keygen 256 3 >> ENCKEYS [OS_prompt gg_amer] gedit ENCKEYS 2. Before data encryption can occur. To run keygen and create keys that will be used for password and data transmission encryption. Your hex numbers will be different. you will use the AES256 FIPS-compliant encryption to encrypt the password for the database login. verify that the file is there: [OS_prompt gg_euro] pwd /u01/app/oracle/gg_euro [OS_prompt gg_euro] more ENCKEYS MyKey1 MyKey2 MyKey3 MyKey4 MyKey5 0x449FFE730EF5634F 0x1F1914181FDE5B2048A11E5B0F712377 0xBEE3A6170DCA34671DBF8D12524DD403312ECE240529CA5C37A7540C7F790642 0xB177611C9714FB1DC1A6936BA8CAE2359B0D642EF3FB1609CAD9914DA13BA45E 0x4EB616219242DA1B110026107AAB910530AC224BC874E40E0421B9113114A008 [OS_prompt gg_euro] Password Encryption Using Oracle GoldenGate Default Encryption 4. and three having 256 bits. Data Transmission. mac). MACRO #dbconnect BEGIN Userid gguser.[OS_prompt ~] cd $GG_AMER_HOME [OS_prompt gg_amer] . e. Navigate to the $GG_AMER_HOME/dirmac directory to retrieve the file that was completed in Practice 12 (macrolib. The Encrypt Password <password> GGSCI command uses the default Oracle GoldenGate encryption key to encrypt the provided text. Copy the encrypted password output (not the label prompt. f. To encrypt the password used by the Oracle GoldenGate macro #dbconnect do the following: a. Save the file and exit. two different levels of encryption are offered: AES and Blowfish. Many lines omitted for clarity . configure the change data capture extract from a GGSCI prompt: GGSCI (AMER) > Edit Param efuncs Copyright © 2012.. c. All rights reserved. Use your text editor of choice to edit the. Oracle and/or its affiliates. execute the following command: encrypt Password oracle_4U. at the GGSCI prompt.. Replace the same value in the macrolib. . the default key must be specified in the parameter file as well. replace <encrypted_password> with the copied value. Setting Oracle GoldenGate Change Data Capture (efuncs) 5. MACRO #bpsettings BEGIN . Password AADAAAAAAAAAAAJAMEHJTEOAXDFHGGSILHRGKAXIFJUGMCIEDECEUCXFAFWEWADFECLCEEUFAIVAJH QEIEKETECCOCJBAGJJGGAGYFRBVDLCHDIB AES256.mac file on the EURO database (/u01/app/oracle/gg_euro/dirmac)./dirmac/macrolib.. In the #dbconnect macro. For correct decryption. On the source database (GG_AMER_HOME). However. Note: All the way from Userid to MyKey3 is one line with no line breaks./ggsci GGSCI 1> Encrypt Password oracle_4U AES256 EncryptKey MyKey3 Encrypted password: AADAAAAAAAAAAAJAMEHJTEOAXDFHGGSILHRGKAXIFJUGMCIEDECEUCXFAFWEWADFECLCEEUFAIVAJH QEIEKETECCOCJBAGJJGGAGYFRBVDLCHDIB Algorithm used: AES256 GGSCI 2> b. d. The returned encrypted text is then copied to the parameter file in place of the clear text password. On the source server (GG_AMER_HOME terminal window). just the password itself) into the clipboard with no line breaks.Page 8 Oracle Internal & Oracle Academy Use Only The Encrypt Password GGSCI command is used to accomplish this task. EncryptKey MyKey3 END.. Practices for Lesson 13: Configuration Options Chapter 13 .mac file. CUST_ZIP./dirdat/ex. Oracle and/or its affiliates. GGSCI (AMER) 7> Add Extract efuncs./dirdat/px: Copyright © 2012. TOKENS ( TKN-EXTLAG-MSEC = @GETENV ("LAG"./dirdat/ex NoEncryptTrail ExtTrail . TKN-SRC-DBVERSION = @GETENV ("DBENVIRONMENT". TranLog./dirdat/ec. Megabytes 1 EXTTRAIL added.Page 9 Oracle Internal & Oracle Academy Use Only #dbconnect () #bpsettings () Table WEST. All rights reserved. transmit the data to the target server. 6.Your editor of choice starts and opens the efuncs. . Password oracle_4U Successfully logged into database. Extract efuncs.mac List Extract efuncs EncryptTrail AES256 KeyName MyKey3 ExtTrail . Table WEST. Setting Up the First GoldenGate Extract Data Pump (pfuncs) 7.WSHOP_ENCRYPT. "DBNAME")./dirdat/ex. "MSEC"). Save and close the file.WSHOP_FUNCS. Add the following runtime parameters to the text file: NoList Include . GGSCI (AMER) 10> Notice this Extract group has two trails: one encrypted (ex) and one plain text (ec). On the source server (GG_AMER_HOME terminal window). TKN-SRC-DBNAME = @GETENV ("DBENVIRONMENT".WSHOP_ENCRYPT. and write it to the Remote Trail . Begin Now EXTRACT added. "CSN") )./dirmac/macrolib.prm file. Megabytes 1 EXTTRAIL added. configure the first Extract Data Pump to read from the Local Extract Trail . Extract efuncs. GGSCI 8> Add ExtTrail . Practices for Lesson 13: Configuration Options Chapter 13 . GGSCI 9> Add ExtTrail ./dirdat/ec Table WEST. Table WEST. TKN-TXN-CSN = @GETENV ("TRANSACTION". "DBVERSION"). Add the Extract Group and two Local Extract Trails by executing the following GGSCI commands: GGSCI (AMER) 6> DBLogin UserID gguser. /dirdat/ec. All rights reserved. Add the following runtime parameters to the text file: Extract pfunca RmtHost easthost. transmit the data to the target server. and write it to the Remote Trail . Add the Extract Group by executing the following GGSCI commands: GGSCI (AMER) > Add Extract pfuncs. Oracle and/or its affiliates./dirdat/ec GGSCI > Add RmtTrail . ExtTrailsource .GGSCI (AMER) > Edit Param pfuncs Your text editor of choice starts and opens the pfuncs. Extract pfunca. 10. Megabytes 1 RMTTRAIL added. MgrPort 15001. Compress RmtTrail .*.prm file. . Add the following runtime parameters to the text file: Extract pfuncs RmtHost easthost. Save and close the file. On the source server (GG_AMER_HOME terminal window). This checkpoint table ensures that the Replicat checkpoint is part of the transaction and is used to ensure data integrity. create the checkpoint table: Copyright © 2012./dirdat/px. Megabytes 1 Creating the Oracle GoldenGate Checkpoint Table On the target server. Compress RmtTrail ./dirdat/px Passthru Table WEST. Extract pfuncs. GGSCI (AMER) > Setting Up the Second Oracle GoldenGate Extract Data Pump (pfunca) 9.*. ExtTrailsource . Replicat checkpoints to a special table created in the database./dirdat/pc Passthru Table WEST./dirdat/ex GGSCI > Add RmtTrail .Page 10 Oracle Internal & Oracle Academy Use Only EXTRACT added. Practices for Lesson 13: Configuration Options Chapter 13 .prm file. If it does not already exist. configure the second Extract Data Pump to read from the Local Extract Trail . 8. MgrPort 15001./dirdat/pc: GGSCI (AMER) > Edit Param pfunca vi starts and opens the pfunca./dirdat/pc. Add the Extract Group by executing the following GGSCI commands: GGSCI > Add Extract pfunca. zip_state FROM east.WSHOP_FUNCS) Map WEST.11. Purge #bpsettings () #funcsmap (WEST.CUST_ZIP.mac List Replicat rfunca #dbconnect () SourceDefs .. On the target server (GG_EURO_HOME terminal window). cust_state = @GETVAL (ZIPLKUP. using GLOBALS specification (GGS_CHECKPOINT)./dirmac/macrolib. Checkpoint table GGS_CHECKPOINT does not exist. All rights reserved.prm file. GGSCI (EURO) 2> Info CheckpointTable No checkpoint table specified. configure the Replicat Delivery components: GGSCI (EURO) > Edit Param rfunca Your editor of choice starts and opens the rfunca. cust_city = @GETVAL (ZIPLKUP. Oracle and/or its affiliates.zip_city).zip_state) ). Copyright © 2012. using GLOBALS specification (GGS_CHECKPOINT). start GGSCI and execute the following commands: [OS_prompt] . Add the following runtime parameters to the text file: NoList Include .. GGSCI (EURO) 4> Setting Up Oracle GoldenGate Delivery (Two Replicats: rfunca and rfunc) 12. On the target server (GG_EURO_HOME terminal window)./ggsci GGSCI (EURO) 1> DBLogin UserID gguser./dirrpt/rfunca. No checkpoint table specified.WSHOP_FUNCS.zip_lookup WHERE zip = :vzip ".Page 11 Oracle Internal & Oracle Academy Use Only GGSCI (EURO) 3> Add CheckpointTable ./dirdef/section13. SQLEXEC (ID ZIPLKUP. ColMap (usedefaults.. TARGET EAST. PARAMS (vzip = cust_zip)). Password oracle_4U Successfully logged into database. Successfully created checkpoint table GGS_CHECKPOINT.dsc.defs DiscardFile . Save and close the file. EAST. QUERY " SELECT zip_city. Practices for Lesson 13: Configuration Options Chapter 13 .CUST_CITY_STATE.. /dirrpt/rfunca.CUST_CITY_STATE. bug fix pending ColMap (usedefaults.*./dirdat/pc 15..dsc. Practices for Lesson 13: Configuration Options Chapter 13 ./dirrpt/rfunc. TARGET EAST.Page 12 Oracle Internal & Oracle Academy Use Only NoList Include .dsc. execute the command: GGSCI (EURO) > Edit Param rfunc Your text editor of choice starts and opens the rfunc. Add the Replicats by executing the following GGSCI command: GGSCI (EURO) > DBLogin UserID gguser. Oracle and/or its affiliates.WSHOP_FUNCS) Map WEST. Purge DecryptTrail AES256 KeyName MyKey3 Map WEST. start all the extracts: GGSCI (AMER) > Start ER * Sending START request to MANAGER . 14.prm file. cust_state="XX" ). Purge #bpsettings () #funcsmap (WEST. Target EAST.defs DiscardFile . EXTRACT PFUNCS starting GGSCI (AMER) > Copyright © 2012./dirdat/px GGSCI (EURO) > Add Replicat rfunca.WSHOP_FUNCS./dirdef/section13. . EXTRACT EFUNCS starting Sending START request to MANAGER .. Save and close the file. In the GG_EURO_HOME terminal window.. ExtTrail . EAST. -.. Password oracle_4U GGSCI (EURO) > Add Replicat rfunc.CUST_ZIP. In the GG_AMER_HOME window./dirmac/macrolib..*.dropped SQLEXEC. Add the following runtime parameters to the text file: Replicat rfunc UserID gguser. ExtTrail . All rights reserved. Password oracle_4U AssumeTargetDefs DiscardFile .TEMPORARY BUG! REPLACE THE rfunca FILE WITH THIS BELOW: TEMPORARY BUG! REPLACE THE rfunca FILE WITH THIS ABOVE: 13.mac List Replicat rfunca #dbconnect () SourceDefs . Ensure on both systems that the manager is up and running (if not.. cust_city="Mytown". start the Manager): GGSCI > Info mgr GGSCI > Start mgr 16. EXTRACT PFUNCA starting Sending START request to MANAGER . at the GGSCI prompt. Page 13 Oracle Internal & Oracle Academy Use Only Verify that all process are running by executing Info ER * command.. REPLICAT RFUNC starting Sending START request to MANAGER . This completes Practice 13-2. REPLICAT RFUNCA starting GGSCI (EURO) > Note: The Replicats may already be running if the mgr. All rights reserved. Oracle and/or its affiliates. . start all the Replicats: GGSCI (EURO) > Start ER * Sending START request to MANAGER .. Exit GGSCI. In the GG_EURO_HOME window. Copyright © 2012. Practices for Lesson 13: Configuration Options Chapter 13 .. 17. Continue with Practice 13-3.prm was not deleted in an earlier lab.Verify that all process are running by executing the Info ER * command.. All rights reserved. Oracle and/or its affiliates. At the shelI prompt. generate source database transactions by executing the following command: [OS_prompt] cd ~/labs/Section13/sqlscripts [OS_prompt] sqlplus west/oracle_4U @trans_generator.0.2.0 .Practice 13-3: Generating Transactions and Validating Results Tasks 1. Data Mining. Oracle Label Security. Practices for Lesson 13: Configuration Options Chapter 13 . Verify that the data applied to the target wshop_encrypt table from the encrypted Oracle GoldenGate Trails is the same as the source data.0. Connected to: Oracle Database 11g Enterprise Edition Release 11. All rights reserved. Oracle. ROW_NUMBER ---------1 2 3 4 5 6 7 8 9 10 ROW_TEXT ------------------------AWUpbEBePRhIKhRuKBJsrweLW yoHddMMKXlGpQLuKSDTRqSSoX ziJvSXUJxEiNqapSPAxdoVUNL JnweLVnqmYfjfhjLXeCUAlTTP UGoIkLswswiqxoqHtaFXBaYcf JVFgfYHDSUFyjjQbSWeXBfXca XntsrAQJOQqREvPDwvXZYVsbB ZcDzHjttaYQHUciWpAnMqVSav bDsUBZNWwrHADHqOhMQrlSlXN lLNtcVEHsclSGwUHPUfqNEhAd 10 rows selected. OLAP.3.sql 2.64bit Production With the Partitioning. Oracle Database Vault and Real Application Testing options SQL> SELECT * FROM wshop_encrypt. navigate to the /home/oracle/labs/Section13/sqlscripts directory. In the GG_AMER_HOME terminal window. In the GG_AMER_HOME terminal window.Page 14 Oracle Internal & Oracle Academy Use Only [OS_prompt gg_amer] sqlplus west/oracle_4U . SQL> Copyright © 2012. at the shell prompt start SQL*Plus and query all rows from the wshop_encrypt table: SQL*Plus: Release 11.0 Production on Wed Apr 25 11:10:03 2012 Copyright (c) 1982. 2011.2.3. 2.2. • TKN-TXN-CSN gets the commit sequence number for the transaction from the database.64bit Production With the Partitioning. at the shell prompt. TKN-SRC-DBNAME gets the source database name from the database environment. Copyright © 2012.prm parameter file. All rights reserved. Practices for Lesson 13: Configuration Options Chapter 13 .0 Production on Wed Apr 25 11:10:03 2012 Copyright (c) 1982.0. Macro and SQLEXEC Information 4. All rights reserved. SQL> Each table should contain 10 rows of encrypted equivalent data. OLAP. Four userdefined tokens will be added to each record captured for this table. . Validating the Token. Connected to: Oracle Database 11g Enterprise Edition Release 11.3. Oracle Label Security.0 . 2011.3. Data Mining. In the GG_AMER_HOME terminal window. Oracle Database Vault and Real Application Testing options ROW_NUMBER ---------1 2 3 4 5 6 7 8 9 10 ROW_TEXT ------------------------AWUpbEBePRhIKhRuKBJsrweLW yoHddMMKXlGpQLuKSDTRqSSoX ziJvSXUJxEiNqapSPAxdoVUNL JnweLVnqmYfjfhjLXeCUAlTTP UGoIkLswswiqxoqHtaFXBaYcf JVFgfYHDSUFyjjQbSWeXBfXca XntsrAQJOQqREvPDwvXZYVsbB ZcDzHjttaYQHUciWpAnMqVSav bDsUBZNWwrHADHqOhMQrlSlXN lLNtcVEHsclSGwUHPUfqNEhAd 10 rows selected. Oracle. • TKN-SRC-DBVERSION gets the source database version from the database environment.0. view the efuncs. start sqlplus and query the wshop_encrypt table: [OS_prompt gg_euro] sqlplus east/oracle_4U SQL*Plus: Release 11.Page 15 Oracle Internal & Oracle Academy Use Only SQL> SELECT * FROM wshop_encrypt. Oracle and/or its affiliates.3. In the GG_EURO_HOME terminal window. • • 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. view the rfunca.Page 16 Oracle Internal & Oracle Academy Use Only GGSCI (EURO) > View Param rfunca .CUST_CITY_STATE. Purge #bpsettings () #funcsmap (WEST. EAST. especially the SQLEXEC query: NOLIST INCLUDE .dsc.WSHOP_FUNCS. ColMap (usedefaults.zip_city). -. bug fix pending ColMap (usedefaults. cust_state = @GETVAL (ZIPLKUP./dirdef/section13.dsc.5.prm parameter file./dirmac/macrolib. Purge #bpsettings () #funcsmap (WEST.CUST_ZIP.zip_state) )./dirrpt/rfunca. TARGET EAST./dirmac/macrolib./dirdef/section13. PARAMS (vzip = cust_zip)). cust_city="Mytown". cust_state="XX" ). In the GG_EURO_HOME terminal window. All rights reserved.mac LIST Replicat rfunca #dbconnect () SourceDefs .mac List Replicat rfunca #dbconnect () SourceDefs . QUERY " SELECT zip_city. TEMPORARY BUG! REPLACE THE rfunca FILE WITH THIS ABOVE: Copyright © 2012. cust_city = @GETVAL (ZIPLKUP. Oracle and/or its affiliates.wshop_funcs. zip_state FROM EAST.defs DiscardFile .dropped SQLEXEC. SQLEXEC (ID ZIPLKUP.CUST_ZIP./dirrpt/rfunca. TARGET EAST.CUST_CITY_STATE. Practices for Lesson 13: Configuration Options Chapter 13 . GGSCI > TEMPORARY BUG! REPLACE THE rfunca FILE WITH THIS BELOW: NoList Include .defs DiscardFile .WSHOP_FUNCS) Map WEST.wshop_funcs) Map WEST. EAST.zip_lookup WHERE zip = :vzip ". ColMap (usedefaults.3 2768898 Oracle Database 11g Enterprise Edition Release 11. Practices for Lesson 13: Configuration Options Chapter 13 .3 2768886 10 rows selected. "MSEC"). src_db_name = @TOKEN ("TKN-SRC-DBNAME").3 2768896 Oracle Database 11g Enterprise Edition Release 11. "COMMITTIMESTAMP").2. For every WEST.3 2768892 Oracle Database 11g Enterprise Edition Release 11.3 2768888 Oracle Database 11g Enterprise Edition Release 11. Verify that the token data was applied to the target by executing the following query: SQL> SELECT src_db_name. src_db_version = @TOKEN ("TKN-SRC-DBVERSION"). src_db_version. src_txn_csn FROM wshop_funcs.MACRO #funcsmap PARAMS (#src_table. the Map statement for EAST.CUST_ZIP uses the SQLEXEC option to query a lookup table. Copyright © 2012. The returned data is mapped into the target zip_city and zip_state columns.0. All rights reserved. SRC_DB_NAM ---------AMER AMER AMER AMER AMER AMER AMER AMER AMER AMER SRC_DB_VERSION SRC_TXN_CSN ------------------------------------------------------. This macro uses two column conversion functions: @GETENV to get the commit timestamp from the GoldenGate header record and Replicat lag from the Oracle GoldenGate environment.----------Oracle Database 11g Enterprise Edition Release 11.3 2768894 Oracle Database 11g Enterprise Edition Release 11. and @TOKEN to get the tokens set by the source Extract.2.0.0.2. Also notice that for the rfunca parameters. the query will be executed using the incoming data for the cust_zip column in the WHERE clause.0.Page 17 Oracle Internal & Oracle Academy Use Only The Map statement for the wshop_funcs table utilizes the #funcsmap macro: .0.3 2768878 Oracle Database 11g Enterprise Edition Release 11.3 2768890 Oracle Database 11g Enterprise Edition Release 11.3 2768900 Oracle Database 11g Enterprise Edition Release 11. END.2. lag_replicat_ms = @GETENV ("LAG".0.0. 6.2.2. #target_table) BEGIN Map #src_table. On the target database (GG_EURO_HOME terminal window).3 2768882 Oracle Database 11g Enterprise Edition Release 11. execute the command from a shell prompt: [OS_prompt] sqlplus east/oracle_4U a. gg_commit_ts = @GETENV ("GGHEADER".2. Oracle and/or its affiliates.0.2.CUST_ZIP record. SQL> Your SCN will be different.0.2.0. lag_extract_ms = @TOKEN ("TKN-EXTLAG-MSEC"). src_txn_csn = @TOKEN ("TKN-TXN-CSN") ).2. TARGET #target_table. Page 18 Oracle Internal & Oracle Academy Use Only b.06.LAG_EXTRACT_MS LAG_REPLICAT_MS -------------.009538 AM 25-MAY-12 11.24.06. execute the following query: SQL> SELECT gg_commit_ts FROM wshop_funcs.24. Back in the GG_AMER_HOME terminal window.06. Practices for Lesson 13: Configuration Options Chapter 13 .24.009538 AM 25-MAY-12 11.24.24.009538 AM 25-MAY-12 11.06.24.06. Oracle and/or its affiliates. Your lag values may vary. execute the query: SQL> SELECT lag_extract_ms.009628 AM 25-MAY-12 11. . Extract took 1.009628 AM 25-MAY-12 11. SQL> In the above example.24.009628 AM 10 rows selected.009538 AM 25-MAY-12 11. lag_replicat_ms FROM wshop_funcs.06. Still in EAST.06. To return the data that was recorded as the source record commit timestamp.009538 AM 25-MAY-12 11. while Replicat lag time (Replicat current time – transaction commit timestamp) was around 4 seconds. execute the following command: [OS_prompt] sqlplus west/oracle_4U Copyright © 2012.24. c. SQL> d.06. All rights reserved.009538 AM 25-MAY-12 11.24.24. GG_COMMIT_TS --------------------------------------------------------------------------25-MAY-12 11.--------------1832 4477 1832 4477 1832 4477 1832 4477 1832 4477 1832 4477 1832 4477 1832 3461 1832 3461 1832 3461 10 rows selected.009538 AM 25-MAY-12 11.06.8 seconds to capture each record from Oracle redo.06. /dirrpt/* Copyright © 2012.---------XX 80033 XX 70117 XX 94105 XX 80202 XX 70001 TEMPORARY BUG! REPLACE THE RESULTS WITH THIS ABOVE: Clean up the Oracle GoldenGate environment by executing the following GGSCI commands on both the source and target servers: GGSCI> Stop ER * GGSCI> DBLogin UserID gguser. CUST_ID ---------1 2 3 4 5 CUST_CITY ------------------------Wheat Ridge New Orleans San Francisco Denver Jefferson CU CUST_ZIP -. SQL> Verify the SQLEXEC functionality by executing the following query in the GG_EURO_HOME terminal window: SQL> SELECT * FROM cust_city_state. All rights reserved.---------CO 80033 LA 70117 CA 94105 CO 80202 LA 70001 SQL> TEMPORARY BUG! REPLACE THE RESULTS WITH THIS BELOW: SQL> SELECT * FROM cust_city_state. CUST_ID ---------1 2 3 4 5 7. Password oracle_4U GGSCI> Delete ER * GGSCI> Delete CheckpointTable (only for the EURO db) GGSCI> Stop mgr ! GGSCI> Exit [OS_PROMPT] rm . Oracle and/or its affiliates.e. Practices for Lesson 13: Configuration Options Chapter 13 .Page 19 Oracle Internal & Oracle Academy Use Only CUST_ID CUST_ZIP ---------. CUST_CITY -----------------------Mytown Mytown Mytown Mytown Mytown CU CUST_ZIP -./dirdat/* [OS_PROMPT] rm . f.---------1 80033 2 70117 3 94105 4 80202 5 70001 . Verify the ZIP codes: SQL> SELECT * FROM cust_zip. sh. Stop here. then stop both GGSCI sessions and run ~/labs/setup/kill-all-ogg. Oracle and/or its affiliates. Copyright © 2012. Practices for Lesson 13: Configuration Options Chapter 13 .Page 20 . This completes Practice 13. All rights reserved.Oracle Internal & Oracle Academy Use Only If you wanted to automate this cleanup. This completes Practice 13-3. All rights reserved.Chapter 14 Copyright © 2012.Page 1 Oracle Internal & Oracle Academy Use Only Practices for Lesson 14: Bidirectional Replication . Oracle and/or its affiliates. Practices for Lesson 14: Bidirectional Replication Chapter 14 . Your application is load-balanced across the two data centers so that each data center services 50% of all active accounts. This is accomplished by configuring Oracle GoldenGate in ActiveActive mode. pumping the captured data over TCP/IP to a staging queue (Oracle GoldenGate Remote Trail). the AMER and EURO databases are exact copies of one another. Practices for Lesson 14: Bidirectional Replication Chapter 14 . All rights reserved. Copyright © 2012.Page 2 Oracle Internal & Oracle Academy Use Only Big Picture . Oracle and/or its affiliates.Practices for Lesson 14: Overview Practices Overview In this practice. and appling via Replicat. Notice the potential for a loop. with Change Data Capture Extracts reading from each database’s Redo and Archive logs. you configure Oracle GoldenGate to perform real-time data capture and apply on two active databases with data segregated by location. Each data center is also the backup to the other. In the preceding diagram. so the two databases must always be in sync. execute the following commands: [OS_prompt gg_amer] .3. Scroll down the terminal window to see what objects were created. and then you will ensure that database logging is enabled. To create the AMER database. Many lines omitted for clarity .oby . This is done by setting the TranLogOptions ExcludeUser parameter in the Extract parameter file. you will create the two databases (AMER and EURO) and seed them both with identical data.Practice 14-1: Two-Way Active-Active Data Replication Overview In this practice. Oracle and/or its affiliates. You can do this easily by entering: GGSCI> Obey /home/oracle/labs/setup/startup. OLAP. Oracle Database Vault and Real Application Testing options SQL> set echo on SQL> @database. All rights reserved.2. oraenv ORACLE_SID = [amer] ? The Oracle base remains unchanged with value /u01/app/oracle [OS_prompt gg_amer] cd ~/labs/Section14/Practice14-1/sqlscripts/ [OS_prompt sqlscripts] sqlplus west/oracle_4U SQL*Plus: Release 11. There are several loop detection and avoidance methods.2. In a two-way active-active (bidirectional) replication environment.. 2011. Connected to: Oracle Database 11g Enterprise Edition Release 11..3. You will configure each Extract process to ignore transactions originated by its local Replicat user. Oracle Label Security. make sure you re-DBLogin when you restart GGSCI.. Open a terminal window and navigate to the $GG_AMER_HOME directory. oraenv command.sql SQL> /* SQL> Script to create the source database tables SQL> This will simulate a banking database used with an OLTP application .64bit Production With the Partitioning.0.. Tasks 1.0 .Page 3 Oracle Internal & Oracle Academy Use Only Note: If at any time or for any reason you exit out of GGSCI.0 Production on Wed Apr 25 11:10:03 2012 Copyright (c) 1982. Oracle. Navigate to the /home/oracle/labs/Section14/Practice14-1/sqlscripts directory. you must avoid data looping. Verify that you are in the correct database by issuing the . and what SQL statements were executed. Data Mining.0. All rights reserved. Copyright © 2012. Practices for Lesson 14: Bidirectional Replication Chapter 14 . where data changes replicated from system A to system B are replicated back to system A. sql SQL> /* SQL> Script to create the source database tables SQL> SQL> This will simulate a banking database used with an OLTP application . Connected to: Oracle Database 11g Enterprise Edition Release 11.2. Practices for Lesson 14: Bidirectional Replication Chapter 14 . All rights reserved. Many lines omitted for clarity . Many lines omitted for clarity .2. Oracle Label Security. Scroll down the terminal window to see what objects were created. Copyright © 2012.sql . execute the following commands: [OS_prompt gg_euro] . oraenv command.3. Oracle.0. and what SQL statements were executed. and the same SQL statements were executed..... To seed the West AMER source database. 3.0.3. Open another terminal window and navigate to the $GG_EURO_HOME directory. All rights reserved. execute the following commands: SQL> @seed_database..0/dbhome_1 is /u01/app/oracle [OS_prompt gg_euro] cd ~/labs/Section14/Practice14-1/sqlscripts/ [OS_prompt sqlscripts] sqlplus east/oracle_4U SQL*Plus: Release 11. Scroll down the terminal window to see that the same objects were created for east as for west.2. Verify that you are in the correct database by issuing the . oraenv ORACLE_SID = [euro] ? The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11. . To create the EURO database..0 Production on Wed Apr 25 11:10:03 2012 Copyright (c) 1982. OLAP. 2011. Table truncated.Page 4 Oracle Internal & Oracle Academy Use Only SQL> /* SQL> Seed the branch and teller lookup tables with these values SQL> Number of accounts: 2000 SQL> Starting account balance: Random up to $10000 SQL> Number of branches: 40 SQL> Tellers per branch: 20 SQL> */ SQL> SQL> TRUNCATE TABLE ACCOUNT.. Oracle Database Vault and Real Application Testing options SQL> set echo on SQL> @database. Oracle and/or its affiliates..0 . Navigate to the same /home/oracle/labs/Section14/Practice14-1/sqlscripts directory.64bit Production With the Partitioning. Data Mining.2. . and what SQL statements were executed. Table truncated.. Creating the Replicat Checkpoint Table on AMER Replicat checkpoints to a special table created in the database.Page 5 Oracle Internal & Oracle Academy Use Only SQL> /* SQL> Seed the branch and teller lookup tables with these values SQL> Number of accounts: 2000 SQL> Starting account balance: Random up to $10000 SQL> Number of branches: 40 SQL> Tellers per branch: 20 SQL> */ SQL> SQL> TRUNCATE TABLE ACCOUNT. Copyright © 2012.. navigate to the directory where Oracle GoldenGate is installed. Many lines omitted for clarity . You already had configured one for Euro (but it was deleted as part of the last cleanup). Input the following parameter line: CheckpointTable GGS_CHECKPOINT Note: The file name must be all uppercase with no extension. All rights reserved. and execute the following commands: [OS_prompt] cd $GG_AMER_HOME [OS_prompt gg_amer] vi GLOBALS You can use gedit or any text editor instead of vi. This checkpoint table ensures that the Replicat checkpoint is part of the transaction and is used to ensure data integrity. Oracle and/or its affiliates. execute the following commands: SQL> @seed_database.. To seed the East EURO source database. 5. To create the GLOBALS parameter file. Scroll down the terminal window to see what objects were created.sql . . Save and close the file. Practices for Lesson 14: Bidirectional Replication Chapter 14 .4. Oracle and/or its affiliates.. start GGSCI and execute the following commands: [OS_prompt gg_euro] . using GLOBALS specification (GGS_CHECKPOINT)..0_PLATFORMS_120131. If so.2. Password oracle_4U Successfully logged into database. All rights reserved. GGSCI (EURO) 3> Note: If the checkpoint table already exists.0_PLATFORMS_120131. using GLOBALS specification (GGS_CHECKPOINT). you will receive an error message. DBLogin UserID gguser./ggsci Oracle GoldenGate Command Interpreter for Oracle Version 11. Successfully created checkpoint table GGS_CHECKPOINT. Oracle 11g on Feb 1 2012 00:55:59 Copyright (C) 1995. you will receive an error message. GGSCI (AMER) 3> Note: If the checkpoint table already exists. Practices for Lesson 14: Bidirectional Replication Chapter 14 . All rights reserved. Oracle 11g on Feb 1 2012 00:55:59 Copyright (C) 1995. 64bit (optimized).1. GGSCI (EURO) 1> DBLogin UserID gguser. confirm the deletion. Password oracle_4U Successfully logged into database.2. confirm the deletion. start GGSCI and execute the following commands: [OS_prompt gg_amer] more GLOBALS CheckpointTable GGS_CHECKPOINT [OS_prompt gg_amer] .0.1910_FBO Linux. Copyright © 2012. All rights reserved..2.Page 6 Oracle Internal & Oracle Academy Use Only GGSCI (AMER) 1> .0. x64./ggsci Oracle GoldenGate Command Interpreter for Oracle Version 11. Oracle and/or its affiliates. 2012. 2012. issue the Delete CheckpointTable command. To create the checkpoint table on the AMER database server. issue the Delete CheckpointTable command. x64. To create the checkpoint table on the EURO database server.1910_FBO Linux.0 OGGCORE_11.1. Successfully created checkpoint table GGS_CHECKPOINT. Oracle and/or its affiliates.0. If so.0.1.2. and then try adding the checkpoint table again. 64bit (optimized)..0 OGGCORE_11. GGSCI (AMER) 2> Add CheckpointTable No checkpoint table specified. GGSCI (EURO) 2> Add CheckpointTable No checkpoint table specified. Creating the Replicat Checkpoint Table on EURO 7.6. and then try adding the checkpoint table again.1. /dirdat/*.* 9. Configuring Change Data Capture. Had you originally done SchemaTranData. All rights reserved. 8. Oracle and/or its affiliates. AMER to EURO 10.* All of these were new (as compared to Amer’s TranData). UseCheckpoints Copyright © 2012.prm You will modify those three parameter files for this practice and create a number of new entries for both the AMER and EURO databases. the Oracle database must be set to log the table key values whenever it logs a row change. you will be using: • mgr. execute the following command: GGSCI (AMER) > Edit Param mgr Verify that it includes the following: Port 15000 DynamicPortList 15010-15020 PurgeOldExtracts . Data Pump Extract. At a GGSCI prompt on the EURO database server (GG_EURO_HOME terminal window). At a GGSCI prompt on the AMER database server (GG_AMER_HOME terminal window). Practices for Lesson 14: Bidirectional Replication Chapter 14 .* Creating the Oracle GoldenGate Components on AMER In this practice. execute the following commands: GGSCI (EURO) > Add TranData EAST.* .Getting the Database to Log Keys As you have seen in previous practices. Extract.prm • extwest.Page 7 Oracle Internal & Oracle Academy Use Only Many of these were already enabled. so that they are available to Oracle GoldenGate in Redo. For this practice. execute the following commands: GGSCI (AMER) > Add TranData WEST. Validate table-level supplemental logging is on by executing the following command in the GG_AMER_HOME terminal window: GGSCI (AMER) > Info TranData WEST. the added tables would have automatically been picked up. you will configure the Manager. From the previous practices.prm • pwest. In your GG_AMER_HOME terminal window. and Replicat on the AMER instance. at the GGSCI prompt. you should still have a number of parameter files already created for the AMER database. Validate table-level supplemental logging is on by executing the following command in the GG_EURO_HOME terminal window: GGSCI (EURO) > Info TranData EAST. Megabytes 50 This adds the. Rate TranLogOptions ExcludeUser gguser Table WEST./dirdat/ew UserID gguser.Page 8 Oracle Internal & Oracle Academy Use Only GGSCI (AMER) 11> . as the Where () clause will cause conflicts here. Where (ACCOUNT_TRANS_TYPE = "CR")./dirdat/ew. Start the Manager and verify that it is running.ACCOUNT_TRANS. In the GG_AMER_HOME terminal window. Add the Extract group by executing the following GGSCI commands: • Add Extract extwest. If extwest has the line that says: Table WEST. Note there is no harm in trying to start it twice: GGSCI (AMER) 8> Start mgr Manager started. All rights reserved. Extract extwest. and links the trail to the extwest Extract. then remove that one line or comment it out and replace it with: Table WEST. modify the extract file by executing the following command: GGSCI (AMER) > Edit Param extwest Add the following parameter on an empty line before the first Table statement: TranLogOptions ExcludeUser gguser Edit and verify that the extwest.prm file looks similar to the following: Extract extwest ExtTrail . Oracle and/or its affiliates./dirdat/ew Local Extract Trail. Do not forget the last trailing semi-colon. at the GGSCI prompt. Note: Your file may look slightly different depending on how you completed Lab 10-3. 13. GGSCI (AMER) 10> Info mgr Manager is running (IP port westhost. Save and close the file. with a maximum file size of 50 megabytes per trail. with an initial Redo checkpoint of the current timestamp. Password oracle_4U StatOptions ResetReportStats Report At 00:01 ReportRollover At 00:01 ReportCount Every 1000 Records ReportCount Every 60 Seconds.15000). • Add ExtTrail . GGSCI (AMER) 9> Start mgr MGR is already running. Tranlog.*.*. Begin Now This adds the extwest Extract to GoldenGate specifying that it will read from Oracle DB Redo/Archive logs. 12. Practices for Lesson 14: Bidirectional Replication Chapter 14 .11. Copyright © 2012. GGSCI > Add ExtTrail . 15. Save and close the file. Megabytes 50 EXTTRAIL added./dirdat/pw REPLICAT added.Page 9 Oracle Internal & Oracle Academy Use Only GGSCI (AMER) > . On the AMER database server. transmit the data to the EURO server. 17. Add the Extract Group by executing the following GGSCI commands: GGSCI (AMER) > Add Extract pwest. Practices for Lesson 14: Bidirectional Replication Chapter 14 . 14. To set up Oracle GoldenGate Delivery on the AMER database. GGSCI > Add RmtTrail . ExtTrailSource . TranLog. GGSCI (AMER) > 16. ExtTrail .*.*. configure the Extract Data Pump to read from the. Extract extwest. Purge UserID gguser.*./dirdat/ew EXTRACT added./dirrpt/rwest. All rights reserved. Extract pwest.GGSCI (AMER) > Add Extract extwest.dsc./dirdat/ew.prm file. Target WEST. Save and close the file./dirdat/pe Passthru Table WEST. GGSCI (AMER) > Copyright © 2012. Password oracle_4U Map EAST. From a GGSCI prompt. and write it to the. Megabytes 50 RMTTRAIL added. execute the following command: GGSCI (AMER) > Edit Param pwest Verify that it includes the following: Extract pwest RmtHost easthost. Add the Replicat by executing the following GGSCI command: GGSCI (AMER) > Add Replicat rwest. MgrPort 15001. Add the following runtime parameters to the text file: Replicat rwest AssumeTargetDefs DiscardFile . Oracle and/or its affiliates. you must configure the Replicat component./dirdat/ew (“Extract West”) Local Extract Trail. Begin Now EXTRACT added. Compress RmtTrail . execute the following command: GGSCI> Edit Param rwest Your text editor of choice starts and opens the rwest./dirdat/pe (“Pump East”) Remote Trail: From a GGSCI prompt./dirdat/pe. /dirdat/ee. 21. Practices for Lesson 14: Bidirectional Replication Chapter 14 .prm • reast. UseCheckpoints 19.Page 10 Oracle Internal & Oracle Academy Use Only Configuring the Change Data Capture. Extract eeast. EURO to AMER . TranLog. you will be using: • mgr. Extract eeast. Add the Extract group by executing the following GGSCI commands: • Add Extract eeast. and links the trail to the Extract eeast. with a maximum file size of 50 megabytes per trail. In the GG_EURO_HOME terminal window. Password oracle_4U TranLogOptions ExcludeUser GGUSER Table EAST. you should still have a number of parameter files already created for the EURO database. Begin Now This adds the eeast Extract to GoldenGate. Add the following runtime parameters to the text file: Extract eeast ExtTrail .*. Save and close the file.prm You will modify these parameter files in this practice and create a number of new entries and a new parameter file for both the AMER and EURO databases. Begin Now EXTRACT added./dirdat/ee Local Extract Trail. Tranlog. execute the following: GGSCI (EURO) > Edit Param mgr Verify that it includes at least the following: Port 15001 PurgeOldExtracts . specifying that it will read from Oracle Redo/Archive with an initial Redo checkpoint of the current timestamp. and Replicat on the EURO instance. GGSCI (EURO) > Add Extract eeast.Creating the Oracle GoldenGate Components on EURO Now you will configure the Manager. Data Pump Extract. 18. From the previous practices./dirdat/ee UserID gguser./dirdat/ee. create the extract file by executing the following: GGSCI(EURO) > Edit Param eeast Your text editor of choice starts and opens the eeast. Megabytes 50 This adds the. GGSCI (EURO) > Copyright © 2012. Start the Manager and verify that it is running: GGSCI (EURO) > Start mgr GGSCI (EURO) > Info manager 20.prm file. at the GGSCI prompt. For this practice. Extract. All rights reserved. • Add ExtTrail ./dirdat/*. In your GG_EURO_HOME terminal window. Megabytes 50 EXTTRAIL added. Oracle and/or its affiliates. GGSCI > Add ExtTrail . Extract peast. In both the GG_AMER_HOME terminal window and the GG_EURO_HOME terminal window. Save and close the file. 25. Compress RmtTrail .Page 11 Oracle Internal & Oracle Academy Use Only Your text editor of choice starts and opens the peast. From a GGSCI prompt./dirrpt/reast./dirdat/ee EXTRACT added.dsc.*. On the EURO database server. ExtTrail . Target EAST. Oracle and/or its affiliates. execute the following command: GGSCI(EURO) > Edit Param peast Save and close the file.22. ExtTrailSource . configure the Extract Data Pump to read from the./dirdat/pw Remote Trail: From a GGSCI prompt.*. GGSCI > Add RmtTrail . Add the Extract Group by executing the following GGSCI commands: GGSCI (EURO) > Add Extract peast. GGSCI (EURO) > 24./dirdat/pw Passthru Table EAST. execute the following command at the GGSCI prompt to start all of the configured Extracts and Replicats: Copyright © 2012.prm file. GGSCI (EURO) > Validating the Results 26. Add the following runtime parameters to the text file: Extract peast RmtHost westhost. Purge UserID gguser. To set up Oracle GoldenGate Delivery on the EURO database. execute the following command: GGSCI (EURO) > Edit Param reast Verify that it includes the following: Replicat reast AssumeTargetDefs DiscardFile . and write it to the . . Add the Replicat by executing the following GGSCI command: GGSCI (EURO) > Add Replicat reast. MgrPort 15000.*. All rights reserved./dirdat/ee Local Extract Trail. transmit the data to the AMER server. Practices for Lesson 14: Bidirectional Replication Chapter 14 ./dirdat/pe REPLICAT added. you must modify the Replicat parameter file./dirdat/pw. Password oracle_4U Map WEST. Megabytes 50 RMTTRAIL added. 23. the processes should all end in EAST: GGSCI (EURO) > Start ER * Sending START request to MANAGER . EXTRACT PWEST starting Sending START request to MANAGER .For GG_AMER_HOME...... Practices for Lesson 14: Bidirectional Replication Chapter 14 .. Execute the following GGSCI command to make sure that all of the components are in the RUNNING state: Copyright © 2012. the processes should all end in WEST: GGSCI (AMER) > Start ER * Sending START request to MANAGER .. REPLICAT RWEST starting For GG_EURO_HOME. EXTRACT PEAST starting Sending START request to MANAGER .Page 12 Oracle Internal & Oracle Academy Use Only GGSCI (AMER) > . Oracle and/or its affiliates.. EXTRACT EXTWEST starting Sending START request to MANAGER . All rights reserved. EXTRACT EEAST starting Sending START request to MANAGER ..... REPLICAT REAST starting GGSCI (EURO) > 27. /dirdat/ee000000 First Record RBA 1036 REPLICAT REAST Checkpoint Lag Log Read Checkpoint Last Started 2012-05-21 10:28 Status RUNNING 00:00:00 (updated 00:00:04 ago) File . All rights reserved.2331531 (2331531) EXTRACT PWEST Checkpoint Lag Log Read Checkpoint Last Started 2012-05-21 10:28 Status RUNNING 00:00:00 (updated 00:00:02 ago) File .2303916 (2303916) EXTRACT PEAST Checkpoint Lag Log Read Checkpoint Last Started 2012-05-21 10:28 Status RUNNING 00:00:00 (updated 00:00:09 ago) File . fix the error condition. Practices for Lesson 14: Bidirectional Replication Chapter 14 . and restart the group.For GG_AMER_HOME: EXTRACT EXTWEST Checkpoint Lag Log Read Checkpoint Last Started 2012-05-21 10:28 Status RUNNING 00:00:00 (updated 00:00:05 ago) Oracle Redo Logs 2012-05-21 10:30:26 Seqno 73. Copyright © 2012. RBA 17310720 SCN 0. Oracle and/or its affiliates. view the group’s report file.Page 13 Oracle Internal & Oracle Academy Use Only GGSCI (AMER) > Info ER * . Exit GGSCI in both terminal windows. RBA 37357056 SCN 0./dirdat/ew000000 First Record RBA 1038 REPLICAT RWEST Checkpoint Lag Log Read Checkpoint Last Started 2012-05-21 10:28 Status RUNNING 00:00:00 (updated 00:00:06 ago) File ./dirdat/pw000000 First Record RBA 0 GGSCI (AMER) > Write down the Log Read Checkpoint RBA numbers you see on your screen: Answer:__________________________________________________________________ For GG_EURO_HOME: GGSCI (EURO) > Info ER * EXTRACT EEAST Checkpoint Lag Log Read Checkpoint Last Started 2012-05-21 10:28 Status RUNNING 00:00:00 (updated 00:00:00 ago) Oracle Redo Logs 2012-05-21 10:32:35 Seqno 73./dirdat/pe000000 First Record RBA 0 GGSCI (EURO) > Write down the Log Read Checkpoint RBA numbers you see on your screen: Answer:__________________________________________________________________ If any Oracle GoldenGate groups show a state of STOPPED or ABEND. the transaction generator scripts complete. Practices for Lesson 14: Bidirectional Replication Chapter 14 . Copyright © 2012.Page 14 Oracle Internal & Oracle Academy Use Only In the GG_EURO_HOME terminal window. Oracle and/or its affiliates. The RBA values should now be much higher. 32. This completes Practice 14-1. Total In the GG_AMER_HOME terminal window. Exit out of both GGSCI prompts.28. execute the following command: . After a few seconds. 30. GGSCI (EURO) > Stats reast. All rights reserved. navigate to the /home/oracle/labs/Section14/Practice14-1/sqlscripts directory. Then execute the GGSCI command on each database: GGSCI > Info ER * This will display information for the two Replicats. Start database activity by running the transaction generators simultaneously in the shells. execute the same command for the Replicat. Execute the GGSCI command in the GG_AMER_HOME terminal window to get operation counts per table for the change data capture Extract: GGSCI (AMER) > Stats extwest. Continue with Practice 14-2. b. navigate to the /home/oracle/labs/Section14/Practice14-1/sqlscripts directory. Clean up the Oracle GoldenGate environment by executing the following GGSCI commands on both the source and target servers: a. after you started the Replicats and Extracts. To generate transactions for the AMER database. execute the same command for the Replicat.sh. execute the following command: [OS_prompt gg_amer] sqlplus west/oracle_4U SQL> set echo on SQL> @trans_generator_west. The transaction counts for these components should match as well. GGSCI (AMER) > Stats rwest. To generate transactions for the EURO database.sql 29. 31. run ~/labs/setup/kill-all-ogg. At an OS prompt. Total The counts for the Extract (on EURO) and Replicat (on AMER) numbers should match. Total In the GG_EURO_HOME terminal window.sql [OS_prompt gg_euro] sqlplus east/oracle_4U SQL> set echo on SQL> @trans_generator_east. Because TranLogOptions ExcludeUser GGUSER was specified in the Extract parameter files on both AMER and EURO. Compare the RBA values with those you wrote down earlier. Execute the GGSCI command in the GG_EURO_HOME terminal window to get operation counts per table for the change data capture Extract: GGSCI (EURO) > Stats eeast. When the Log Read Checkpoint RBA value returned stops incrementing for the Replicats all captured data has been applied. In the GG_AMER_HOME terminal window. it ensured changes made by the local Replicat user will not be extracted along with changes made by other users on that site. Total The counts for the Extract (on AMER) and Replicat (on EURO) numbers should match. Do the same for the EEAST Extract and the RWEST Replicat. so that the resulting qty_in_stock values after the replicated transactions are applied will be the same on both sites. the transaction replicated to the AMER (West) database will also fail because the before image (from EURO) of qty_in_stock. Practices for Lesson 14: Bidirectional Replication Chapter 14 .Practice 14-2: Conflict Detection and Resolution Because Oracle GoldenGate is an asynchronous solution. conflicts can occur when modifications are made to identical sets of data on separate systems at the same time. To resolve the conflict. In this example. you will add code in the Replicat Delivery configuration to add the sum total of the orders from both sites. With conflict detection enabled. Customer A places an order for 15 widgets that is routed through the AMER (also known as West) database. Customer B simultaneously places an order for 4 widgets that is routed through the EURO (also known as East) database. in a dual active environment. • The SQL statement executed is UPDATE products SET qty_in_stock = qty_in_stock + 4 WHERE products_name = 'widget' AND qty_in_stock = 20. If the quantity on hand goes to 0. • A replicated delete attempts to remove a row that does not exist in the target. you will set up a very simple Oracle GoldenGate configuration to demonstrate net change value. 3. In this practice. The warehouse is stocked with 20 widgets. Oracle and/or its affiliates. For example. the item is tagged as out of stock in our online ordering system. the transaction will fail because the before image (from AMER) of qty_in_stock is 20. when Oracle GoldenGate attempts to update the EURO (East) database with the transaction from customer A. which does not match the current column value of 24 in EURO. The result is 34. the number of widgets in stock according to the AMER database is 30. Conflicts occur when the timing of simultaneous changes results in one of the following out-ofsync conditions: • A replicated insert attempts to add a row that already exists in the target. All rights reserved. UserA on DatabaseA updates a row. • The Before image of a replicated update does not match the current row in the target.Page 15 Oracle Internal & Oracle Academy Use Only Overview . there will be a conflict on the replicated transaction. does not match the current column value of 30 in AMER. Copyright © 2012. 20. Conflict detection and conflict resolution will be implemented to maintain accurate inventory counts when the application uses update statements to decrement inventory. If UserB’s transaction occurs before UserA’s transaction is synchronized to DatabaseB. 2. • The SQL statement executed is UPDATE products SET qty_in_stock = qty_in_stock + 10 WHERE products_name = 'widget' AND qty_in_stock = 20. and UserB on DatabaseB updates the same row. and the number in stock according to the EURO database is 24. Conversely. The premise for this demonstration is an online retail environment where: 1. routed through AMER (West). with no line breaks: Copyright © 2012. In the GG_AMER_HOME terminal window. Practices for Lesson 14: Bidirectional Replication Chapter 14 . Scroll down the terminal window to see what objects were created. Oracle and/or its affiliates. navigate to the /home/oracle/labs/Section14/Practice14-2/sqlscripts directory.Tasks Creating the Table and Data in the Database 1. At a GGSCI prompt on the AMER database server (GG_AMER_HOME terminal window). execute the following command: [OS_prompt] sqlplus west/oracle_4U SQL> set echo on SQL> @database_west.sql Getting the Database to Log Keys and Columns 3. and what SQL statements were executed. Enter each command all on one line. navigate to the /home/oracle/labs/Section14/Practice14-2/sqlscripts directory.sql 2. To create the identical table in the EURO database. execute the following commands to turn on supplemental logging The Cols option adds more than the primary key to the Before image. All rights reserved. In the GG_EURO_HOME terminal window. execute the following command: [OS_prompt] sqlplus east/oracle_4U SQL> set echo on SQL> @database_east. To create the table in the AMER database.Page 16 Oracle Internal & Oracle Academy Use Only Big Picture The following flowchart shows the components and relationships that you will create: . Password oracle_4U Successfully logged into database.PRODUCTS. At a GGSCI prompt on the EURO database server (GG_EURO_HOME terminal window). Columns supplementally logged for table WEST.PRODUCTS. GGSCI (AMER) 2> Add TranData WEST. Practices for Lesson 14: Bidirectional Replication Chapter 14 . Oracle and/or its affiliates. In the GG_AMER_HOME terminal window. vendor. Cols (product_name.PRODUCTS.PRODUCTS: PRODUCT_NUMBER. create the Manager parameter file: GGSCI (AMER) > Edit Param mgr Verify that the following parameters are present: Port 15000 DynamicPortList 15010-15020 PurgeOldExtracts . . MODIFIED_TS. qty_in_stock. qty_in_stock.PRODUCTS: PRODUCT_NUMBER. PRODUCT_NAME. GGSCI (AMER) > Copyright © 2012.PRODUCTS.GGSCI (AMER) 1> DBLogin UserID gguser. GGSCI (AMER) 3> Info TranData WEST. GGSCI (AMER) > Info manager Manager is running (IP port westhost. Columns supplementally logged for table EAST. modified_ts) Logging of supplemental redo data enabled for table WEST. Start the Manager process: GGSCI (AMER) > Start mgr Manager started. GGSCI (EURO) 2> Add TranData EAST. VENDOR.PRODUCTS. QTY_IN_STOCK. MODIFIED_TS.15000). execute the following commands to enable supplemental logging: GGSCI (EURO) 1> DBLogin UserID gguser. GGSCI (EURO) 3> Info TranData EAST./dirdat/*. VENDOR. modified_ts) Logging of supplemental redo data enabled for table WEST. Password oracle_4U Successfully logged into database. QTY_IN_STOCK. Configuring and Starting the GoldenGate Manager on AMER and EURO 5. Cols (product_name.PRODUCTS Logging of supplemental redo log data is enabled for table EAST. All rights reserved. PRODUCT_NAME.PRODUCTS. Usecheckpoints 6.PRODUCTS 4. vendor.Page 17 Oracle Internal & Oracle Academy Use Only Logging of supplemental redo log data is enabled for table WEST. Save and close this file. ewconf to start extracting now and to write to a trail file in the dirdat directory with a trail file size of 5 MB and a name of wf by executing the following GGSCI commands: GGSCI (AMER) > Add Extract ewconf. GGSCI > Add ExtTrail . Save and close this file. Megabytes 5 EXTTRAIL added. TranLog.prm file. Extract ewconf. execute the following command at the GGSCI prompt: Copyright © 2012.7. Add the following runtime parameters to the text file: Extract ewconf ExtTrail ./dirdat/wf. From a GGSCI prompt in the GG_AMER_HOME terminal window.Page 18 Oracle Internal & Oracle Academy Use Only Manager is running (IP port easthost. UseCheckpoints 8. Add the Extract Group. Oracle and/or its affiliates. Start the Manager process: GGSCI (EURO) > Start mgr Manager started. Write down the purpose of the GetUpdateBefores parameter: Answer:_________________________________________________________________ Save and close the file. Practices for Lesson 14: Bidirectional Replication Chapter 14 .15001). ewconf: GGSCI (AMER) > Edit Param ewconf Your text editor of choice starts and opens the ewconf. execute the following command to edit the parameter file for the “Extract West Conflict” group.PRODUCTS GetBeforeCols(On Update All). 10. Password oracle_4U GetUpdateBefores TranLogOptions ExcludeUser gguser Table WEST. Check the reference document. create the Manager parameter file: GGSCI (EURO) > Edit Param mgr Verify that at least the following parameters are present: Port 15001 PurgeOldExtracts . In the GG_EURO_HOME terminal window. ./dirdat/*. GGSCI (EURO) > Info manager GGSCI (EURO) > Setting Up Change Data Capture on AMER 9. GGSCI (AMER) > 11. All rights reserved. To set up the Extract Data Pump on the AMER database. Begin Now EXTRACT added./dirdat/wf UserID gguser. prm file. If the checkpoint table exists. You will configure the Extract Data Pump to read from the./dirdat/wf EXTRACT added. Megabytes 5 RMTTRAIL added. To test/create the checkpoint table on the EURO database server (GG_EURO_HOME terminal window). execute the following command at the GGSCI prompt: GGSCI (EURO) > Edit Param reconf Your text editor of choice starts and opens the reconf. go on to the next step. You need a checkpoint table for this task. at the GGSCI prompt. Password oracle_4U GGSCI (EURO) > Info CheckpointTable GGSCI (EURO) > Add CheckpointTable 14. 12./dirdat/pf. After logging in to the database.prm file. To set up the Replicat Delivery component.Page 19 Oracle Internal & Oracle Academy Use Only GGSCI (AMER) > Add Extract pwconf. GGSCI (AMER) > Setting Up the EURO Database for Delivery 13. Practices for Lesson 14: Bidirectional Replication Chapter 14 . transmit the data to the AMER server. It may already exist from a previous lab. . If the checkpoint table does not exist. Compress RmtTrail . run the Add command. Add the following runtime parameters to the text file: Extract pwconf RmtHost easthost./dirdat/pf Remote Trail: GGSCI > Add RmtTrail .GGSCI (AMER) > Edit Param pwconf Your text editor of choice starts and opens the pwconf. MgrPort 15001./dirdat/wf Local Extract Trail.*. execute the following commands: GGSCI (EURO) > DBLogin UserID gguser. Extract pwconf. ExtTrailSource . Oracle and/or its affiliates. Add the Data Pump Extract Group by executing the following GGSCI commands. All rights reserved. try the Info command. and write it to the ./dirdat/pf Passthru Table WEST. Add the following runtime parameters to the text file: Copyright © 2012. PRODUCTS table. from a GGSCI prompt. UseMax (modified_ts). Add the following runtime parameters to the text file: Copyright © 2012.PRODUCTS table for transactions performed on the EAST. Practices for Lesson 14: Bidirectional Replication Chapter 14 . .dsc. execute the following command to configure the primary Extract: GGSCI (EURO) > Edit Param eeconf Your text editor of choice starts and opens the eeconf. and the result is applied to the target table. Cols (vendor. For all update operations. If the Before (source) and current (target) values for qty_in_stock are not equal (that is.This Map statement performs the conflict detection and resolution on the WEST. ResolveConflict (UpdateRowExists. a conflict is detected)./dirdat/pf REPLICAT added. GGSCI (EURO) > Configuring Data Capture on EURO 16. Save and close the file. Target EAST. UseDelta. the source table value for qty_in_stock is subtracted from the source Before image qty_in_stock value. modified_ts)).products. (delta_resolution_method. CompareCols(On Update All). Oracle and/or its affiliates. GetUpdates IgnoreInserts IgnoreDeletes Map WEST. a query is executed against the target table and the data from the qty_in_stock column is returned. Cols (qty_in_stock)).Page 20 Oracle Internal & Oracle Academy Use Only Replicat reconf AssumeTargetDefs DiscardFile . Add the Replicat by executing the following GGSCI command: GGSCI (EURO) > Add Replicat reconf. Password oracle_4U AllowDupTargetMap IgnoreUpdates Map WEST.prm file.*. The result is then subtracted from the current target qty_in_stock value (returned from the query).*. ExtTrail . Overwrite)). All rights reserved. Target EAST./dirrpt/reconf. 15. Purge UserID gguser.products. (max_resolution_method. In the GG_EURO_HOME terminal window. (Default. GGSCI > Add RmtTrail . configure the Extract Data Pump to read from the ./dirdat/pg. Add the following runtime parameters to the text file: Extract peconf RmtHost westhost. All rights reserved. Add the Extract Group by executing the following GGSCI commands: GGSCI (EURO) > Add Extract peconf./dirdat/pg Remote Trail: GGSCI (EURO) > Edit Param peconf Your text editor of choice starts and opens the peconf./dirdat/eg EXTRACT added. Megabytes 5 EXTTRAIL added. Extract peconf. eeconf to start extracting now and to write to a trail file in the dirdat directory with a trail file size of 5 MB and a name of eg. In the GG_EURO_HOME terminal window. GGSCI (EURO) > Copyright © 2012. Password oracle_4U GetUpdateBefores TranLogOptions ExcludeUser gguser Table EAST. Add the Extract Group./dirdat/eg UserID gguser. Extract eeconf. Begin Now GGSCI > Add ExtTrail ./dirdat/eg. Megabytes 5 RMTTRAIL added.prm file. GGSCI (EURO) > Add Extract eeconf./dirdat/pg Passthru Table EAST. . GGSCI (EURO) > 18. 17. TranLog.Extract eeconf ExtTrail . Save and close the file. Compress RmtTrail ./dirdat/eg Local Extract Trail.PRODUCTS GetBeforeCols(On Update All). Add the Extract Group by executing the following GGSCI commands.*. transmit the data to the AMER server. and write it to the . Practices for Lesson 14: Bidirectional Replication Chapter 14 .Page 21 Oracle Internal & Oracle Academy Use Only EXTRACT added. MgrPort 15000. 19. ExtTrailSource . Oracle and/or its affiliates. Add the following runtime parameters to the text file: Replicat rwconf AssumeTargetDefs DiscardFile . Target WEST. CompareCols(On Update All). This is essentially the same conflict detection and resolution code as defined on the EURO delivery component.prm file. Password oracle_4U AllowDupTargetMap IgnoreUpdates Map EAST.. To create the checkpoint table on the AMER database server. Cols (qty_in_stock)). (Default./dirrpt/rwconf. ResolveConflict (UpdateRowExists. Purge UserID gguser. In the GG_AMER_HOME terminal window.products. Successfully created checkpoint table GGS_CHECKPOINT. UseDelta. using GLOBALS specification (GGS_CHECKPOINT). configure the Replicat Delivery component from a GGSCI prompt: GGSCI (AMER) > Edit Param rwconf Your text editor of choice starts and opens the rwconf. GetUpdates IgnoreInserts IgnoreDeletes Map EAST. UseMax (modified_ts).products. (max_resolution_method. except the Map EAST/WEST is reversed.Creating the Delivery Components on the AMER Database 20. Copyright © 2012.Page 22 Oracle Internal & Oracle Academy Use Only GGSCI (AMER) > . and execute the following commands: GGSCI (AMER) > DBLogin UserID gguser. Cols (vendor.dsc. Target WEST. modified_ts)).*. Overwrite)). Password oracle_4U Successfully logged into database. GGSCI (AMER) > Add CheckpointTable No checkpoint table specified. Save and close the file.. start GGSCI in the GG_AMER_HOME terminal window.*. 21. All rights reserved. Practices for Lesson 14: Bidirectional Replication Chapter 14 . Oracle and/or its affiliates. (delta_resolution_method. Oracle and/or its affiliates... REPLICAT RWCONF starting GGSCI (AMER) > Info ER * EXTRACT EWCONF Checkpoint Lag Log Read Checkpoint Last Started 2012-05-21 12:33 Status RUNNING 00:29:42 (updated 00:00:10 ago) Oracle Redo Logs 2012-05-21 12:03:33 Seqno 75. Add the Replicat by executing the following GGSCI commands in the GG_AMER_HOME terminal window: GGSCI (AMER) > DBLogin UserID gguser.0 (0) EXTRACT PWCONF Checkpoint Lag Log Read Checkpoint Last Started 2012-05-21 12:33 Status RUNNING 00:00:00 (updated 00:00:06 ago) File . RBA 2238464 SCN 0.Page 23 Oracle Internal & Oracle Academy Use Only Starting the GoldenGate Processes and Generating Data . Make sure that they are all in the RUNNING state. EXTRACT EWCONF starting Sending START request to MANAGER . ExtTrail . GGSCI (AMER) > Add Replicat rwconf. GGSCI (AMER) > 23. Password oracle_4U Successfully logged into database.../dirdat/pg REPLICAT added. execute the following commands to start all of the configured Extracts and Replicats.22. EXTRACT PWCONF starting Sending START request to MANAGER .. Practices for Lesson 14: Bidirectional Replication Chapter 14 . In AMER (west): GGSCI (AMER) > Start ER * Sending START request to MANAGER . All rights reserved. In both the GG_AMER_HOME and GG_EURO_HOME terminal windows./dirdat/wf000000 First Record RBA 0 REPLICAT RWCONF Checkpoint Lag Log Read Checkpoint Last Started 2012-05-21 12:33 Status RUNNING 00:00:00 (updated 00:00:00 ago) File ./dirdat/pg000000 First Record RBA 0 GGSCI (AMER) > In EURO (east): Copyright © 2012.. Start SQL*Plus for both terminal sessions.0 (0) EXTRACT PECONF Checkpoint Lag Log Read Checkpoint Last Started 2012-05-21 12:35 Status RUNNING 00:00:00 (updated 00:00:02 ago) File . Set the screen size to be friendlier: a.. 24. EXTRACT PECONF starting Sending START request to MANAGER . RBA 21487104 SCN 0. Practices for Lesson 14: Bidirectional Replication Chapter 14 . and then restart the group.. enter: [OS_prompt] cd ~/labs/Section14/Practice14-2/sqlscripts [OS_prompt] sqlplus east/oracle_4U SQL> set lines 200 SQL> set pages 40 Copyright © 2012. EXTRACT EECONF starting Sending START request to MANAGER .. Oracle and/or its affiliates. REPLICAT RECONF starting EXTRACT EECONF Checkpoint Lag Log Read Checkpoint Last Started 2012-05-21 12:35 Status RUNNING 00:11:22 (updated 00:00:07 ago) Oracle Redo Logs 2012-05-21 12:24:01 Seqno 74../dirdat/eg000000 First Record RBA 0 REPLICAT RECONF Checkpoint Lag Log Read Checkpoint Last Started 2012-05-21 12:35 Status RUNNING 00:00:00 (updated 00:00:07 ago) File . view the report file.. Exit GGSCI in both terminal windows./dirdat/pf000000 First Record RBA 0 GGSCI (EURO) > If any Oracle GoldenGate group shows a status of STOPPED or ABEND.Page 24 Oracle Internal & Oracle Academy Use Only GGSCI (EURO) > Info ER * . correct any errors. both AMER and EURO. For AMER.. All rights reserved. For EURO.GGSCI (EURO) > Start ER * Sending START request to MANAGER . enter: [OS_prompt] cd ~/labs/Section14/Practice14-2/sqlscripts [OS_prompt] sqlplus west/oracle_4U SQL> set lines 200 SQL> set pages 40 b. a.00.prm to see the syntax to accomplish these rules. Examine the conflict resolution.products SET product_name='whizbang'.00.products.---------.-----------. The basic testing methodology is as follows: a. e. . This is the conflict. Enter @database_reset at the SQL prompt for both. Restart both pumps to simulate end-of-lag. Stop both pumps to simulate a network lag.00. Oracle and/or its affiliates.---------------------------100 foobar Vendor ABC 20 21-MAY-12 12.000000 AM Notice that Oracle Database does not automatically update a timestamp unless you explicitly tell it to. PRODUCT_NUMBER PRODUCT_NA VENDOR QTY_IN_STOCK MODIFIED_TS -------------. d.---------------------------100 widget Vendor ABC 20 21-MAY-12 12. the business rules you have chosen are: − For name you don’t care if there is a conflict (but you can tell if there is one) − For vendor you want the latest − For timestamp you want the biggest − For qty_in_stock you want to add both differences together Re-examine reconf.000000 AM SQL> UPDATE east. c. PRODUCT_NUMBER PRODUCT_NA VENDOR QTY_IN_STOCK MODIFIED_TS -------------.---------. On AMER.Page 25 Oracle Internal & Oracle Academy Use Only b. enter: SQL> SELECT * FROM west.---------. enter: SQL> UPDATE west.products SET product_name='foobar'.---------. Reset the database for the next test. b.25. All rights reserved.000000 AM 26. d. Update and commit different local changes.---------.00.-----------. 27.---------.00. On EURO. Practices for Lesson 14: Bidirectional Replication Chapter 14 .---------------------------100 whizbang Vendor ABC 20 21-MAY-12 12. Make sure non-conflicted updates go through. even down to the timestamp: SQL> SELECT * FROM products. SQL> COMMIT. While the Befores are checking all columns.-----------. PRODUCT_NUMBER PRODUCT_NA VENDOR QTY_IN_STOCK MODIFIED_TS -------------. enter: SQL> SELECT * FROM east. Copyright © 2012.products. Make sure both tables in both instances have the same data. On AMER. Reset both databases. c.00. SQL> COMMIT. On AMER enter SQL> UPDATE products SET product_name='wingnut'. then both additions are applied. enter @database_reset at the SQL prompt for both. On AMER enter: GGSCI > Start pwconf On EURO enter: GGSCI > Start peconf d. − Since timestamp is also the latest. Enter SELECT * FROM products. All rights reserved. both sides show AMER’s value of DEF. both sides show EURO’s value. so both sides show 20+10+4=34.Page 26 Oracle Internal & Oracle Academy Use Only c. a. on both sides so you see what it did. The last test is where there is a conflict but you don’t care. − Since qty_in_stock started at 20. so both sides show 20+10+4=34. 30. enter @database_reset at the SQL prompt for both. c. The first test is to change AMER/west first and EURO/east second. . e. Oracle and/or its affiliates. then both additions are applied. both sides show AMER’s value. Applying the rules from the Replicats: − Since vendor takes the latest based on timestamp. 29. Enter SELECT * FROM products. − Since qty_in_stock started at 20. on both sides so you see what it did. On WEST enter: SQL> @trans_generator_west On EAST enter: SQL> @trans_generator_east On both of them it will SELECT * FROM products. On AMER enter SQL> COMMIT. a. On EURO enter: GGSCI > Start peconf On AMER enter: GGSCI > Start pwconf d. c. On EURO enter: GGSCI > Stop peconf On AMER enter: GGSCI > Stop pwconf b. On EURO enter SQL> UPDATE products SET product_name='dingbat'. This is unchanged by the test order. On AMER enter: GGSCI > Stop pwconf On EURO enter: GGSCI > Stop peconf b. On AMER enter: GGSCI > Start pwconf On EURO enter: GGSCI > Start peconf Copyright © 2012. Practices for Lesson 14: Bidirectional Replication Chapter 14 . To reset both databases. Applying the rules from the Replicats: − Since vendor takes the latest based on timestamp. both sides show EURO’s value of XYZ. To reset both databases. e. On EURO enter SQL> COMMIT. On EURO enter: GGSCI > Stop peconf On AMER enter: GGSCI > Stop pwconf b. Do the steps in this order! a. qty_in_stock=15. − Since timestamp is also the latest. The second test is the same as the first but in a different order. On EAST enter: SQL> @trans_generator_east On WEST enter: SQL> @trans_generator_west On both of them it will SELECT * FROM products. so you see what you did.28. so you see what you did. All rights reserved. AMER overwrites product_name on EURO with wingnut.00 Total CDR conflicts 4.many lines omitted for clarity... 31. *** Total statistics since 2012-05-21 13:06:17 *** Total inserts 0.. that does not affect qty_in_stock. enter @database_reset at the SQL prompt for both. e.00 CDR UPDATEROWEXISTS conflicts 4. Examine the conflict detections and resolutions.00 Total deletes 0. ReportCDR GGSCI (EURO) > Stats reconf.. so that replicates normally... but you don’t care. those items with “CDR” in the field: a. − Timestamp was not updated.many lines omitted for clarity. Practices for Lesson 14: Bidirectional Replication Chapter 14 . The “winner” depends on the order of the pumps. AMER sets local product_name to wingnut. The statistics record DML and conflicts.. Applying the rules from the Replicats: − There is a conflict on product_name. Replicating from WEST. Start of Statistics at 2012-05-21 19:47:15. Oracle and/or its affiliates. When the pumps start. in other words. Copyright © 2012. To reset both databases. EURO sets local product_name to dingbat.PRODUCTS: . and therefore not a conflict.00 . ..d. then the EURO pump starts and overwrites product_name on AMER with dingbat. they switch. on both sides so you see what it did. On EURO enter: GGSCI > Stats reconf.PRODUCTS to EAST. ReportCDR Sending STATS request to REPLICAT RECONF .00 Total operations 8.. so it defaults to Overwrite.00 CDR resolutions succeeded 4. not the order of the transactions.00 Total discards 0.00 Total updates 8.. Enter SELECT * FROM products.Page 27 Oracle Internal & Oracle Academy Use Only − Even though there is a conflict. At an OS prompt. Clean up the Oracle GoldenGate environment by executing the following GGSCI commands on both the source and target servers: a.b... ReportCDR GGSCI (AMER) > Stats rwconf.00 CDR resolutions succeeded 4. Replicating from EAST. Practices for Lesson 14: Bidirectional Replication Chapter 14 .00 CDR UPDATEROWEXISTS conflicts 4. All rights reserved. Stop here. 32.00 Total updates 8.00 Total deletes 0..sh.PRODUCTS: *** Total statistics since 2012-05-21 13:06:17 *** Total inserts 0.Page 28 Oracle Internal & Oracle Academy Use Only . Oracle and/or its affiliates.00 Total operations 8.00 .. This completes Practice 14-2.many lines omitted for clarity.. This completes Practice 14...00 Total discards 0.. run ~/labs/setup/kill-all-ogg. Start of Statistics at 2012-05-21 19:47:15. Exit out of both GGSCI prompts.PRODUCTS to WEST.many lines omitted for clarity. ReportCDR Sending STATS request to REPLICAT RWCONF . b. Copyright © 2012.00 Total CDR conflicts 4. . On AMER enter: GGSCI > Stats rwconf... Your numbers may be slightly different depending on your experimentation. Practices for Lesson 15: DDL Replication Chapter 15 . Oracle and/or its affiliates. All rights reserved.Chapter 15 Copyright © 2012.Page 1 Oracle Internal & Oracle Academy Use Only Practices for Lesson 15: DDL Replication . you will support the synchronization of DDL operations in homogeneous.Practices for Lesson 15: Overview Practices Overview Oracle Internal & Oracle Academy Use Only In this practice. unidirectional environments. All rights reserved. Copyright © 2012. Oracle and/or its affiliates.Page 2 . Practices for Lesson 15: DDL Replication Chapter 15 . Using your text editor of choice. Before attempting to set up DDL capture. a database trigger and associated packages. SQL> Copyright © 2012. Start SQL*Plus as sysdba: [OS_prompt] sqlplus / as sysdba Execute the following commands: SQL> GRANT EXECUTE ON UTL_FILE TO gguser.Page 3 Oracle Internal & Oracle Academy Use Only Tasks . Navigate to the $GG_AMER_HOME directory: [OS_prompt] cd $GG_AMER_HOME 2. and add the following parameter: GGSCHEMA GGUSER. all open sessions in the database must be closed (which requires a database outage). Choose which schema DDL objects will be created in (for this practice. To set up the database for DDL capture. the GGUSER schema will be used). the creation of five tables in a tablespace with sufficient space to allow growth of the marker and history tables. several modifications must be made to the source database. 4. located in the Oracle GoldenGate base directory. Save and close the file. Oracle and/or its affiliates. Practices for Lesson 15: DDL Replication Chapter 15 . Grant succeeded. CheckpointTable GGS_CHECKPOINT GGSCHEMA GGUSER 3. All rights reserved. and a user role. specifically. edit the GLOBALS file. execute the following on the source (GG_AMER_HOME terminal window) database: 1.Practice 15-1: DDL Replication Database Setup Assumptions To enable DDL capture. 5.. Practices for Lesson 15: DDL Replication Chapter 15 . Run the marker_setup.Page 4 Oracle Internal & Oracle Academy Use Only Enter Oracle GoldenGate schema name:GGUSER . Marker setup table script complete. enter GGUSER: SQL> @marker_setup. running verification script.sql script. NOTE: The schema must be created prior to running this script. Please enter the name of a schema for the GoldenGate database objects: Setting schema name to GGUSER MARKER TABLE ------------------------------OK MARKER SEQUENCE ------------------------------OK Script complete. NOTE: Stop all DDL replication before starting this installation. All rights reserved. Oracle and/or its affiliates.sql Marker setup script You will be prompted for the name of a schema for the Oracle GoldenGate database objects. SQL> Copyright © 2012.. When prompted for a schema. NOTE: For an Oracle 10g source. DDL replication setup script complete..sql Oracle GoldenGate DDL Replication setup script Verifying that current user has privileges to install DDL Replication. All rights reserved.. please wait .txt Checking for sessions that are holding locks on Oracle Golden Gate metadata tables . NOTE: The schema must be created prior to running this script. Please enter the name of a schema for the GoldenGate database objects: Setting schema name to GGUSER CLEAR_TRACE STATUS: Line/pos Error ---------------------------------------.Page 5 Oracle Internal & Oracle Academy Use Only Enter Oracle GoldenGate schema name:GGUSER .sql script. running verification script. Many lines omitted for clarity . SQL> Copyright © 2012. Practices for Lesson 15: DDL Replication Chapter 15 . When prompted for a schema.... Analyzing installation status. SQL> @ddl_setup. enter GGUSER. Working. Oracle and/or its affiliates.. NOTE: Stop all DDL replication before starting this installation. Working. STATUS OF DDL REPLICATION ----------------------------------------------------------------------------SUCCESSFUL installation of DDL Replication software components Script complete..6. please wait ... Spooling to file ddl_setup_spool.. You will be prompted for the name of a schema for the Oracle GoldenGate database objects.. it can be enabled... Using GGUSER as a Oracle GoldenGate schema name.. Check complete. Run the ddl_setup. For Oracle 11g and later.-----------------------------------No errors No errors . the system recycle bin must be disabled... SQL> 9.Page 6 Oracle Internal & Oracle Academy Use Only You will be prompted for the name of a schema for GoldenGate database objects. (This script improves the performance of the DDL trigger and requires the Oracle dbms_shared_pool system package. All rights reserved.sql script to change the gg_role parameter to the preferred name.sql GGS Role setup script This script will drop and recreate the role GGS_GGSUSER_ROLE To use a different role name. Make the ddl_pin script part of the database startup.) SQL> @ddl_pin GGUSER PL/SQL procedure successfully completed.sql script.sql Trigger altered. Practices for Lesson 15: DDL Replication Chapter 15 . The database is now set up and enabled for DDL capture. Copyright © 2012. When prompted for a schema. SQL> 8.txt PL/SQL procedure successfully completed. Grant succeeded. grant GGSUSER_ROLE to the Oracle GoldenGate database user: SQL> GRANT ggs_ggsuser_role TO gguser. PL/SQL procedure successfully completed.sql output. SQL> Exit SQL*Plus. by using the following SQL command: GRANT GGS_GGSUSER_ROLE TO <loggedUser> where <loggedUser> is the user assigned to the GoldenGate processes. It must be invoked with the Oracle GoldenGate DDL username. NOTE: Stop all DDL replication before starting this installation. Oracle and/or its affiliates. SQL> 10. Enable DDL triggers: SQL> @ddl_enable. Enter GoldenGate schema name:GGUSER Wrote file role_setup_set. quit this script and then edit the params. NOTE: The schema must be created prior to running this script. As specified in the role_setup. This completes Practice 15-1. Continue with Practice 15-2. . enter GGUSER: SQL> @role_setup. Role setup script complete Grant this role to each user assigned to the Extract. GGSCI. Run role_setup.7. and Manager processes. PL/SQL procedure successfully completed. Practices for Lesson 15: DDL Replication Chapter 15 . In the GG_AMER_HOME terminal window. navigate to /home/oracle/labs/Section15/sqlscripts. MaxKeepDays 5 .Page 7 Oracle Internal & Oracle Academy Use Only For continuing operations. history. minkeepdays 1 PurgeMarkerHistory MinKeepDays 3. the DDL marker. navigate to the same /home/oracle/labs/Section15/sqlscripts. The purpose of this exercise is to add the last two lines that are for PurgeMarkerHistory and PurgeDDLHistory.Practice 15-2: DDL Replication Oracle GoldenGate Setup Tasks Housekeeping Considerations Port 15000 PurgeOldExtracts .prm file: PurgeMarkerHistory MinKeepDays 3. Stop and restart the Oracle GoldenGate Manager GGSCI (AMER) > Stop mgr ! GGSCI (AMER) > Start mgr Note: To prevent the DDL trace file from consuming excessive disk space. Do not be concerned if the existing lines in your file slightly differ from the book. This script deletes the file.sql Copyright © 2012. add the following two lines to the end of the mgr. 1. MaxKeepDays 5 2. make sure that you start with a clean schema area for your lab. run the ddl_cleartrace script on a regular basis. and execute the following command: [OS_prompt] sqlplus east/oracle_4U @drop_tables. Setting Up the Workshop Database and Configuration Before continuing further. MaxKeepDays 5 PurgeDDLHistory MinKeepDays 3. [OS_prompt sqlscripts] 4. Oracle and/or its affiliates. at the GGSCI prompt. MaxKeepDays 5 PurgeDDLHistory MinKeepDays 3. In the GG_EURO_HOME terminal window. usecheckpoints. and then execute the following command: [OS_prompt] cd ~/labs/Section15/sqlscripts [OS_prompt] sqlplus west/oracle_4U @drop_tables.sql PL/SQL procedure successfully completed. All rights reserved./dirdat/*. but Oracle GoldenGate will create it again. Close and save the file. 3. This script must be run manually or via cron. In the GG_AMER_HOME terminal window. and trace tables must be monitored and routinely cleared of old or nonessential data. /dirdat/pd Remote Trail: GGSCI (AMER) > Edit Param pddl Your text editor of choice starts and opens the pddl. On the source server (GG_AMER_HOME terminal window). Begin Now EXTRACT added.prm file. configure the Extract Data Pump (pddl.* DDLOptions AddTranData. All rights reserved./dirdat/ed Local Extract Trail.prm) with the following parameters: GGSCI (AMER) > Edit Param eddl Extract eddl ExtTrail . GGSCI (AMER) > Add ExtTrail . Save and close the file. GGSCI (AMER) > Add Extract eddl. Compress RmtTrail . Practices for Lesson 15: DDL Replication Chapter 15 .prm) to read from the .*" <-.This won’t work! DDL Include Mapped ObjName WEST. and write it to the .Page 8 Oracle Internal & Oracle Academy Use Only Your text editor of choice opens the eddl.prm file. To set up Oracle GoldenGate Change Data Capture on the source server (GG_AMER_HOME terminal window). Note: The last step of the Practice verifies that the TranData comes back automatically. GGSCI (AMER) > 6.5.*.* ERROR: No viable tables matched specification. Extract eddl EXTTRAIL added./dirdat/pd Passthru Table WEST./dirdat/ed. configure the change data capture extract (eddl. 7. MgrPort 15001. TranLog. Dropping the tables in the previous steps should have also cleared the TranData (transaction data). transmit the data to the target server. Save and close the file. Add the Extract Group and two Local Extract Trails by executing the following GGSCI commands: GGSCI (AMER) > DBLogin UserID gguser.*. Add the following runtime parameters to the text file: Extract pddl RmtHost easthost. Enter the following parameters: . Password oracle_4U -. Password oracle_4U Successfully logged into database. Verify this in the AMER GGSCI: GGSCI (AMER) > Info TranData WEST. Report Table WEST. Copyright © 2012. GGSCI (AMER) > 8.DDL Include Mapped ObjName "WEST./dirdat/ed UserID gguser. Oracle and/or its affiliates. 9. Add the Extract Group by executing the following GGSCI commands: GGSCI (AMER) > Add Extract pddl, ExtTrailSource ./dirdat/ed GGSCI (AMER) > Add RmtTrail ./dirdat/pd, Extract pddl Note: This is a frequent enough sequence that it would pay to create an Obey file with these commands that could be invoked by entering: GGSCI> Obey /home/oracle/labs/setup/startup.oby 11. On the target server (GG_EURO_HOME terminal window), configure the Replicat Delivery components by executing the following command from the GGSCI prompt: GGSCI (EURO) > Edit Param rddl Your text editor of choice starts and opens the rddl.prm file. Add the following runtime parameters to the text file: Replicat rddl DiscardFile ./dirrpt/rddl.dsc, Purge AssumeTargetDefs UserID gguser, Password oracle_4U DDL Include Mapped Map WEST.*, Target EAST.*; Save and close the file. 12. Add the Replicat by executing the following GGSCI command: GGSCI (EURO) > Add Replicat rddl, ExtTrail ./dirdat/pd 13. Verify that the mgr process is running on both AMER and EURO. GGSCI> Info mgr If the mgr process is not already running, start it, and then verify that it is running GGSCI> Start mgr GGSCI> Info mgr To start the Extract and Replicat processes, issue the following command on both the AMER and EURO instances. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Practices for Lesson 15: DDL Replication Chapter 15 - Page 9 Oracle Internal & Oracle Academy Use Only 10. On the target server (GG_EURO_HOME terminal window), 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. On the target server (GG_EURO_HOME terminal window), start GGSCI and execute the following commands: GGSCI (EURO) 1> DBLogin Userid gguser, Password oracle_4U GGSCI (EURO) 2> Info CheckpointTable GGSCI (EURO) 3> Add CheckpointTable On AMER: GGSCI (AMER) > Start ER * Sending START request to MANAGER ... EXTRACT EDDL starting Sending START request to MANAGER ... EXTRACT PDDL starting EXTRACT EDDL Checkpoint Lag Log Read Checkpoint Last Started 2012-05-22 09:34 Status RUNNING 00:08:15 (updated 00:00:04 ago) Oracle Redo Logs 2012-05-22 09:25:56 Seqno 78, RBA 24363024 SCN 0.0 (0) EXTRACT PDDL Checkpoint Lag Log Read Checkpoint Last Started 2012-05-22 09:34 Status RUNNING 00:00:00 (updated 00:00:00 ago) File ./dirdat/ed000000 First Record RBA 0 GGSCI (AMER) > On EURO: GGSCI (EURO) > Start ER * Sending START request to MANAGER ... REPLICAT RDDL starting GGSCI (EURO) > Info ER * REPLICAT RDDL Checkpoint Lag Log Read Checkpoint Last Started 2012-05-22 09:35 Status RUNNING 00:00:00 (updated 00:00:06 ago) File ./dirdat/pd000000 First Record RBA 0 GGSCI (EURO) > Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Practices for Lesson 15: DDL Replication Chapter 15 - Page 10 Oracle Internal & Oracle Academy Use Only GGSCI (AMER) > Info ER * Generate Source Database Activity 14. From an OS shell, navigate to /home/oracle/labs/Section15/sqlscripts. Execute the following command in the GG_AMER_HOME terminal window: [OS_prompt gg_amer] cd ~/labs/Section15/sqlscripts/ [OS_prompt sqlscripts] ls drop_tables.sql seed_database.sql source_database.sql [OS_prompt] sqlplus west/oracle_4U trans_generator.sql @source_database.sql Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, Oracle Label Security, OLAP, Data Mining, Oracle Database Vault and Real Application Testing options Table Table Table Table Table Table created. created. created. created. created. created. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options [OS_prompt sqlscripts] 15. Execute the following command in the GG_AMER_HOME terminal window: [OS_prompt] sqlplus west/oracle_4U @seed_database.sql SQL*Plus: Release 11.2.0.3.0 Production on Wed Apr 25 11:10:03 2012 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, Oracle Label Security, OLAP, Data Mining, Oracle Database Vault and Real Application Testing options PL/SQL procedure successfully completed. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options [OS_prompt sqlscripts] Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Practices for Lesson 15: DDL Replication Chapter 15 - Page 11 Oracle Internal & Oracle Academy Use Only SQL*Plus: Release 11.2.0.3.0 Production on Wed Apr 25 11:10:03 2012 Copyright (c) 1982, 2011, Oracle. All rights reserved. Validating the Results 17. Oracle and/or its affiliates.1.0 .0. TABLE_NAME -----------------------------ACCOUNT ACCOUNT_TRANS BRANCH TELLER TELLER_TRANS BRANCH_ATM 6 rows selected. OLAP.16.sql SQL*Plus: Release 11.0.0 Production on Wed Apr 25 11:10:03 2012 Copyright (c) 1982.2. 2011. In the GG_EURO_HOME terminal window.Page 12 Oracle Internal & Oracle Academy Use Only PL/SQL procedure successfully completed. All rights reserved.3. All rights reserved. Data Mining. Practices for Lesson 15: DDL Replication Chapter 15 . Execute the following command in the GG_AMER_HOME terminal window: [OS_prompt] sqlplus west/oracle_4U @trans_generator. Oracle.3.2. Data Mining and Real Application Testing options [OS_prompt sqlscripts] Wait a few seconds for the transaction generator to complete. log in to SQL*Plus and execute the following command: [OS_prompt gg_euro] sqlplus east/oracle_4U SQL> SELECT table_name FROM user_tables.0 64bit Production With the Partitioning. Oracle Label Security.2. SQL> Six tables should exist in the EAST schema. OLAP. . Copyright © 2012.64bit Production With the Partitioning. Oracle Database Vault and Real Application Testing options Disconnected from Oracle Database 11g Enterprise Edition Release 11. Connected to: Oracle Database 11g Enterprise Edition Release 11.0. Extracting from WEST. From the GG_AMER_HOME terminal window.00 Total updates 1500. All rights reserved. Practices for Lesson 15: DDL Replication Chapter 15 . Oracle and/or its affiliates.ACCOUNT: *** Total statistics since 2012-05-24 07:22:59 *** Total inserts 1060.Page 13 Oracle Internal & Oracle Academy Use Only DDL replication statistics (for all trails): ...00 Total discards 0..ACCOUNT to WEST. Total Sending STATS request to EXTRACT EDDL ..18.00 Total operations 2560. Many lines omitted for clarity .00 ... End of Statistics.00 6. GGSCI (AMER) > The Stats output should show mapped DDL operations followed by transaction counts for all tables where data was captured./dirdat/ed: Extracting from GGUSER. execute the following command: GGSCI (AMER) > Stats eddl.00 Total deletes 0.00 0.00 Output to .00 0. Start of Statistics at 2012-05-24 07:29:28.00 0.GGS_MARKER to GGUSER.GGS_MARKER: *** Total statistics since 2012-05-24 07:22:59 *** No database operations have been performed. *** Total statistics since extract started Operations Mapped operations Unmapped operations Other operations Excluded operations *** 6. Copyright © 2012. Total Sending STATS request to REPLICAT RDDL .ACCOUNT_TRANS. GGSCI (EURO) > All counts should match. 20. *** Total statistics since replicat started Operations Mapped operations Unmapped operations Other operations Excluded operations Errors Retried errors Discarded errors Ignored errors *** 6.00 Total updates 1500. Logging of supplemental redo log data is enabled for table WEST. Verify that the transaction data was added to the AMER source because of parameter DDLOptions AddTranData. All rights reserved..00 0.00 Total discards 0.ACCOUNT: ACCOUNT_NUMBER.BRANCH. Execute the same command for the Replicat in the GG_EURO_HOME terminal window: GGSCI (EURO) > Stats rddl.Page 14 Oracle Internal & Oracle Academy Use Only DDL replication statistics: .19.ACCOUNT: *** Total statistics since 2012-05-24 07:23:43 *** Total inserts 1060.. Copyright © 2012. Many lines omitted for clarity .00 Total deletes 0. ACCOUNT_TRANS_TS. Notice there is more DDL info on the Replicat than the Extract.ACCOUNT. TRANS_NUMBER...* Logging of supplemental redo log data is enabled for table WEST. End of Statistics. GGSCI (AMER) > Info TranData WEST.00 0.. You know it had to be added because the Replicat worked. Columns supplementally logged for table WEST.BRANCH: BRANCH_NUMBER.ACCOUNT to EAST. Oracle and/or its affiliates. Logging of supplemental redo log data is enabled for table WEST.00 0.00 .00 6.00 0.00 0. Columns supplementally logged for table WEST.00 Replicating from WEST.ACCOUNT_TRANS: ACCOUNT_NUMBER. Start of Statistics at 2012-05-24 07:33:18. Report. Practices for Lesson 15: DDL Replication Chapter 15 .00 0. Columns supplementally logged for table WEST.00 0.. but check for it anyway.00 Total operations 2560. TELLER_TRANS_TS. Logging of supplemental redo log data is enabled for table WEST. Stop here. Practices for Lesson 15: DDL Replication Chapter 15 . Copyright © 2012. GGSCI (AMER) > Oracle Internal & Oracle Academy Use Only This completes Practice 15-2.TELLER. Logging of supplemental redo log data is enabled for table WEST. TRANS_NUMBER.TELLER_TRANS: TELLER_NUMBER.BRANCH_ATM. TRANS_NUMBER. ATM_TRANS_TS. All rights reserved. This completes Practice 15.BRANCH_ATM: BRANCH_NUMBER. Oracle and/or its affiliates. ATM_NUMBER.Page 15 . Columns supplementally logged for table WEST.Logging of supplemental redo log data is enabled for table WEST. Columns supplementally logged for table WEST. Columns supplementally logged for table WEST.TELLER: TELLER_NUMBER.TELLER_TRANS. Oracle and/or its affiliates.Oracle Internal & Oracle Academy Use Only Copyright © 2012. Practices for Lesson 15: DDL Replication Chapter 15 . All rights reserved.Page 16 .
Copyright © 2024 DOKUMEN.SITE Inc.