Use This Student Guideฺ: Oracle Goldengate 12C: Fundamentals For Oracle

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 182

Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
n
Oracle GoldenGate
a s 12c:
t r
on-
Fundamentals for Oracle
s a n eฺ
) haActivity
u idGuide
ฺ c om ent G
s s on tud
e ric this S
n a g@ use
itฺ
( s uj
a g
N
S ujit

D84357GC10
Edition 1.0
January 2014
D85202
Author Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Steve Friedberg Disclaimer

This document contains proprietary information and is protected by copyright and


Technical Contributors 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
and Reviewers in any way. Except where your use constitutes "fair use" under copyright law, you
Mack Bell may not use, share, download, upload, copy, print, display, perform, reproduce,
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

publish, license, post, transmit, or distribute this document in whole or in part without
Joseph deBuzna the express authorization of Oracle.
Pete Daly
The information contained in this document is subject to change without notice. If you
Joe Greenwald 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
Steven George warranted to be error-free.
Susan Jang
Restricted Rights Notice
Naoki Kato
Juan Quezada Nunez 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
e to
Randy Richeson applicable:
ce ns
Doug Reid l i
Ranbir Singh
U.S. GOVERNMENT RIGHTS

a b le
The U.S. Government’s rights to use, modify, reproduce, release, perform, display, or

fe r
disclose these training materials are restricted by the terms of the applicable Oracle
Jinyu Wang
n s
license agreement and/or the applicable U.S. Government contract.
a
Volker Zell
Trademark Notice
n- t r
a no
Editors
h a s ideฺ
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names
may be trademarks of their respective owners.
Aju Kumar
m ) G u
Richard Wallis o
ฺc den t
o n
r i c ss s Stu
hi
Graphic Designer
@ e t
Seema Bopaiah
ag us e
t ฺ n
( s uji
Publishers
g
jit NaPavithran Adka
Su
Jayanthy Keshavamurthy
Srividya Rameshkumar
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
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

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


Practices for Lesson 3....................................................................................................................................3-2
Practices for Lesson 4: Installing Oracle GoldenGate ..................................................................................4-1
Practices for Lesson 4: Overview ...................................................................................................................4-2
Practice 4-1: Preparation and Installation ......................................................................................................4-3
Practice 4-2: Introduction to the GGSCI Command Interface ........................................................................4-8
Practices for Lesson 5: Configuration Overview and Preparing the Environment ....................................5-1
e to
ns
Practices for Lesson 5: Overview ...................................................................................................................5-2
Practice 5-1: Preparing Your Environment .....................................................................................................5-3
l i ce
Practice 5-2: Creating the GLOBALS Parameter File ....................................................................................5-9
a b le
Practice 5-3: Configuring and Starting Oracle GoldenGate Manager.............................................................5-10
fe r
n s
Practice 5-4: Using the TranData option ........................................................................................................5-13
a
-t r
Practices for Lesson 6: Configuring Change Capture ..................................................................................6-1
n
o
a n eฺ
Practices for Lesson 6: Overview ...................................................................................................................6-2

Practice 6-2: Setting Up an Extract Data Pump and Startingh


s
Practice 6-1: Setting Up the Extract and ExtTrail ..............................................................6-3
a uid .............................................6-6
) the Two Extracts
Practices for Lesson 7: Configuring Change Delivery
ฺ c e n tG
om.................................................................................7-1
s on tud
Practices for Lesson 7: Overview ...................................................................................................................7-2
s
e ic Table
rDelivery
Practice 7-1: Setting Up the Checkpoint
t h isonS the Target System ...........................................................7-3

g@
Practice 7-2: Setting Up Replicat .....................................................................................................7-5
a Data and s
u e GoldenGate Processes..............................................................7-7
n
Practice 7-3: Generating Starting
itฺ Processes and Checking Statistics ............................................................................7-12
Practice 7-4:jStopping
s u
( for Lesson 8: Extract Trail and Files..............................................................................................8-1
g
Practices
a
j i t NPractices for Lesson 8: Overview...................................................................................................................8-2
S u 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
Practice 9-4: Converting from Classic Mode to Integrated Mode ...................................................................9-18
Practices for Lesson 10: Oracle GoldenGate Parameters ............................................................................10-1
Practices for Lesson 10: Overview .................................................................................................................10-2
Practice 10-1: Modifying Source Manager Parameters ..................................................................................10-3
Practice 10-2: Modifying the Target Manager Parameters .............................................................................10-5
Practice 10-3: Modifying the Extract Parameters on the Source Database....................................................10-7
Practices for Lesson 11: Data Selection and Filtering..................................................................................11-1
Practices for Lesson 11: Overview .................................................................................................................11-2
Practice 11-1: Increasing Performance by Splitting Replication Loads ..........................................................11-3
Practice 11-2: Increasing Performance by Coordinated Applies ....................................................................11-11

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Oracle GoldenGate 12c: Fundamentals for Oracle Table of Contents


Practices for Lesson 12: Additional Transformation Topics........................................................................12-1
Practices for Lesson 12: Overview .................................................................................................................12-2
Practice 12-1: Modifying an Existing Set of Macros and Using User Tokens .................................................12-3
Practices for Lesson 13: Configuration Options ...........................................................................................13-1
Practices for Lesson 13: Overview .................................................................................................................13-2
Practice 13-1: Setting Up the Database and Source Definitions File .............................................................13-3
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Practice 13-2: Oracle GoldenGate Encryption Using ENCKEYS ...................................................................13-5


Practice 13-3: Generating Transactions and Validating Results ....................................................................13-12
Practice 13-4: Encryption Using Wallets ........................................................................................................13-18
Practices for Lesson 14: Bidirectional Replication .......................................................................................14-1
Practices for Lesson 14: Overview .................................................................................................................14-2
Practice 14-1: Two-Way Active-Active Data Replication ................................................................................14-3
Practice 14-2: Conflict Detection and Resolution ...........................................................................................14-15
Practices for Lesson 15: DDL Replication .....................................................................................................15-1
e to
Practices for Lesson 15: Overview .................................................................................................................15-2
ce ns
Practice 15-1: DDL Replication Database Setup............................................................................................15-3l i
a b
Practice 15-2: DDL Replication Oracle GoldenGate Setup ............................................................................15-7 le
fe r
a n s
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
N a
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Oracle GoldenGate 12c: Fundamentals for Oracle Table of Contents


n s
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracl le lice
r a b
fe
Oracle Middleware Learning
no
Stream n- t r a ns

s a eฺ
A New Innovative Continuous m ) h Learning
a
G u id Solution
o ent
ฺclearned
Ideal for supplementing whatoyou n u d in the classroom
s s t
e ric this S
n a g@ use
s u jitฺ
a g(
N
S ujit

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. 1


n s
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracl le lice
r a b
fe
Oracle Middleware Learning
n o
Stream n- t r a ns

Keep Your Skills Current )through


h a s a eฺ Continuous Learning
uid
ฺ c om ent G
Expert Delivered icsson Stud
Hundreds of instructional e r videos
t h isdelivered by Oracle
subject matter a g@ use
experts
n
s u jitฺ
Training
a g ( Across Fusion Middleware
it Nprofessionals of all experience levels interested in
ujFor
S
staying up-to-date

Continuously Refreshed Content


Covers product overviews through performance tips for
the broad range of Fusion Middleware products

Request Topics that Interest You

Sample Content Available for Viewing


NOW!
education.oracle.com/streams/middleware

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. 2


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a n s
Practices for n t r
-Lesson 1:
n o
a eฺ
Introduction
s
) a
h 1 uid
ฺ c om ent G
Chapter

s s on tud
e ric this S
n a g@ use
u jitฺ
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 1: Introduction


Chapter 1 - Page 1
Practices for Lesson 1

There are no practices for this lesson.


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 1: Introduction


Chapter 1 - Page 2
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a n s
Practices for n t r
-Lesson 2:
n o
Technology
s a eOverview

h a
) 2Gu i d
o m
c dent
Chapter
n ฺ
c s so Stu
e ri this
n a g@ use
u jitฺ
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 2: Technology Overview


Chapter 2 - Page 1
Practices for Lesson 2

There are no practices for this lesson.


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 2: Technology Overview


Chapter 2 - Page 2
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a n s
Practices for n t r
-Lesson 3:
n o
Oracle s aGoldenGate
eฺ
) h a u
Architecture i d
o m t G
o n ฺc Chapter
d e n3
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 3: Oracle GoldenGate Architecture


Chapter 3 - Page 1
Practices for Lesson 3

There are no practices for this lesson.


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 3: Oracle GoldenGate Architecture


Chapter 3 - Page 2
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a n s
Practices for n t r
-Lesson 4:
n o
Installing
s a Oracle
e ฺ GoldenGate
a
) h 4Gui d
m
co dent
Chapter
n ฺ
c s so Stu
e ri this
n a g@ use
u jitฺ
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Installing Oracle GoldenGate


Chapter 4 - Page 1
Practices for Lesson 4: Overview
Practices Overview
In these practices, you become familiar with the lab environment that you will use for the
duration of the class. You also install the Oracle GoldenGate software to be used with both the
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

AMER and EURO databases. The software zip file is already downloaded and staged. Then you
are briefly introduced to the command-line interface (GGSCI).

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Installing Oracle GoldenGate


Chapter 4 - Page 2
Practice 4-1: Preparation and Installation
Overview
There are two databases configured on your machine: AMER and EURO. These are physically
different databases, each with its own structure and set of users. In the practices for this course,
you sometimes need to connect to one of your databases by using SQL*Plus. The following
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

steps describe how to connect to each of your databases and also provide more details about
the users and tables that you will be working with.
Each database has administrative users, such as system, as well as other users created
specifically for this course. The data tables that you create and populate in the AMER database
that you use in this course are owned by the WEST user. Conversely, the data tables in the EURO
database are owned by the EAST user.
Even though there is only one PC for each practice team, there are two host names defined in
the /etc/hosts file: easthost and westhost. You should be able to ping both hosts, and e to
you should use those names in place of localhost so that you can clearly indicate to yourself
cens
l i
source and target hosts.
a ble
To connect to the AMER database as the system user by using SQL*Plus, enter the following
fe r
command at the operating system prompt:
a ns
[OS_prompt ~] sqlplus system@amer
n- t r
no
The password for all database accounts for this course is oracle_4U.
a
h a s ideฺ
m ) G u
Operating System o
ฺc den t
o n
Type
r i c ss s Stu Linux
@ e
e t hi
<userid>
t ฺ n ag us oracle

( s uji
<password> oracle

N ag
jit
Su
AMER Database (Source)

<login> west

<password> oracle_4U

<oracle_sid> amer

$GG_AMER_HOME /u01/app/oracle/product/gg_amer

Manager <port> 15000

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Installing Oracle GoldenGate


Chapter 4 - Page 3
EURO Database (Target)

<login> east

<password> oracle_4U
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

<oracle_sid> euro

$GG_EURO_HOME /u01/app/oracle/product/gg_euro

Manager <port> 15001

GoldenGate
e to
cens
<software location> /stage
l i
a ble
GoldenGate <install location - source> /u01/app/oracle/product/gg_amer
fe r
a n s
GoldenGate <install location - target>
n -t r
/u01/app/oracle/product/gg_euro
o
s a n eฺ
1. To set up your working environment, create )terminal ha windowsu id to make it easier to navigate
between the source and target databases:
ฺ c om ent G
a. Log in to your designated Linux
s s on machine
t u d with the following information:
1) Username: oracle
e ric this S
2) Password:
n a g@oracle u s e
2. Verify that
u j itฺa local copy of the documentation is accessible on your PC.
s
gb.a. ( Start
Go to the Linux desktop.
N a Adobe Reader. (Click its launcher icon.)
jit
Su c. Click File > Open and select the Release Notes in /home/oracle/Documents, that
is, ggate12c_release_notes_e40012.pdf. This is only to verify that you have a
working set of documentation.
d. Close the Release Notes, but leave Adobe Reader running minimized. You will need it
later, but not now.
3. Set up your terminal environment.
a. Double-click the Terminal icon located on your Linux desktop.

b. Expand it to full screen.


c. Click File > Open Tab four times so that you have five open tabs.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Installing Oracle GoldenGate


Chapter 4 - Page 4
d. From the Terminal menu, select Terminal > Set Title for each one of the tabs.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
e. Set the name of the terminal tabs from left to right to be AMER_WEST_SQLPLUS,
a ble
AMER_WEST_GGSCI, EURO_EAST_SQLPLUS, EURO_EAST_GGSCI, and nothing for the fe r
last one (which will dynamically show the current directory). It should look similar toa ns
this: n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
N a
S ujit
Leave these terminal tabs open for the entire course.
4. On the fifth (unnamed) tab, unzip the OGG installation files from the stage directory into the
temp directory.
 oracle@somehost ~ _
[OS_prompt ~] cd /tmp
[OS_prompt tmp] mkdir ogg
[OS_prompt tmp] cd ogg
[OS_prompt tmp] unzip /stage/1212*
[OS_prompt tmp] cd fbo*
[OS_prompt tmp] cd Disk1
[OS_prompt tmp] ls
install response runInstaller stage

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Installing Oracle GoldenGate


Chapter 4 - Page 5
5. Run the Oracle Universal Installer (OUI) to create the AMER instance.
a. At the OS prompt, run ./runInstaller to launch the GUI.
b. At the Installation Option panel, accept the default of Oracle 12c. Click Next.
c. In the Installation Details panel, change the software location to
/u01/app/oracle/product/gg_amer, leave the Database Location as its default,
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

and change Manager Port to 15000. Click Next.


d. In the Summary panel, click Install. It takes about a minute.
e. In the Finish panel, click Close.
6. Run the Oracle Universal Installer (OUI) again to create the EURO instance.
a. At the OS prompt, re-run ./runInstaller to launch the GUI a second time.
b. In the Installation Option panel, accept the default of Oracle 12c. Click Next.
c. In the Installation Details panel, change the software location to
/u01/app/oracle/product/gg_euro, leave the Database Location at its default, e to
and change Manager Port to 15001. Click Next.
cens
l i
d. In the Summary panel, click Install. It takes about a minute.
a ble
e. In the Finish panel, click Close.
fe r
7. On the AMER_WEST_SQLPLUS tab, set the Oracle database environment variables for
a ns
amer. Note the leading dot (period) before the oraenv command. Enter the following
n- t r
commands:
a no
[OS_prompt ~] cd ~/labs
h a s ideฺ
[OS_prompt labs] . oraenv
m ) G u
o
ฺc den t
ORACLE_SID = [amer] ? amer
o n tu
The Oracle base remains
r i c ss s unchanged
S with value /u01/app/oracle
e valuethisi already amer, you could accept it without change by
Note: Because the current
@
pressing Enter.
n a g use
s jitฺ
8. On theuAMER_WEST_GGSCI tab, set the working directory and the Oracle database
(
genvironment variables for amer. Note the leading dot (period) before the oraenv
N a command. Enter the following commands:
u j i t
S [OS_prompt ~] cd $GG_AMER_HOME
[OS prompt gg_amer] pwd
/u01/app/oracle/product/gg_amer
[OS prompt gg_amer] . oraenv
ORACLE_SID = [amer] ? amer
The Oracle base remains unchanged with value /u01/app/oracle
Note: Because the current value is already amer, you could accept it without change by
pressing Enter.
9. On the EURO_EAST_SQLPLUS tab, set the Oracle database environment variables for
euro. Note the leading dot (period) before the oraenv command. Enter the following
commands:
[OS_prompt ~] cd ~/labs
[OS_prompt labs] . oraenv
ORACLE_SID = [amer] ? euro
The Oracle base remains unchanged with value /u01/app/oracle
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Installing Oracle GoldenGate


Chapter 4 - Page 6
Note: The first time, you must change the value to euro. But if you ever run the command
again in the same window or on the same tab, you can accept euro without change by
pressing Enter.
10. On the EURO_EAST_GGSCI tab, set the working directory and the Oracle database
environment variables for euro. Note the leading dot (period) before the oraenv
command. Enter the following commands:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

[OS_prompt ~] cd $GG_EURO_HOME
[OS prompt gg_euro] pwd
/u01/app/oracle/product/gg_euro
[OS prompt gg_euro] . oraenv
ORACLE_SID = [amer] ? euro
The Oracle base remains unchanged with value /u01/app/oracle
Note: The first time, you must change the value to euro. But if you ever run the command
e to
again in the same window or on the same tab, you can accept euro without change by
cens
pressing Enter. l i
a ble
This completes Practice 4-1. Continue now with Practice 4-2.
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Installing Oracle GoldenGate


Chapter 4 - Page 7
Practice 4-2: Introduction to the GGSCI Command Interface
Overview
In this practice, you learn 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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Assumptions
The interchangeability of the databases assumes that they are not currently running any GGSCI
commands.

Tasks
1. How you invoke GGSCI depends on the settings in your profile. On the fifth tab
oracle@hostname, from the /home/oracle directory, review the .bashrc file. Make
e to
certain that the ORACLE_HOME, GG_AMER_HOME, and GG_EURO_HOME system
cens
environment variables are set to the correct directories. The Oracle GoldenGate processes l i
refer to them when connecting to the database. If the appropriate settings have been
a ble
included, you can invoke GGSCI directly from the command line. fe r
a ns
[OS_prompt] more ~/.bashrc
n- t r
no
# .bashrc

# User specific aliases and functions a


s ideฺ
# alias ll='ls -l'
) h a u
alias rlggsci='rlwrap ./ggsci'
o m t G
o n ฺc den
alias rlsqlplus='rlwrap sqlplus'

ss
]; then s S
# Source global definitions
i c tu
e r
if [ -f /etc/bashrc
t hi
fi @
. /etc/bashrc
ag us e
t ฺ n
( s uji
ORACLE_BASE=/u01/app/oracle

ag ORACLE_HOME=${ORACLE_BASE}/product/12.1.0/dbhome_1

N GG_AMER_HOME=${ORACLE_BASE}/product/gg_amer

ujit
GG_EURO_HOME=${ORACLE_BASE}/product/gg_euro
S GG_DS_HOME=${ORACLE_BASE}/product/gg_director_server
GG_DC_HOME=${ORACLE_BASE}/product/gg_director_client
GG_MONI_HOME=${ORACLE_BASE}/product/gg_moni
JAVA_HOME=/usr/java/jdk1.7.0_40
PATH=${JAVA_HOME}/bin:${ORACLE_HOME}/bin:${GG_AMER_HOME}:${GG_EURO_HOME}:${PAT
H}:${HOME}/bin
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/ojdbc7.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
export CLASSPATH LD_LIBRARY_PATH JAVA_HOME
[OS_prompt]
Note: Make sure the PATH= statement is all on one line. Some of the Management
Pack variables for Director and Monitor are set as well. They are not used in this
course.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Installing Oracle GoldenGate


Chapter 4 - Page 8
2. GGSCI does not have an easy native command-line editor, so a read-line wrap (rlwrap)
package has been installed, and aliases set up to make it easier for the class. This is not
part of the normal GGSCI function! Launch the GGSCI command interface by using either
the alias (easier) or the official (harder) way. On the source AMER_WEST_GGSCI tab, enter
the following commands:
[OS_prompt gg_amer] ./ggsci either this or…
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

[OS_prompt gg_amer] rlggsci

Oracle GoldenGate Command Interpreter for Oracle


Version 12.1.2.0.0 17185003 OGGCORE_12.1.2.0.0_PLATFORMS_130924.1316_FBO
Linux, x64, 64bit (optimized), Oracle 12c on Sep 25 2013 02:33:54
Operating system character set identified as UTF-8.
Copyright (C) 1995, 2013, Oracle and/or its affiliates. All rights reserved.

e to
GGSCI (AMER) 1>
cens
l i
3. View a HELP summary for all commands:
a ble
GGSCI (AMER) 1> Help
fe r
a n s
GGSCI Command Summary:
n- t r
a no
Object: Command:
h a s ideฺ
SUBDIRS CREATE
m ) G u
DATASTORE
o t
ALTER, CREATE, DELETE, INFO, REPAIR
ฺc den
ER
o n
INFO, KILL, LAG, SEND, STATUS, START, STATS, STOP
EXTRACT
r i c ss s Stu
ADD, ALTER, CLEANUP, DELETE, INFO, KILL,

@ e t hi
LAG, REGISTER, SEND, START, STATS, STATUS, STOP
e
t ฺ n ag us UNREGISTER

uji
EXTTRAIL ADD, ALTER, DELETE, INFO

( s
GGSEVT
g JAGENT
VIEW

N a INFO, START, STATUS, STOP

ujit
MANAGER INFO, SEND, START, STOP, STATUS
S MARKER
PARAMS
INFO
EDIT, VIEW
REPLICAT ADD, ALTER, CLEANUP, DELETE, INFO, KILL, LAG, SEND,
START, STATS, STATUS, STOP, SYNCHRONIZE
REPORT VIEW
RMTTRAIL ADD, ALTER, DELETE, INFO
TRACETABLE ADD, DELETE, INFO
TRANDATA ADD, DELETE, INFO
SCHEMATRANDATA ADD, DELETE, INFO
CHECKPOINTTABLE ADD, DELETE, CLEANUP, INFO, UPGRADE
WALLET CREATE, OPEN, PURGE
MASTERKEY ADD, INFO, RENEW, DELETE, UNDELETE
CREDENTIALSTORE ADD, ALTER, INFO, DELETE

Commands without an object:


(Database) DBLOGIN, LIST TABLES, ENCRYPT PASSWORD, FLUSH SEQUENCE
MININGDBLOGIN

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Installing Oracle GoldenGate


Chapter 4 - Page 9
(DDL) DUMPDDL
(Miscellaneous) DEFAULTJOURNAL, FC, HELP, HISTORY, INFO ALL, OBEY,
SET EDITOR, SHELL, SHOW, VERSIONS, !
(note: type the word COMMAND after the ! to display the
! help topic, for example: GGSCI (sys1)> help ! command
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

For help on a specific command, type HELP <command> <object>.


Example: HELP ADD REPLICAT

GGSCI (AMER) 2> Help All


The last three rows in the command summary (Wallet, MasterKey,
CredentialStore) are new with 12c, and JAGENT is for Veridata.
4. View a HELP summary for a command or entity (some of the screenshots are too long to
include):
e to
GGSCI (AMER) 3> Help Add Extract
cens
l i
GGSCI (AMER) 4> Help Add ExtTrail
a ble
Unfortunately, there is no way to pipe the very long help output into more, or some kind of
fe r
page-at-a-time pause command (though you could simply "sh gedit help.txt" and
a ns
search and scroll). n- t r
5. View your command history:
a no
GGSCI (AMER) 5> History h a s ideฺ
m ) G u
GGSCI Command History nฺc
o e n t
o d
r i c ss s Stu
1: Help e
@ e t hi
2: a
n g Allus
Help
t ฺ
( s uji 3: Help Add Extract
ag 4: Help Add ExtTrail
N
ujit
5: History
S
GGSCI (AMER) 6>
To repeat a command (for example, the third one), enter exclamation (bang) and the line
number, as in the following example:
!3
Note that the up/down arrow recall of rlwrap (alias rlggsci) is not part of the normal
function of the product, nor is it supported, but is still quite handy.
6. View a brief informational summary of all processes:
GGSCI (AMER) 6> Info All

Program Status Group Lag at Chkpt Time Since Chkpt


MANAGER RUNNING

GGSCI (AMER) 7>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Installing Oracle GoldenGate


Chapter 4 - Page 10
The Installer started the Manager for you. You will run this Info All command many
times as the practices progress. When other processes are configured and running, the
report becomes more interesting.
7. Do not exit GGSCI unless explicitly instructed to do so. (There is no harm; it is just a bother
to keep restarting it.) Leave it running for the entire class.
This completes Practice 4-2. This completes the practices for Lesson 4. Stop here.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Installing Oracle GoldenGate


Chapter 4 - Page 11
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 4: Installing Oracle GoldenGate


Chapter 4 - Page 12
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a n s
Practices for n t r
-Lesson 5:
n o
a eฺ Overview and
Configuration
s
) h a
Preparing u idthe Environment
ฺ c om ent G
s s on tuChapter
d 5
e ric this S
n a g@ use
u jitฺ
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Configuration Overview and Preparing the Environment


Chapter 5 - Page 1
Practices for Lesson 5: Overview
Practices Overview
In these practices, you begin the process of setting up one-way data replication by creating and
populating your databases. You also configure and start the Manager process on both instances
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

of Oracle GoldenGate. Oracle GoldenGate provides log-based change data capture (CDC) and
replication of committed database transactions. The software provides capture, routing,
transformation, and delivery of transactional data across heterogeneous environments in real
time.

Big Picture
The following figure depicts the simplified Oracle GoldenGate implementation that you create. In
this practice, you create the objects that are shaded (source database, target database, and
mgr.prm files):
e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Configuration Overview and Preparing the Environment


Chapter 5 - Page 2
Practice 5-1: Preparing Your Environment
Overview
In this practice, you set up the databases (AMER and EURO) and configure Oracle GoldenGate to
work specifically with the Oracle databases.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Note: Some parts of the screenshot feedback may be in a smaller font for clarity. However, the
commands that you should type are always indicated by full-sized, bold monospace font.

Assumptions
Two core databases are already installed: AMER and EURO. The AMER database (the source
database) has the west/oracle_4U user already created, and the EURO database has the
east/oracle_4U user also already created. In this practice, you run the
source_database.sql script on the AMER database and the target_database.sql script
on the EURO database. Both of these scripts create the following tables: e to
• cens
ACCOUNT
l i
• ACCOUNT_TRANS
a ble
• fe r
BRANCH
a ns
• TELLER
n- t r
• TELLER_TRANS
a no
• BRANCH_ATM
h a s ideฺ
m
The data tables in the AMER database are owned ) by the G u user. The data tables in the EURO
WEST
database are owned by the EAST user. ฺc o e n t
o n d
tu with oraenv for amer and euro. The
r i c ss variables
You have already set the environment
s S
e t hi
SQL*Plus tabs are in the /home/oracle/labs
@ e
working directory.

t ฺ n ag us
utojithe AMER_WEST_SQLPLUS tab. To create the source database for AMER, at the
Tasks
( s
1. Switch
N agOS prompt, issue the following command:
S ujit [OS_prompt labs] ls Section5/sqlscripts/
seed_database.sql source_database.sql target_database.sql
[OS_prompt labs] sqlplus west@amer/oracle_4U
@Section5/sqlscripts/source_database.sql
SQL*Plus: Release 12.1.0.1.0 Production on Wed Nov 20 13:42:30 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Last Successful login time: Tue Nov 19 2013 12:39:20 +00:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options

Table dropped.
... many lines omitted for clarity ...
As with many Oracle PL/SQL scripts, a first attempt to drop a non-existent table gives an
“error” that the table or view does not exist. For these setup scripts, you can ignore those
messages.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Configuration Overview and Preparing the Environment


Chapter 5 - Page 3
2. To populate the tables on the AMER database, run the following command from the same
directory (/home/oracle/labs/Section5/sqlscripts):
[OS_prompt labs] sqlplus west@amer/oracle_4U
@Section5/sqlscripts/seed_database.sql
SQL*Plus: Release 12.1.0.1.0 Production on Wed Nov 20 13:46:47 2013
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Copyright (c) 1982, 2013, Oracle. All rights reserved.


Last Successful login time: Wed Nov 20 2013 13:42:30 +00:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options

Table truncated.
... many lines omitted for clarity ...
e to
ns
3. To create the data tables on the EURO database, on the EURO_EAST_SQLPLUS tab,
execute the following commands:
l i ce
[OS_prompt labs] sqlplus east@euro/oracle_4U
a b le
@Section5/sqlscripts/target_database.sql
fe r
a n s
SQL*Plus: Release 12.1.0.1.0 Production on Wed Nov 20 13:50:54 2013
n- t r
no
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Last Successful login time: Wed Nov 06 2013 13:58:56 +00:00
a
s ideฺ
Connected to:
h a
) Analytics
Releaseu12.1.0.1.0 - 64bit Production
m t G and Real Application Testing
Oracle Database 12c Enterprise Edition
c
With the Partitioning, OLAP, Advanced
ฺ o e n
options
s s on tud
Table dropped.
e ic hisforS clarity ...
romitted
... many lines
g @ e t
Note that you ฺ s
nado not populate
u the target tables with SQL scripts; populating (replicating) will
j i t
u GoldenGate’s job.
be Oracle
4. g
( s
N a Don’t do this step―just read it! Create an Oracle GoldenGate user that can connect to

ujit
the source and target databases for transactional data. An Oracle GoldenGate user
S requires a database user with at least the following privileges:
User Privilege Extract (Source Side) Replicat (Target Side)
CREATE SESSION, ALTER X X
SESSION
RESOURCE X X
SELECT ANY DICTIONARY X X
FLASHBACK ANY TABLE X
or
FLASHBACK ON <owner.table>
SELECT ANY TABLE X X
or
SELECT ON <owner.table>
INSERT, UPDATE, DELETE ON X
<target tables>
CREATE TABLE X
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Configuration Overview and Preparing the Environment


Chapter 5 - Page 4
User Privilege Extract (Source Side) Replicat (Target Side)
EXECUTE on DBMS_FLASHBACK X
package
In addition to the above privileges, you would normally run:
SQL> EXEC DBMS_GOLDENGATE_AUTH.GRANT_ADMIN_PRIVILEGE('GGUSER');
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

(Optional) To learn about the DBMS_GOLDENGATE_AUTH syntax, enter the following


commands:
[OS_prompt labs] sqlplus / as sysdba
SQL> set pages 100
SQL> desc dbms_goldengate_auth
SQL> SELECT text FROM all_source
WHERE name='DBMS_GOLDENGATE_AUTH';
(shows "help" syntax text at top by convention, may have to e to
scroll up to see it.)
ce ns
l i
Instead of doing all that work, the next step will “cheat” for purposes of this practice.
a ble
5. Create a DBA-level user (gguser/oracle_4U) on both the AMER and EURO databases. To
fe r
make the practices easier in the classroom, you give ggsuser the DBA role (which is more
a n s
n-
than what would have been granted in the previous step). In a real-world situation, you t r
would not grant that many privileges.
a no
h a s ideฺ
For the AMER database, on the AMER_WEST_SQLPLUS tab:
[OS_prompt labs] sqlplus / as) sysdba u
ฺ c om ent G
s s on tud
SQL> sho parameter db_name

NAME e ricTYPEthis SVALUE


n a g@ us---------
--------------- e ----------------

u j itฺ
db_name string amer

g (sSQL> CREATE TABLESPACE oggtabsp DATAFILE


N a '/u01/app/oracle/oradata/amer/oggtabsp.dbf' SIZE 50m
uj i t AUTOEXTEND ON;
S Tablespace created.

SQL> CREATE USER gguser IDENTIFIED BY oracle_4U DEFAULT


TABLESPACE oggtabsp;
User created.

SQL> GRANT dba TO gguser;


Grant succeeded.

SQL> exit
The separate tablespace is required only for the DDL replication in Practice 15; otherwise,
the user could be anywhere.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Configuration Overview and Preparing the Environment


Chapter 5 - Page 5
For the EURO database, on the EURO_EAST_SQLPLUS tab:
[OS_prompt labs] sqlplus / as sysdba

SQL> sho parameter db_name

NAME TYPE VALUE


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

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


db_name string euro

SQL> CREATE TABLESPACE oggtabsp DATAFILE


'/u01/app/oracle/oradata/euro/oggtabsp.dbf' SIZE 50m
AUTOEXTEND ON;
Tablespace created.

SQL> CREATE USER gguser IDENTIFIED BY oracle_4U DEFAULT


TABLESPACE oggtabsp;
e to
User created.
cens
l i
SQL> GRANT dba TO gguser;
a ble
Grant succeeded.
fe r
a ns
SQL> exit
n- t r
6.
no
On the AMER_WEST_SQLPLUS tab, log out of SQL sys and then log in again with the new
a
h a s ideฺ
DBA user, gguser. Minimal supplemental logging must be enabled at the database level to
allow Oracle GoldenGate to properly capture updates to primary keys and chained rows.
m ) G u
o t
To enable supplemental logging at the database level, do the following:
ฺc den
o n
a. Log in to SQL*Plus as gguser/oracle_4U on AMER. Use rlsqlplus so that you
c ss s Stu
get up/down arrow history and editing.
r i
e t hi
b. Enable minimal supplemental logging by executing the following commands:
@ e
g us
ti ฺna
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;

s u j
ALTER DATABASE FORCE LOGGING;

g (c. To ensure that the redo and archive logs contain supplemental log data, switch the
N a logs by executing the following commands:

S ujit ALTER SYSTEM SWITCH LOGFILE;


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

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Configuration Overview and Preparing the Environment


Chapter 5 - Page 6
The results should look similar to this:
[OS_prompt labs] rlsqlplus gguser@amer/oracle_4U

SQL> set sqlprompt AMER_SQL>

AMER_SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Database altered.

AMER_SQL> ALTER DATABASE FORCE LOGGING;


Database altered.

AMER_SQL> ALTER SYSTEM SWITCH LOGFILE;


System altered.

AMER_SQL> SELECT supplemental_log_data_min, force_logging


FROM v$database;
e to
SUPPLEME FORCE_LOGGING
cens
-------- ------------------------------ l i
YES YES
a ble
fe r
AMER_SQL>
a n s
7. On the EURO_EAST_SQLPLUS tab, log out of SQL sys and then n r
-t log in again with the new
o
n at the database level to
s a
user, gguser. Minimal supplemental logging must be enabled
eฺ keys and chained rows.
h a
allow Oracle GoldenGate to properly capture updates
) level,
To enable supplemental logging at the database
to primary
i d
uperform the following:
o m t G
o n ฺc denon EURO. Use rlsqlplus so that you get
a. Log in to SQL*Plus as gguser/oracle_4U
up/down arrow history and
i c ss logging
editing.
S tu
e r
b. Enable minimal supplemental
t h i s by executing the following commands:
g@ uADD
ALTER DATABASE
ALTERฺn a se SUPPLEMENTAL LOG DATA;
jit DATABASE FORCE LOGGING;
Touensure that the redo and archive logs contain supplemental log data, switch the
c. (s

N ag logs by executing the following command:


S ujit ALTER SYSTEM SWITCH LOGFILE;
d. Verify that supplemental logging is enabled at the database level via the following
command: (The output of the query must be YES or IMPLICIT.)
SELECT supplemental_log_data_min, force_logging
FROM v$database;

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Configuration Overview and Preparing the Environment


Chapter 5 - Page 7
The results should look similar to this:
[OS_prompt labs] rlsqlplus gguser@euro/oracle_4U

SQL> set sqlprompt EURO_SQL>

EURO_SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Database altered.

EURO_SQL> ALTER DATABASE FORCE LOGGING;


Database altered.

EURO_SQL> ALTER SYSTEM SWITCH LOGFILE;


System altered.

EURO_SQL> SELECT supplemental_log_data_min, force_logging


FROM v$database;
e to
SUPPLEME FORCE_LOGGING
cens
-------- ------------------------------ l i
YES YES
a ble
fe r
EURO_SQL>
a ns
This completes Practice 5-1. Continue now with Practice 5-2. n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Configuration Overview and Preparing the Environment


Chapter 5 - Page 8
Practice 5-2: Creating the GLOBALS Parameter File

Overview
On the target side, Replicat checkpoints to a table in the database that is defined in a special
parameter file named GLOBALS. The file name must be all UPPERCASE with no extension. In
this practice, you create a GLOBALS parameter file located on the target database (EURO).
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Tasks
1. On the EURO_EAST_GGSCI tab, create a GLOBALS parameter file by executing the
following commands. The oraenv variables should already be set.
[OS_prompt ~] cd $GG_EURO_HOME
[OS_prompt gg_euro] gedit GLOBALS
2. Start gedit (or vi if you prefer) to open a new GLOBALS file located in the directory of
e to
your Oracle GoldenGate instance. Add the following runtime parameters to the GLOBALS
cens
file, which you use in a later practice: l i
CheckpointTable GGS_CHECKPOINT a ble
fe r
3. Save and close the file.
a ns
Note: There is no harm or benefit in creating a GLOBALS file on the source side as well;
n- t r
no
however, it is not necessary at this time. Other Oracle GoldenGate products, such as
a
h a s ideฺ
Monitor from the Management Pack, also make use of the GLOBALS file.
) u
This completes Practice 5-2. Continue now with Practice 5-3.
m G
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
N a
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Configuration Overview and Preparing the Environment


Chapter 5 - Page 9
Practice 5-3: Configuring and Starting Oracle GoldenGate Manager
Overview
In this practice, you configure and stop/restart the Manager process on both instances of Oracle
GoldenGate. The Oracle GoldenGate Manager process performs several important tasks that
you must configure:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

• Listens for incoming connectivity requests from Extract or Extract data pump
• Performs housekeeping functions to delete any consumed Oracle GoldenGate trails

Tasks
1. The first task is to configure and stop/restart the Manager processes on both the source
and target. On the AMER_WEST_GGSCI tab, GGSCI should still be started from a previous
lab. If so, skip to step 2; if not, do the following:
e to
[OS_prompt ~] cd $GG_AMER_HOME
cens
[OS_prompt gg_amer] . oraenv
l i
ORACLE_SID = [amer] ?
a ble
The Oracle base remains unchanged with value /u01/app/oracle
fe r
[OS_prompt gg_amer] rlggsci
a ns
Oracle GoldenGate Command Interpreter for Oracle
n- t r
no
Version 12.1.2.0.0 17185003 OGGCORE_12.1.2.0.0_PLATFORMS_130924.1316_FBO
a
h a s ideฺ
Linux, x64, 64bit (optimized), Oracle 12c on Sep 25 2013 02:33:54
Operating system character set identified as UTF-8.

m ) G u
Copyright (C) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
o
ฺc den t
GGSCI (AMER) 1>
o n tueditor for this session, enter:
c ss thes text
2. (Optional) If you want to ichange
r S
GGSCI (AMER)> @ e hi gedit
eSet Editor
t
If you do not
t ฺ n agthis Set,uyou
do s get vi as the default editor for Linux. You cannot change the
ji editor.
startupudefault
s
3. ag
(
At the GGSCI prompt, enter:
N
S ujit 4.
GGSCI (AMER)> Edit Param mgr
The text editor starts and opens a new mgr.prm file. Add the following runtime parameter
to the mgr.prm file below the existing Port line (created by the installer):
Port 15000
PurgeOldExtracts ./dirdat/*, UseCheckpoints
Do not save it yet. You have another line to add.
5. Using the Oracle GoldenGate Reference Manual
(ggate12c_reference_oracle_e29392.pdf) located in ~/Documents, what
parameter is used to specify ports that Manager can allocate for dynamic communications?
a. Add that parameter to the mgr.prm file, defining the DynamicPortList range to be
15100 through 15150.
b. Save and close the file.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Configuration Overview and Preparing the Environment


Chapter 5 - Page 10
6. To make the new parameters take effect, at the GGSCI prompt, bounce (stop and restart)
the Manager process by entering the following commands:
GGSCI (AMER)> Stop mgr
GGSCI (AMER)> Start mgr
To view the status of the Manager process, enter this command:
GGSCI (AMER)> Info mgr
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

The results should look similar to the following: (Your host name and PID will be different.)
GGSCI (AMER)> Stop Manager
Manager process is required by other GGS processes.
Are you sure you want to stop it (y/n)? y
Sending STOP request to MANAGER ...
Request processed.
Manager stopped.

e to
GGSCI (AMER)> Start Manager
cens
Manager started.
l i
a ble
GGSCI (AMER)> Info Manager
fe r
Manager is running (IP port WESTHOST.15000, Process ID 7992).
a ns
GGSCI (AMER)> n- t r
a no
Notice that you can substitute mgr for Manager, and you can add an exclamation mark (!)
h a s ideฺ
at the end of the Stop command to suppress the “Are you sure?” prompt (useful for
scripts). m ) G u
o
ฺc den t
7. n
On the EURO_EAST_GGSCI tab, from the shell prompt positioned inside the Oracle
o
r i c ss s Stu
GoldenGate directory, invoke GGSCI. Execute the following commands:
e t hi
[OS_prompt ~] cd $GG_EURO_HOME
@ e
g us
[OS_prompt gg_euro] . oraenv

u jti ฺna
ORACLE_SID = [euro] ? euro

g ( s The Oracle base remains unchanged with value /u01/app/oracle

N a [OS_prompt gg_euro] rlggsci

S ujit Oracle GoldenGate Command Interpreter for Oracle


Version 12.1.2.0.0 17185003 OGGCORE_12.1.2.0.0_PLATFORMS_130924.1316_FBO
Linux, x64, 64bit (optimized), Oracle 12c on Sep 25 2013 02:33:54
Operating system character set identified as UTF-8.
Copyright (C) 1995, 2013, Oracle and/or its affiliates. All rights reserved.

GGSCI (EURO) 1>


8. Optionally, set the default editor. Edit the manager parameter file:
GGSCI (EURO)> Edit Param mgr
Add the following runtime parameters to the mgr.prm file:
Port 15001
PurgeOldExtracts ./dirdat/*, UseCheckpoints
Save and close the file.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Configuration Overview and Preparing the Environment


Chapter 5 - Page 11
9. To make the new parameters take effect, at the GGSCI prompt, bounce (stop and restart)
the Manager process by entering the following commands:
GGSCI (EURO)> Stop mgr !
GGSCI (EURO)> Start mgr
Notice that the exclamation point suppresses the “Are you sure?” message. To view the
status of the Manager process, enter the following command:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

GGSCI (EURO)> Info Manager


The results should look similar to the following example. (Your host name and PID will be
different.) Notice that the EURO port number is one greater than the AMER port number.
GGSCI (EURO)> Start Manager
Manager started.

GGSCI (EURO)> Info Manager


e to
Manager is running (IP port EASTHOST.15001, Process ID 24513).
cens
l i
GGSCI (EURO)>
a ble
fe r
Do not exit GGSCI, leave it running for the entire class.
a ns
10. (Re)starting the Manager created an MGR.rpt in the dirrpt directory. Old reports get
n- t r
a no
numbered 0–9. The current report is not very interesting yet, but it is a good habit to check
the report often, especially for troubleshooting. You can optionally see it by entering the
command:
h a s ideฺ
GGSCI (EURO)> View Report mgr m ) G u
o
ฺcto scroll
e t
n or down, you can enter (being mindful of
n
If the report is very long and you want
o d up
UPPER/lowercase file names):
r i c ss s Stu
GGSCI (EURO)>esh lesshidirrpt/MGR.rpt
g @ e t
s
na 5-3.uContinue now with Practice 5-4.
ฺPractice
u
This completesj i t
g ( s
jit Na
Su

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Configuration Overview and Preparing the Environment


Chapter 5 - Page 12
Practice 5-4: Using the TranData option

Overview
In this practice, you enable supplemental logging on the source database for the specified
tables. Before you can start capturing real-time data, the Oracle database must be set to log the
table key values whenever it logs a rows change, so that they are available to Oracle
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

GoldenGate in Redo. By default, the database logs only those column values that change. This
is required so Oracle GoldenGate can locate the correct row on the target for update and delete
operations.

Tasks
1. You can add individual tables or use wildcards. On the AMER_WEST_GGSCI tab (the source
server), at the GGSCI prompt, enter the following:
GGSCI (AMER)> DBLogin UserID gguser@amer, Password oracle_4U
e to
GGSCI (AMER)> Add TranData WEST.ACCOUNT
cens
l i
GGSCI (AMER)> Add TranData WEST.*
a ble
The results should be similar to the following:
fe r
a ns
GGSCI (AMER)> DBLogin UserID gguser@amer, Password oracle_4U
n- t r
no
Successfully logged into database.

a
s ideฺ
GGSCI (AMER)> Add TranData WEST.ACCOUNT
) h a u
Logging of supplemental redo ฺc o m t G
n for table WEST.ACCOUNT.
o n datahas
TRANDATA for schedulingscolumns u d e
enabled

c s S t been added on table 'WEST.ACCOUNT'.

e ri this
GGSCI (AMER)>
a g @ seTranData WEST.*
Add

i t ฺ n u
j
u of supplemental redo log data is already enabled for table
g (sLogging
WEST.ACCOUNT.
N a
uj i t 2013-12-02 13:14:07 WARNING OGG-00706 Failed to add supplemental log group
S on table WEST.ACCOUNT due to ORA-32588: supplemental logging attribute primary
key exists SQL ALTER TABLE "WEST"."ACCOUNT" ADD SUPPLEMENTAL LOG DATA (PRIMARY
KEY, UNIQUE, FOREIGN KEY) COLUMNS /* GOLDENGATE_DDL_REPLICATION */.

Logging of supplemental redo data enabled for table WEST.ACCOUNT_TRANS.


TRANDATA for scheduling columns has been added on table 'WEST.ACCOUNT_TRANS'.
Logging of supplemental redo data enabled for table WEST.BRANCH.
TRANDATA for scheduling columns has been added on table 'WEST.BRANCH'.
Logging of supplemental redo data enabled for table WEST.BRANCH_ATM.
TRANDATA for scheduling columns has been added on table 'WEST.BRANCH_ATM'.
Logging of supplemental redo data enabled for table WEST.TELLER.
TRANDATA for scheduling columns has been added on table 'WEST.TELLER'.
Logging of supplemental redo data enabled for table WEST.TELLER_TRANS.
TRANDATA for scheduling columns has been added on table 'WEST.TELLER_TRANS'.
GGSCI (AMER)>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Configuration Overview and Preparing the Environment


Chapter 5 - Page 13
Note that there is no harm in adding transaction data twice, as is the case for
WEST.ACCOUNT. The warning can be ignored. If at this point you were to create a new table
WEST.JUNK, it would not be picked up for adding transaction data even though you used
the wildcard for the WEST schema. If you did want to include future tables, use Add
SchemaTranData instead of TranData.
2. Execute the following GGSCI command to verify that supplemental logging is enabled on
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

each table:
GGSCI (AMER)> Info TranData WEST.*
The results should be similar to the following:
GGSCI (AMER)> Info TranData WEST.*

Logging of supplemental redo log data is enabled for table WEST.ACCOUNT.

to
Columns supplementally logged for table WEST.ACCOUNT: ACCOUNT_NUMBER.

ns e
Logging of supplemental redo log data is enabled for table WEST.ACCOUNT_TRANS.
c e
Columns supplementally logged for table WEST.ACCOUNT_TRANS: TRANS_NUMBER,
b l e li
era
ACCOUNT_NUMBER, ACCOUNT_TRANS_TS.

s f
Logging of supplemental redo log data is enabled for table
t r anWEST.BRANCH.
Columns supplementally logged for table WEST.BRANCH: -BRANCH_NUMBER.
n on
s a for eฺ tableBRANCH_NUMBER,
Columns supplementally logged for table) h a
Logging of supplemental redo log data is enabled
u i d
WEST.BRANCH_ATM:
WEST.BRANCH_ATM.

o m t G
ฺc den
ATM_TRANS_TS, TRANS_NUMBER, ATM_NUMBER.

o n u is enabled for table WEST.TELLER.


i
Logging of supplemental
r c ssredoslog
S tdata
e logged
Columns supplementally
@ e t hi for table WEST.TELLER: TELLER_NUMBER.
t ฺ n ag us redo log data is enabled for table WEST.TELLER_TRANS.
uji supplementally logged for table WEST.TELLER_TRANS: TRANS_NUMBER,
Logging of supplemental

( s
Columns
g TELLER_TRANS_TS, TELLER_NUMBER.
N a
S ujit GGSCI (AMER)>
Leave all the GGSCI and SQL*Plus sessions running. Leave the five terminal tabs open.
This completes Practice 5-4. This completes the practices for Lesson 5. Stop here.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 5: Configuration Overview and Preparing the Environment


Chapter 5 - Page 14
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a n s
Practices for n t r
-Lesson 6:
n o
a eฺChange Capture
Configuring
s
) a
h 6 uid
ฺ c om ent G
Chapter

s s on tud
e ric this S
n a g@ use
u jitฺ
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 6: Configuring Change Capture


Chapter 6 - Page 1
Practices for Lesson 6: Overview
Practices Overview
In these practices, you set up the Extract on the source (AMER) database, ExtTrail, data
pump Extract, and RmtTrail.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Big Picture
The following diagram shows the new objects that are created: Extract, ExtTrail, data pump
Extract, and RmtTrail.

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g is for
The ew extract trailaprefix
n u sExtractWest. The pe remote trail prefix is for PumpEast. This is
t ฺ
( s
name length.uji rather than a requirement. What is a requirement is the two-letter maximum
only a convention

N ag
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 6: Configuring Change Capture


Chapter 6 - Page 2
Practice 6-1: Setting Up the Extract and ExtTrail

Overview
In this practice, you perform the following actions:
• Configure the primary Extract process that captures changes.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

• Add the local trail that stores these changes.

Tasks
1. You should still be logged in to GGSCI in the AMER instance from the previous lab. If so,
skip this task and proceed to task 2. If not, perform the following step. On the source server
(on the AMER_WEST_GGSCI tab), confirm that you are in the proper installation directory
and logged in to the database by using AMER SID. Start GGSCI by using the read-line
utility.
e to
[OS_prompt ~] cd $GG_AMER_HOME
cens
[OS_prompt gg_amer] . oraenv l i
[OS_prompt gg_amer] rlggsci
a ble
fe r
GGSCI (AMER) 1> DBLogin UserID gguser@amer, Password oracle_4U
a ns
Optionally, set the default text editor.
n- t r
2. no
On the AMER_WEST_GGSCI tab, add the wallet and credential store information (password)
a
a s ideฺ
for user gguser on both source and target systems. WARNING: Make sure that each
h
) u
Alter CredentialStore command is all on one line (cut and paste may make this
m G
difficult). o
ฺc den t
o n tu
i c ss 'dirwlt'.
GGSCI (AMER)> Create Wallet
Created wallet at rlocation s S
Opened wallet@
e t i
h'dirwlt'.
ag Add e
at location
u s
j
GGSCIi t ฺ n
(AMER)> CredentialStore
s u
ag ( Credential store created in ./dircrd/.
N
ujit
GGSCI (AMER)> Alter CredentialStore Add User gguser@amer
S Password oracle_4U Alias gguamer
Credential store in ./dircrd/ altered.

GGSCI (AMER)> Alter CredentialStore Add User gguser@euro


Password oracle_4U Alias ggueuro
Credential store in ./dircrd/ altered.

GGSCI (AMER)> Info CredentialStore


Reading from ./dircrd/:
Domain: OracleGoldenGate
Alias: gguamer
Userid: gguser@amer

Alias: ggueuro
Userid: gguser@euro

GGSCI (AMER)>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 6: Configuring Change Capture


Chapter 6 - Page 3
The Wallet will be used for parameter files and also for DBLogin.
If you make a mistake entering wallet users, the command to remove a user is:
GGSCI> Alter CredentialStore Delete User username
3. On the fifth tab, oracle@hostname, at an OS prompt, copy the source wallet single
sign-on files to the target system. Execute the two copies:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

[OS_prompt ~] cp $GG_AMER_HOME/dircrd/* $GG_EURO_HOME/dircrd


[OS_prompt ~] cp $GG_AMER_HOME/dirwlt/* $GG_EURO_HOME/dirwlt
[OS_prompt ~] ls $GG_EURO_HOME/*/*.sso
/u01/app/oracle/product/gg_euro/dircrd/cwallet.sso
/u01/app/oracle/product/gg_euro/dirwlt/cwallet.sso
4. On the AMER_WEST_GGSCI tab, configure the change data capture extract parameter file
from the GGSCI prompt by executing the Edit command:
GGSCI (AMER)> Edit Param extwest e to
Your chosen text editor opens the empty extwest.prm file. Add the following runtime
cens
l i
parameters to the text file:
a ble
Extract extwest
fe r
ExtTrail ./dirdat/ew
a ns
UserIDAlias gguamer n- t r
Table WEST.*; a no
There are many other optional parameters thathyou a scouldidaddeฺto the Extract (some are very
m ) areGinuPractice 10-3 “Modifying the
o nt above is only the minimal required
useful). Other “best practice” parameter additions
ฺ c deShown
Extract Parameters on the SourcenDatabase.”
parameters. Save and closesthe
c sofile. Stu
5. On the AMER_WEST_GGSCI e ri tab,thadd
is the Extract group by executing the following
command:
n a g@ use
s u jitฺ (AMER)> Add Extract extwest, TranLog, Begin Now
GGSCI
( adds the extwest Extract to Oracle GoldenGate, specifying that it will read from
gThis
N a Oracle Redo/Archive log, with an initial Redo checkpoint of the current timestamp (now).

S ujit 6. On the AMER_WEST_GGSCI tab, add a local extract trail that links the trail to the extwest
Extract:
GGSCI (AMER)> Add ExtTrail ./dirdat/ew, Extract extwest
This adds the dirdat/ew local extract trail, and links the trail to the extwest Extract
group. When the Extract is started, the dirdat/ew000000 file is created. When that file is
full, trail ew000001 is created, and so on through ew999999. Your results should be similar
to the following:
GGSCI (AMER)> Edit Param extwest

GGSCI (AMER)> Add Extract extwest, TranLog, Begin Now


EXTRACT added.

GGSCI (AMER)> Add ExtTrail ./dirdat/ew, Extract extwest


EXTTRAIL added.

GGSCI (AMER)>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 6: Configuring Change Capture


Chapter 6 - Page 4
You can look in the dirdat directory to prove to yourself that nothing has yet been
created.
This completes Practice 6-1. Continue now with Practice 6-2.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 6: Configuring Change Capture


Chapter 6 - Page 5
Practice 6-2: Setting Up an Extract Data Pump and Starting the Two
Extracts
Overview
In this practice, you perform the following actions:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

• Configure a data pump Extract to read the local trail and create a remote trail on the
target.
• Add the remote trail.
• Start the two Extract processes.

Tasks
1. On the AMER_WEST_GGSCI tab, at the GGSCI prompt on the source server, configure the
Extract data pump to read from the dirdat/ew local extract trail, transmit the data to the
e to
target server (EURO), and write it to the dirdat/pe remote trail:
cens
GGSCI> Edit Param pwest l i
a ble
2. Your text editor of choice opens the empty pwest.prm file. Add the following runtime
fe r
parameters to the text file:
a ns
Extract pwest
n- t r
RmtHost easthost, MgrPort 15001
a no
RmtTrail ./dirdat/pe
h a s ideฺ
Passthru
m ) G u
Table WEST.*; o
ฺc den t
o n tu
Make sure you include the one
r i c sstrailing
s Ssemicolon. Save and close the file.
3. Add the Extract groupe
@ t
by executing
e hi the following GGSCI commands:
t ฺ n ag Add
GGSCI (AMER)> u s Extract pwest, ExtTrailSource ./dirdat/ew
( s uji added.
EXTRACT

ag
N
ujit
GGSCI (AMER)> Add RmtTrail ./dirdat/pe, Extract pwest
S RMTTRAIL added.

GGSCI (AMER)>
4. Start the primary Extract process, extwest, by issuing the following command:
GGSCI (AMER)> Start Extract extwest
5. Start the data pump Extract process, pwest, by issuing the following command:
GGSCI (AMER)> Start Extract pwest
6. To verify the status of all Extracts and Replicats (ER), execute the command:
GGSCI (AMER)> Info ER *
Your results should look similar to the following:

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 6: Configuring Change Capture


Chapter 6 - Page 6
GGSCI (AMER)> Start Extract extwest
Sending START request to MANAGER ...
EXTRACT EXTWEST starting

GGSCI (AMER)> Start Extract pwest


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Sending START request to MANAGER ...


EXTRACT PWEST starting

GGSCI (AMER)> Info ER *

EXTRACT EXTWEST Last Started 2013-12-02 14:01 Status RUNNING


Checkpoint Lag 00:00:00 (updated 00:00:04 ago)
Process ID 24884
Log Read Checkpoint Oracle Redo Logs
e to
2013-12-02 14:01:54 Seqno 231, RBA 11571712
cens
SCN 0.5867261 (5867261) l i
a ble
EXTRACT PWEST Last Started 2013-12-02 14:01 Status RUNNING
fe r
Checkpoint Lag 00:00:00 (updated 00:00:02 ago)
a ns
Process ID 24885
n- t r
Log Read Checkpoint File ./dirdat/ew000000
a no
a s ideฺ
First Record RBA 1417
h
m ) G u
GGSCI (AMER)>
o t
ฺcas “RUNNING.”
e n If you see either “STOPPED” or
Both processes should display Statuso n tu d
“ABENDED,” view the report
r i c ss(View
log
s SReport <extract_name>), fix the error, and
@
restart the process. Usee Info tAll
e hi for a one-line summary of process status without the
details.
t ฺ n ag us
7. Enter u
s jiInfo command again and see which, if any, timestamps and numbers are
the
(
gincreasing. Some of them should be. Other database activity unrelated to this lab may also
N a cause the numbers to increase.
u j i t GGSCI (AMER)> Info ER *
S 8. Look in the source $GG_AMER_HOME/dirdat directory and see if any local trails are
started. They should be. You can “look” using the GUI Desktop Linux bar: Applications >
System Tools > File Browser; or you can use the following command:
GGSCI (AMER)> sh ls dirdat
You examine the content of these trails later in Practice 8 using logdump.
9. Look in the target $GG_EURO_HOME/dirdat directory and see if any remote trails are
started. They should be. You can “look” using the Desktop File Browser or by entering:
GGSCI (EURO)> sh ls dirdat
10. Using the Desktop File Browser, look in the source $GG_AMER_HOME/dirrpt directory
and see if any reports are started. They should be. Note that the reports (*.rpt) are all
UPPERCASE file names even though the parameter (*.prm) files are lowercase file
names. Look at the content of an Extract report. Note that it includes the content of the
associated parameter file at the time that the process was started.
This completes Practice 6-2. This completes the practices for Lesson 6. Stop here.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 6: Configuring Change Capture


Chapter 6 - Page 7
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 6: Configuring Change Capture


Chapter 6 - Page 8
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a n s
Practices for n t r
-Lesson 7:
n o
a eฺChange Delivery
Configuring
s
) a
h 7 uid
ฺ c om ent G
Chapter

s s on tud
e ric this S
n a g@ use
u jitฺ
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Configuring Change Delivery


Chapter 7 - Page 1
Practices for Lesson 7: Overview
Practices Overview
In these practices, you will configure change delivery. The components of change delivery
include:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

• 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

Big Picture
e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Configuring Change Delivery


Chapter 7 - Page 2
Practice 7-1: Setting Up the Checkpoint Table on the Target System
Overview
In this practice, you will create a checkpoint table on the target system.

Assumptions
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

It is assumed that you still have the five terminal tabs labeled and open from the previous labs.
Replicat checkpoints to this table in the database ensure that the Replicat checkpoint is part of
the transaction, and is used to ensure data integrity. For this step, you will create a special table
on the target server.

Tasks
1. GGSCI should still be running on the EURO_EAST_GGSCI tab from the previous labs. If so,
skip to the next task 2. If not, do the following task:
e to
[OS_prompt ~] cd $GG_EURO_HOME
cens
l i
[OS_prompt gg_euro] . oraenv
a ble
ORACLE_SID = [euro] ? euro
fe r
[OS_prompt gg_euro] rlggsci
a ns
GGSCI (EURO) 1> n- t r
2. a no
To create the checkpoint table, on the target server (on the EURO_EAST_GGSCI tab), from
h a s ideฺ
the installation directory, execute the following commands:
m ) G u
o t
GGSCI (EURO)> DBLogin UserIDAlias ggueuro
ฺc den
o n
Successfully logged into database.

r i c ss s Stu
@ e t hi
GGSCI (EURO)>eAdd CheckpointTable

n a
No checkpointg us
table specified. Using GLOBALS specification (GGS_CHECKPOINT)...

s u jitฺ
Successfully created checkpoint table GGS_CHECKPOINT.

ag( GGSCI (EURO)> Info CheckpointTable


N
S ujit No checkpoint table specified. Using GLOBALS specification (GGS_CHECKPOINT)...
Checkpoint table GGS_CHECKPOINT created 2013-12-02 14:21:06.

GGSCI (EURO)> List Tables gg*


GGUSER.GGS_CHECKPOINT
GGUSER.GGS_CHECKPOINT_LOX
Found 2 tables matching list criteria.

GGSCI (EURO)>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Configuring Change Delivery


Chapter 7 - Page 3
There is no harm in doing a DBLogin twice. There is no DBLogout; you stay logged in until
you Exit the session or DBLogin somewhere else. If you want to check to see if you are
DB logged in anywhere, issue the versions command to look for the database.
Unfortunately, it does not tell you which database you are logged in to. Versions will fail if
you are not logged in to any database.
If you accidentally try to add a checkpoint table to the same schema twice, GGSCI will warn
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

you, but no harm is done.


This completes Practice 7-1. Continue now with Practice 7-2.

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Configuring Change Delivery


Chapter 7 - Page 4
Practice 7-2: Setting Up Replicat Delivery
Overview
In this practice, you will set up the Replicat delivery component.

Tasks
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

1. On the target server EURO_EAST_GGSCI tab, make sure that the Wallet containing the
user IDs and passwords came over intact from the source host during the previous lab.
GGSCI (EURO)> Info CredentialStore
Reading from ./dircrd/:
Domain: OracleGoldenGate

to
Alias: gguamer
Userid: gguser@amer
ns e
l i ce
Alias: ggueuro
a ble
Userid: gguser@euro
fe r
a ns
GGSCI (EURO)>
n- t r
2. no
On the target EURO_EAST_GGSCI tab, execute the following command:
a
GGSCI (EURO)> Edit Param reast
h a s ideฺ
m )
Your text editor of choice opens the empty reast.prm
G ufile. (Remember, if you prefer some
editor other than the UNIX default ofฺc o t
vi, you cannissue the Set Editor gedit command
s o
for this session.) Add the followingn t
runtime u de
parameters to the text file:
c s
ri this S
Replicat reast e
n a g@ use
AssumeTargetDefs
j itฺ
DiscardFile
u
./dirrpt/reast.dsc, Purge
s
( --HandleCollisions
N ag --End Runtime
jit
Su UserIDAlias ggueuro
Map WEST.*, Target EAST.*;
The double-dashed (commented-out) lines are optional. Save and close the file.
3. On the target EURO_EAST_GGSCI tab, add the Replicat by executing the following
command:
GGSCI (EURO)> Add Replicat reast, ExtTrail ./dirdat/pe
REPLICAT added.

GGSCI (EURO)>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Configuring Change Delivery


Chapter 7 - Page 5
4. Start the Replicat process, and then verify the results:
GGSCI (EURO)> Start Replicat reast
Sending START request to MANAGER ...
REPLICAT REAST starting
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

GGSCI (EURO)> Info Replicat reast

REPLICAT REAST Last Started 2013-12-02 14:59 Status RUNNING


Checkpoint Lag 00:00:00 (updated 00:00:04 ago)
Process ID 25935
Log Read Checkpoint File ./dirdat/pe000000
First Record RBA 0

e to
GGSCI (EURO)>
cens
Your details (dates, times, and PIDs) will be different. If the Replicat is not Status l i
RUNNING, then examine the reports.
a ble
fe r
This completes Practice 7-2. Continue now with Practice 7-3.
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
N a
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Configuring Change Delivery


Chapter 7 - Page 6
Practice 7-3: Generating Data and Starting GoldenGate Processes
Overview
In this practice, you will start the data generation process and begin real-time data capture.

Assumptions
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

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

Tasks
1. On the AMER_WEST_GGSCI tab, view the status of the extwest Extract and the pwest
Data Pump Extract:
e to
GGSCI (AMER)> Info ER *
cens
l i
a ble
EXTRACT EXTWEST Last Started 2013-12-02 14:01 Status RUNNING
fe r
Checkpoint Lag 00:00:00 (updated 00:00:01 ago)
a ns
Process ID 24884
n- t r
Log Read Checkpoint Oracle Redo Logs
a no
2013-12-03 07:05:07 Seqno 234, RBA 26998272

h a s ideฺ
SCN 0.5911278 (5911278)

m ) G u
o
ฺc(updated
e t
n 14:01 Status RUNNING
EXTRACT PWEST
s o n
Last Started
t
2013-12-02
d
u 00:00:04 ago)
Checkpoint Lag
c s
00:00:00
S
ri Fileth./dirdat/ew000000
Process ID
e 24885
is
g@ usFirst
Log Read Checkpoint

n a e Record RBA 1417


s u jitฺ
g ( GGSCI (AMER)>
a Notice the RBA numbers for both of the Extracts. Write them here:
N
S ujit ____________________
2. On the AMER_WEST_SQLPLUS tab, if SQL*Plus is running, exit and return to the OS prompt.
SQL> exit
[OS_prompt ~]
Then from the ~/labs/Section7/sqlscripts directory, run the transaction generator
by executing the following commands:

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Configuring Change Delivery


Chapter 7 - Page 7
[OS_prompt labs] ls Section7/sqlscripts/
trans_branch.sql
[OS_prompt labs] rlsqlplus west/oracle_4U
@Section7/sqlscripts/trans_branch.sql
SQL*Plus: Release 12.1.0.1.0 Production on Tue Dec 3 07:15:19 2013
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Copyright (c) 1982, 2013, Oracle. All rights reserved.


Last Successful login time: Wed Nov 20 2013 13:46:47 +00:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With Partitioning, OLAP, Advanced Analytics and Real Application Testing
options

'THEBEFORECOUNTFORWEST.BRANCHIS'||COUNT(*)
----------------------------------------------------------------------------
The BEFORE count for west.branch is 40
e to
1 row created.
cens
l i
...many lines omitted for clarity...
a ble
SQL>
fe r
Note the BEFORE count for the BRANCH table.
a n s
3. Return to the AMER_WEST_GGSCI tab and verify the results. n-
t r
Note: The RBA numbers should be increasing for theaExtract,
o
n but the pump should
stabilize.
h a s i d eฺ
GGSCI (AMER)> Info ER * m ) G u
o
ฺc 2013-12-02
e t
n 14:01 Status RUNNING
n
LastoStarted d
s Stu 00:00:01 ago)
EXTRACT EXTWEST
Checkpoint Lag
r i c s00:00:00
24884 is
(updated
Process ID
@ e Oracle th Redo Logs
a g
Log Read Checkpoint
u s e
ji t ฺ n 2013-12-03
SCN
07:05:07 Seqno 234, RBA 26998272
0.5911278 (5911278)
s u
a g ( EXTRACT PWEST Last Started 2013-12-02 14:01 Status RUNNING
N Checkpoint Lag 00:00:00 (updated 00:00:04 ago)

S ujit Process ID 24885


Log Read Checkpoint File ./dirdat/ew000000
First Record RBA 1417

GGSCI (AMER)> !
EXTRACT EXTWEST Last Started 2013-12-02 14:01 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:04 ago)
Process ID 24884
Log Read Checkpoint Oracle Redo Logs
2013-12-03 07:21:49 Seqno 235, RBA 4100096
SCN 0.5912039 (5912039)

EXTRACT PWEST Last Started 2013-12-02 14:01 Status RUNNING


Checkpoint Lag 00:00:00 (updated 00:00:07 ago)
Process ID 24885
Log Read Checkpoint File ./dirdat/ew000000
2013-12-03 07:15:19.000000 RBA 2299

GGSCI (AMER)>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Configuring Change Delivery


Chapter 7 - Page 8
4. On the EURO_EAST_GGSCI tab, view the Replicat statistics by executing the following
commands:
GGSCI (EURO)> Info Replicat reast
REPLICAT REAST Last Started 2013-12-02 14:59 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:07 ago)
Process ID 25935
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Log Read Checkpoint File ./dirdat/pe000000


2013-12-03 07:15:19.000118 RBA 2360

GGSCI (EURO)> Info ER *


REPLICAT REAST Last Started 2013-12-02 14:59 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:00 ago)
Process ID 25935
Log Read Checkpoint File ./dirdat/pe000000
2013-12-03 07:15:19.000118 RBA 2360
e to
GGSCI (EURO)>
cens
l i
Notice that the RBA in EURO is now pretty close to the RBA in AMER.
a ble
5. On the AMER_WEST_GGSCI tab, issue the Info command again. When the RBA value fe r
reported for Log Read Checkpoint calms down (it will never completely stop incrementing),
a ns
n-
Extract has captured all outstanding Redo records. (You can see it "stop" within the 10 t r
no
second info refresh polling window. On a production system, DML to tables other than the
a
h a s ideฺ
ones you are interested in will cause the RBA number to continue to increment.)
GGSCI (AMER)> Info extwest
m ) G u
o
ฺc 2013-12-02
e t
n 14:01 Status RUNNING
EXTRACT EXTWEST
o n
Last Started
s d
tu 00:00:07 ago)
Checkpoint Lag
r i c s00:00:00s S
(updated

hi Redo07:30:08
Process ID 24884

@ e Oracle
Log Read Checkpoint t Logs
a g u s e
2013-12-03 Seqno 235, RBA 4248064

jitฺ n SCN 0.5912346 (5912346)

s u
a g ( EXTRACT PWEST Last Started 2013-12-02 14:01 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:07 ago)
i t N
uj
Process ID 24885
S Log Read Checkpoint File ./dirdat/ew000000
2013-12-03 07:15:19.000000 RBA 2299

GGSCI (AMER)> !
Info extwest

EXTRACT EXTWEST Last Started 2013-12-02 14:01 Status RUNNING


Checkpoint Lag 00:00:00 (updated 00:00:01 ago)
Process ID 24884
Log Read Checkpoint Oracle Redo Logs
2013-12-03 07:30:08 Seqno 235, RBA 4248064
SCN 0.5912346 (5912346)

EXTRACT PWEST Last Started 2013-12-02 14:01 Status RUNNING


Checkpoint Lag 00:00:00 (updated 00:00:02 ago)
Process ID 24885
Log Read Checkpoint File ./dirdat/ew000000
2013-12-03 07:15:19.000000 RBA 2299

GGSCI (AMER)>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Configuring Change Delivery


Chapter 7 - Page 9
If there is any Oracle Redo activity, especially on other tables besides the ones Extract is
monitoring, the RBA value will continue to change, because Extract must read Redo even if
it has no pertinent data to capture.
Execute the following GGSCI command:
GGSCI (AMER)> Lag extwest
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Sending GETLAG request to EXTRACT EXTWEST ...


Last record lag: 2 seconds.
At EOF, no more records to process.

GGSCI (AMER)>
When Extract returns “At EOF, no more records to process,” then Extract has
captured all outstanding redo records.
6. On the AMER_WEST_SQLPLUS tab, execute the following command to get the row counts
e to
for the source BRANCH table:
cens
SQL> set sqlprompt AMER_SQL> l i
AMER_SQL> SELECT count(*) FROM west.branch;
a ble
fe r
COUNT(*)
a ns
----------
n- t r
43
a no
AMER_SQL> h a s ideฺ
m ) matchGtheunumbers above, but it is critical
n ฺ o
It is not critical that your numbers exactly
cthan when
d e nyout started.
that your number be three more
s o start tauSQL*Plus session for the east schema by
stab,
7. On the EURO_EAST_SQLPLUS
executing the following e c
command
s S that rlsqlplus gives you edit history):
ri thi(remember
[OS_prompt
n a g@ u
labs] s e
rlsqlplus east@euro/oracle_4U
j i t ฺ
( s u
If rlsqlplus is already running, then simply connect to the new user:

N ag EURO_SQL> conn east@euro/oracle_4U


S ujit Get the row counts for the BRANCH table:
SQL> set sqlprompt EURO_SQL>
EURO_SQL> SELECT count(*) FROM east.branch;

COUNT(*)
----------
3

EURO_SQL>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Configuring Change Delivery


Chapter 7 - Page 10
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 that this
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

count-mismatch is not a problem and you will get to the initial load in a later practice.
This completes Practice 7-3. Continue now with Practice 7-4.

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Configuring Change Delivery


Chapter 7 - Page 11
Practice 7-4: Stopping Processes and Checking Statistics
Overview
In this practice, you will see the reports that are generated midstream and at the completion of a
replication.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Assumptions
You have successfully completed the previous practices in this lab.

Tasks
1. On the fifth tab (oracle@hostname), use the text browser of your choice, such as more,
less, or gedit, to look at the three reports to see if there are any statistics about rows
processed:
e to
ns
[OS_prompt] more $GG_AMER_HOME/dirrpt/EXTWEST.rpt
[OS_prompt] more $GG_AMER_HOME/dirrpt/PWEST.rpt
l i ce
[OS_prompt] more $GG_EURO_HOME/dirrpt/REAST.rpt
a ble
The reports are interesting (barely) but contain no statistics. This is because the processes fe r
are still running. a ns
n- t r
no
2. On the source AMER_WEST_GGSCI tab, check for statistics:
GGSCI (AMER)> Stats extwest a
s ideฺ
h a
) ...Gu
m
Sending STATS request to EXTRACT EXTWEST
c dent
o
n ฺ
Start of Statistics at 2013-12-03 07:55:47.

so to SWEST.BRANCH:
Output to ./dirdat/ew:
s
Extracting from WEST.BRANCH
i c tu
r i s
e forthclarity...
@
...many lines omitted
agstatistics e
s since 2013-12-03 07:15:22 ***
t ฺ n u
ji Total inserts
*** Latest

(su Total updates


4.00

a g 2.00

i t N Total deletes 1.00

uj
Total discards 0.00
S Total operations
End of Statistics.
7.00

GGSCI (AMER)>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Configuring Change Delivery


Chapter 7 - Page 12
3. On the target EURO_EAST_GGSCI tab, check for statistics:
GGSCI (EURO)> Stats reast
Sending STATS request to REPLICAT REAST ...
Start of Statistics at 2013-12-03 07:58:36.
Replicating from WEST.BRANCH to EAST.BRANCH:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

...many lines omitted for clarity...

*** Latest statistics since 2013-12-03 07:15:33 ***


Total inserts 4.00
Total updates 2.00
Total deletes 1.00
Total discards 0.00
Total operations 7.00
End of Statistics.

GGSCI (EURO)>
e to
These statistics should match the source and the target. cens
l i
4. On the EURO_EAST_GGSCI tab, stop the target processes:
a ble
GGSCI (EURO)> Stop * fe r
a ns
5. On the AMER_WEST_GGSCI tab, stop the source processes:
n- t r
GGSCI (AMER)> Stop *
a no
Note: Stopping with an asterisk does not stop the
h a sManager.
i d eฺ
6. On the fifth tab (oracle@hostname), look m ) the three
at G ureports again to see if there are now
any statistics about rows processed:ฺc o e n t
o n d
r i c ss s Stu
[OS_prompt] more $GG_AMER_HOME/dirrpt/EXTWEST.rpt
[OS_prompt] more
@ e hi
e $GG_AMER_HOME/dirrpt/PWEST.rpt
t
[OS_prompt]
t ฺ n ag more u s$GG_EURO_HOME/dirrpt/REAST.rpt
Instead
( s ujofi more, you can use any text editor or less. The reports now contain plenty of
a gstatistics. Find the section that has similar statistics as the Stats command gave:
N
ujit
***********************************************************************
S Oracle GoldenGate Capture for Oracle
Version 12.1.2.0.0 17185003 OGGCORE_12.1.2.0.0_PLATFORMS_130924.1316_FBO
Linux, x64, 64bit (optimized), Oracle 12c on Sep 25 2013 02:47:30
Copyright (C) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
Starting at 2013-12-02 14:01:16
***********************************************************************
...many lines omitted for clarity...
***********************************************************************
* ** Run Time Statistics ** *
***********************************************************************
Report at 2013-12-03 08:01:23 (activity since 2013-12-03 07:15:22)
Output to ./dirdat/ew:
From Table WEST.BRANCH:
# inserts: 4
# updates: 2
# deletes: 1
# discards: 0
...many lines omitted for clarity...
Each of the three reports contains slightly different information, but all three should contain
the above common statistics.
This completes Practice 7-4. This completes the practices for Lesson 7. Stop here.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Configuring Change Delivery


Chapter 7 - Page 13
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 7: Configuring Change Delivery


Chapter 7 - Page 14
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a n s
Practices for n t r
-Lesson 8:
n o
Extract s aTraileฺand Files
) a
h 8 uid
ฺ c om ent G
Chapter

s s on tud
e ric this S
n a g@ use
u jitฺ
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 8: Extract Trail and Files


Chapter 8 - Page 1
Practices for Lesson 8: Overview
Practices Overview
In this practice, you will be able to use the logdump utility to look at records in an Oracle
GoldenGate trail file.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

In this practice, 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

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 8: Extract Trail and Files


Chapter 8 - Page 2
Practice 8-1: Using the logdump Utility

Tasks
1. On the AMER_WEST_GGSCI tab, exit to the OS prompt, navigate to the source installation
directory $GG_AMER_HOME, and invoke logdump:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

GGSCI (AMER)> Exit


[OS_prompt gg_amer] pwd
/u01/app/oracle/product/gg_amer
[OS_prompt gg_amer] ./logdump
Oracle GoldenGate Log File Dump Utility for Oracle
Version 12.1.2.0.0 17185003 OGGCORE_12.1.2.0.0_PLATFORMS_130924.1316
Copyright (C) 1995, 2013, Oracle and/or its affiliates. All rights reserved.

e to
Logdump 1 > help
cens
Issue the help command to display a list of all commands available in logdump. Similar to l i
GGSCI, there is no good way to make help or any other command pause.
a ble
fe r
2. In logdump, open the <install_path>/dirdat/<trail_id>000000 trail file: (Verify
a n s
the name of the trail file in the dirdat directory.)
n- t r
Logdump 2 > open dirdat/ew000000
a no
Current LogTrail is
h a s ideฺ
)
/u01/app/oracle/product/gg_amer/dirdat/ew000000
m G u
o
ฺc den t
Identifying the File Headers
o n tu
3. View the first record. Useic
r ssn (next)
the
s S
command:
Logdump 3 @ > ne
e t hi
t ฺ n ag us
s u ji
2013/12/02 14:01:18.018.941 FileHeader Len 1409 RBA 0
g ( Name: *FileHeader*

jit Na 3000 030c 3000 0008 4747 0d0a 544c 0a0d 3100 0002 | 0...0...GG..TL..1...
Su 0004
a17d
3200
3400
0004
0037
2000
0035
0000
7572
3300
693a
0008
4544
02f2
5253
12c1
5232
11e4
3650
|
|
..2... ...3.........
.}4..7.5uri:EDRSR26P
313a 3a75 3031 3a61 7070 3a6f 7261 636c 653a 7072 | 1::u01:app:oracle:pr
6f64 7563 743a 6767 5f61 6d65 723a 4558 5457 4553 | oduct:gg_amer:EXTWES
5436 0000 1300 112e 2f64 6972 6461 742f 6577 3030 | T6....../dirdat/ew00
3030 3030 3700 0001 0138 0000 0400 0000 0039 ff00 | 00007....8.......9..

Logdump 4 >
Note that this is the trail file header record.
4. Turn on the FILEHEADER ON option and view the record again:
Logdump 4 > fileheader on
Logdump 5 > pos 0
Reading forward from RBA 0
Logdump 6 > n
Scroll down and notice how you can view the detail on the trail, the machine being used,
the Extract that produced the trail, the database information, and so on.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 8: Extract Trail and Files


Chapter 8 - Page 3
... Many lines omitted for clarity ...

GroupID x31 '1' MachineInfo Info x00 Length 114


3100 0072 3000 0007 0005 4c69 6e75 7831 0000 0b00 | 1..r0.....Linux1....
0945 4452 5352 3236 5031 3200 001f 001d 322e 362e | .EDRSR26P12.....2.6.
3339 2d32 3030 2e32 342e 312e 656c 3675 656b 2e78 | 39-200.24.1.el6uek.x
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

3836 5f36 3433 0000 2500 2323 3120 534d 5020 5361 | 86_643..%.##1 SMP Sa
7420 4a75 6e20 3233 2030 323a 3339 3a30 3720 4544 | t Jun 23 02:39:07 ED
5420 3230 3132 3400 0008 0006 7838 | T 20124.....x8

GroupID x32 '2' DatabaseInfo Info x00 Length 360


3200 0168 3000 0002 0007 3100 0006 0004 414d 4552 | 2..h0.....1.....AMER
3200 0006 0004 616d 6572 3300 0004 0000 0000 3400 | 2.....amer3.......4.
0002 000c 3500 0002 0001 3600 00e7 00e5 4f72 6163 | ....5.....6.....Orac
e to
ns
6c65 2044 6174 6162 6173 6520 3132 6320 456e 7465 | le Database 12c Ente
7270 7269 7365 2045 6469 7469 6f6e 2052 656c 6561 | rprise Edition Relea
l i ce
7365 2031 322e 312e 302e 312e 3020 2d20 3634 6269
le
| se 12.1.0.1.0 - 64bi
a b
7420 5072 6f64 7563 7469 6f6e 0a50 4c2f 5351 4c20
r
| t Production.PL/SQL
fe
5265 6c65 6173 6520 3132 2e31 2e30 2e31 2e30 202d
ns
| Release 12.1.0.1.0 -
a
2050 726f 6475 6374 696f 6e0a 434f 5245 0931 322e
n- t r
| Production.CORE.12.
312e 302e 312e 3009 5072 6f64
a no 7563 7469 6f6e 0a54 | 1.0.1.0.Production.T
4e53 2066 6f72
6e20 3132 2e31
204c 696e 7578
2e30 2e31 2e30
h a s ideฺ 3a20 5665 7273 696f
202d 2050 726f 6475
| NS for Linux: Versio
| n 12.1.0.1.0 - Produ
m ) G u
6374 696f 6e0a 4e4c 5352 544c
o
ฺc den t 2056 6572 7369 6f6e | ction.NLSRTL Version
2031 322e 312e
o n
302e 312e 3020 2d20 5072 6f64 7563 | 12.1.0.1.0 - Produc
7469 6f6e 0a37
r i c ss s Stu
0000 0440 0000 0038 0000 0c00 0a31 | tion.7...@...8.....1
322e 312e 302e
@ e
e t hi
312e 3039 0000 0400 0000 013a 0000 | 2.1.0.1.09.......:..

g us
0200 003b 0000 0400 0000 013c 0000 1400 0000 1014 | ...;.......<........

uj ti ฺna
1414 1414 1414 1414 1414 1411 1414 143d 0000 0500 | ...............=....

( s
g ... Many
Na
lines omitted for clarity ...
jit
Su Using the Head and Detail Attributes when Displaying a Record
5. View the first next record:
Logdump 7 > n

2013/12/03 07:15:19.000.000 Insert Len 28 RBA 1417


Name: WEST.BRANCH
After Image: Partition 4 G b
0000 000a 0000 0000 0000 0000 0064 0001 000a 0000 | .............d......
0000 0000 0000 292f | ......)/

Logdump 8 >
This is a standard trail record. A database type of NUMBER is not as easily readable as a
CHAR or VARCHAR. If you are curious, this record is the line
INSERT INTO west.branch VALUES (100, 10543);
from the previous lab’s trans_branch.sql, the “0064” in hex is the branch_number
100 in decimal, and “292f” in hex above equals 10543 in decimal (the new branch_zip).
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 8: Extract Trail and Files


Chapter 8 - Page 4
6. Position back to RBA 0 in the file, set the header and detail attributes to on, and view the
same trail record again. (Make sure you do next or n twice.)
Logdump 8 > pos 0
Reading forward from RBA 0
Logdump 9 > ghdr on
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Logdump 10 > detail on


Logdump 11 > n
Logdump 12 > n

___________________________________________________________________
Hdr-Ind : E (x45) Partition : . (x04)
UndoFlag : . (x00) BeforeAfter: A (x41)
RecLength : 28 (x001c) IO Time : 2013/12/03 07:15:19.000.000
e to
IOType : 5 (x05) OrigNode : 255 (xff)

cens
TransInd : . (x00) FormatType : R (x52)
l i
SyskeyLen : 0 (x00) Incomplete : . (x00)
a ble
AuditRBA : 235 AuditPos : 4057616
fe r
Continued : N (x00) RecCount : 1 (x01)
a ns
n- t r
2013/12/03 07:15:19.000.000 Insert Len
a no
28 RBA 1417
Name: WEST.BRANCH
h a s ideฺ
After Image:
) u Partition 4 G b

ฺ c om ent G
0000 000a 0000 0000 0000 0000 0064 0001 000a 0000 | .............d......

on tud
0000 0000 0000 292f | ......)/

s s
ric this S
Column 0 (x0000), Len 10 (x000a)
Column
e
1 (x0001), Len 10 (x000a)

n a g@ use
u j itฺ
Logdump >
s
gNote( the difference in the display from the output in the last step. (The trail record header
N a area and detail on the columns have been added to the display.)
S ujit Exit logdump.
7. Restart logdump. Notice that the history and the last prompt number is preserved in
~/logdump.hst, but the session information (for example, which trail file) is not preserved. That
is, you can display the commands you ran last session to open a trail file, but the file is not currently
opened. Prove this by entering next. Exit logdump again.
8. For more information about the logdump utility, which reference manual would you use?
___________________________ (Hint: Look in ~/Documents).
This completes Practice 8-1. This completes the practices for Lesson 8. Stop here.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 8: Extract Trail and Files


Chapter 8 - Page 5
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 8: Extract Trail and Files


Chapter 8 - Page 6
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a n s
Practices for n t r
-Lesson 9:
n o
a eฺInitial Load
Configuring
s
) a
h 9 uid
ฺ c om ent G
Chapter

s s on tud
e ric this S
n a g@ use
u jitฺ
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Configuring Initial Load


Chapter 9 - Page 1
Practices for Lesson 9: Overview
Practices Overview
In these practices, you will set up the initial load of data by using two different methods:
• File to Replicat
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

• Direct Load

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, 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:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

• Configure a task to load the initial data from two source tables: ACCOUNT and BRANCH
• Configure the delivery of the data to the target
• Execute the initial load of 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.

Big Picture
e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
N a
S ujit
The Extract naming convention is eftor (Extract File To Replicat).

Tasks
1. GGSCI for the source was stopped in the previous logdump lab. Start GGSCI on the
AMER_WEST_GGSCI tab. Configure the initial load Extract parameter file by executing the
following commands on the source system to create an Extract named eftor:
[OS_prompt gg_amer] rlggsci
GGSCI (AMER) 1> DBLogin UserIDAlias gguamer
GGSCI (AMER) 2> Set Editor gedit
GGSCI (AMER) 3> Edit Param eftor

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Configuring Initial Load


Chapter 9 - Page 3
The editor of your choice opens the eftor.prm file. Add the following runtime parameters
to the text file:
SourceIsTable
UserIDAlias gguamer
RmtHost easthost, MgrPort 15001
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

RmtFile ./dirdat/ACCOUNT.DAT, Purge


Table WEST.ACCOUNT;
RmtFile ./dirdat/BRANCH.DAT, Purge
Table WEST.BRANCH;
Save and close the file.
2. On the fifth tab, oracle@hostname, execute the initial load capture process by starting the
initial load Extract directly at a shell prompt from the source installation directory by using
the following command (all on one line, and all lowercase): e to
[OS_prompt] cd $GG_AMER_HOME
cens
l i
[OS_prompt gg_amer] ./extract paramfile dirprm/eftor.prm
a ble
reportfile dirrpt/eftor.rpt
fe r
[OS_prompt gg_amer]
a ns
Notes n- t r
a no
• There is no message returned to the command line, neither good nor bad. That
information is in the source report.
h a s ideฺ
m ) G u
• If for any reason you need to rerun the extract (for example, you made a mistake), a
o
ฺc den t
n
new report will not overlay the old one. You must first delete the old report, and then
o
rerun the extract.
r i c ss s Stu
3. e hi
To view the report, navigate to the AMER dirrpt directory and execute the following
@ e t
commands: g us
uj ti ฺna
[OS_prompt gg_amer] more dirrpt/eftor.rpt
( s
g 2013-12-03 11:59:43
Na
INFO OGG-02095 Successfully set environment variable

jit
ORACLE_SID=amer.

Su ***********************************************************************
Oracle GoldenGate Capture for Oracle
Version 12.1.2.0.0 17185003 OGGCORE_12.1.2.0.0_PLATFORMS_130924.1316_FBO
Linux, x64, 64bit (optimized), Oracle 12c on Sep 25 2013 02:47:30
Copyright (C) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
Starting at 2013-12-03 11:59:43
***********************************************************************

Operating System Version: Linux


Version #1 SMP Sat Jun 23 02:39:07 EDT 2012, Release 2.6.39-
200.24.1.el6uek.x86_64
Node: HOSTNAME
Machine: x86_64
--More--(37%)

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Configuring Initial Load


Chapter 9 - Page 4
4. 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 2013-12-03 11:59:51 (activity since 2013-12-03 11:59:45)


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Output to ./dirdat/ACCOUNT.DAT:

From Table WEST.ACCOUNT:


# inserts: 1000
# updates: 0
# deletes: 0
# discards: 0

Output to ./dirdat/BRANCH.DAT:

From Table WEST.BRANCH:


e to
# inserts: 43
cens
# updates: 0
l i
#
#
deletes:
discards:
0
0
a ble
fe r
REDO Log Statistics
a ns
Bytes parsed 0
n- t r
no
Bytes output 95618

a
s ideฺ
[OS_prompt gg_amer]
h a
) table; itGputu them in a remote file. You can see
Note: This did not put the rows in the remote
m
c dent
o
some of it by entering:
[OS_prompt gg_amer]so n ฺ
stringstu$GG_EURO_HOME/dirdat/ACCOUNT.DAT
s
5. On the EURO_EAST_GGSCI e c is S should still be running. Configure the initial load
ri tab,thGGSCI
delivery parameter
n a g@ e
file by executing
u s the following commands on the target system:

s u jitfileฺ name
a. Configure the data load parameters for ACCOUNT by executing the following command:

g ( GGSCI (EURO)>
(The starts with a lowercase L as in “load account.”)

N a Edit Param lacct


uj i t Your editor of choice opens the empty lacct.prm file. Add the following runtime
S parameters to the text file:
SpecialRun
End Runtime
UserIDAlias ggueuro
AssumeTargetDefs
ExtFile ./dirdat/ACCOUNT.DAT
Map WEST.ACCOUNT, Target EAST.ACCOUNT;
Save and close the file.
b. On the EURO_EAST_GGSCI tab, repeat this process for the BRANCH Initial Load
parameter file:
GGSCI (EURO)> Edit Param lbranch
Your editor of choice opens the empty lbranch.prm file. Add the following runtime
parameters to the text file:

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Configuring Initial Load


Chapter 9 - Page 5
SpecialRun
End Runtime
UserIDAlias ggueuro
HandleCollisions
AssumeTargetDefs
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

ExtFile ./dirdat/BRANCH.DAT
Map WEST.BRANCH, Target EAST.BRANCH;
Note: This differs from the lacct file in that it has HandleCollisions (that is,
“ignore duplicates”) to accommodate the three pre-existing rows from the previous lab.
Save and close the file. Leave GGSCI running.
6. On the fifth tab, oracle@hostname, execute the Initial Load delivery process by executing
the following commands at the shell prompt from the target installation directory (each
Replicat all on one line, and all lowercase): e to
[OS_prompt gg_amer] cd $GG_EURO_HOME
cens
l i
[OS_prompt gg_euro] ./replicat paramfile dirprm/lacct.prm
a ble
reportfile dirrpt/lacct.rpt
fe r
[OS_prompt gg_euro] ./replicat paramfile dirprm/lbranch.prm
a ns
reportfile dirrpt/lbranch.rpt
n- t r
[OS_prompt gg_euro]
a no
Notes
h a s ideฺ
• There is no message returned to m the)command G uline, neither good nor bad. That
o
ฺc den t
• If for any reason yousneed
n
information is in the target report.
o
s to rerun tuthe replicat (for example, you made a mistake), a
new report wille ricoverlay i s S
@ se
not
rerun thegreplicat. t h the old one. You must first delete the old report, and then

t ฺ n a anduthen verify the results in the target report files:


u j i
Wait for ten seconds
( s
[OS_prompt gg_euro] more dirrpt/lacct.rpt
N ag [OS_prompt gg_euro] more dirrpt/lbranch.rpt
jit
Su

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Configuring Initial Load


Chapter 9 - Page 6
Results from lacct.rpt:
... Many lines omitted for clarity ...
2013-12-03 11:59:51.502486 Insert Len 28 RBA 93026
Name: WEST.ACCOUNT
___________________________________________________________________
Reading ./dirdat/ACCOUNT.DAT, current RBA 93117, 1000 records
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Report at 2013-12-03 12:23:55 (activity since 2013-12-03 12:23:55)


From Table WEST.ACCOUNT to EAST.ACCOUNT:
# inserts: 1000
# updates: 0
# deletes: 0
# discards: 0

Last log location read:


FILE: ./dirdat/ACCOUNT.DAT
e to
RBA: 93117
cens
TIMESTAMP: 2013-12-03 11:59:51.502486 l i
EOF: NO
a ble
fe r
READERR: 400
a ns
... Many lines omitted for clarity ...
n- t r
The number of inserts should be 1000.
a no
Results from lbranch.rpt:
h a s ideฺ
m
... Many lines omitted for clarity ... ) G u
o t
ฺc den Len 28 RBA 5148
n
2013-12-03 11:59:51.575484 Insert
o
Name: WEST.BRANCH
r i c ss s Stu
@ e
e t hi current RBA 5238, 43 records
___________________________________________________________________

g us12:24:08 (activity since 2013-12-03 12:24:08)


Reading ./dirdat/BRANCH.DAT,
Report ata2013-12-03
n
t ฺ
Fromji Table WEST.BRANCH to EAST.BRANCH:

g (su # inserts: 43
N a
uj i t # updates: 0

S #
#
deletes:
discards:
0
0
# insert collisions: 3

Last log location read:


FILE: ./dirdat/BRANCH.DAT
RBA: 5238
TIMESTAMP: 2013-12-03 11:59:51.575484
EOF: NO
READERR: 400

... Many lines omitted for clarity ...


The number of inserts should be 40 or 43, depending on how you think about the collisions.
This completes Practice 9-1. Continue now with Practice 9-2.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Configuring Initial Load


Chapter 9 - Page 7
Practice 9-2: Setting Up the Initial Data Load by Using the Direct Load
Method
Overview
In this practice, you will configure:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

• A task to load the initial data from all of the source tables
• The delivery of the data to the target

Big Picture

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u j ti ฺna
g ( s
Assumptions
N athis
ujit An Extract Task is a special process that, once started, reads from each source table row by
For practice, target database instantiation will be performed via Oracle GoldenGate tasks.
S row. This data is transmitted to the Replicat task on the target that inserts each row of data into
the empty database tables. The Task will automatically shut down once all rows are read,
transmitted, and inserted.
This exercise assumes that:
• SQL*Plus is still running on the EURO_EAST_SQLPLUS tab. If not, start it by using
rlsqlplus.
• GGSCI is still running in both the AMER_WEST_GGSCI and EURO_EAST_GGSCI tabs. If
not, start it with rlggsci, and then:
DBLogin UserID gguser, Password oracle_4U

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Configuring Initial Load


Chapter 9 - Page 8
Tasks
1. Truncate the target ACCOUNT and BRANCH tables.
Note: This exercise assumes that you have completed an initial data load by using the File
to Replicat method. If this is not the case, you may skip to step 2.
Execute the following commands on the target system EURO_EAST_SQLPLUS tab:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

SQL> conn east@euro/oracle_4U


Connected.
SQL> set sqlprompt EURO_SQL>
EURO_SQL> TRUNCATE TABLE account;
Table truncated.

EURO_SQL> TRUNCATE TABLE branch;


Table truncated.
e to
cens
EURO_SQL> COMMIT; l i
Commit complete.
a ble
fe r
a ns
EURO_SQL>
n- t r
2.
no
To add the initial load capture batch task group, on the source system AMER_WEST_GGSCI
a
h a s ideฺ
tab, in the installation directory, execute the following command:
)file by executing
GGSCI (AMER)> Add Extract eini, SourceIsTable
m G u the following command on the
o
c den
3. Configure the initial load capture parameter
ฺtab: t
source system AMER_WEST_GGSCI o n tu
GGSCI (AMER)> Edit
r i c ssParams Seini
The editor of your @ e opensththei empty eini.prm file. Add the following runtime
parameters ntoa
choice
g text file:
u s e
jitฺ eini
the
s u
Extract
a g ( RmtHost easthost, MgrPort 15001
N
S ujit RmtTask Replicat, Group rini
UserIDAlias gguamer
Table WEST.*;
Save and close the file.
4. Add the initial load delivery batch task by executing the following command on the target
system EURO_EAST_GGSCI tab:
GGSCI (EURO)> Add Replicat rini, SpecialRun

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Configuring Initial Load


Chapter 9 - Page 9
5. Configure the initial load delivery parameter file by executing the following command on the
target database EURO_EAST_GGSCI tab:
GGSCI (EURO) > Edit Param rini
The editor of your choice opens the empty rini.prm file. Add the following runtime
parameters to the text file:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Replicat rini
AssumeTargetDefs
UserIDAlias ggueuro
DiscardFile ./dirrpt/rini.dsc, Purge
Map WEST.*, Target EAST.*;
Save and close the file.
6. On the AMER_WEST_GGSCI tab, execute the initial load process in the source system:
e to
ns
GGSCI (AMER)> Start Extract eini
Sending START request to MANAGER ... l i ce
EXTRACT EINI starting
a ble
fe r
GGSCI (AMER)>
a n s
Note that Start * will not start this kind of an initial load; you n r
t to name it explicitly.
-need
o
n commands:
7. This task displays differently than other Extracts. Enter
s a the eฺ
GGSCI (AMER)> Info All
) h a u i d
GGSCI (AMER)> Info Extract o m* t G
o n ฺc einid e n
GGSCI (AMER)> Info Extract
i c ss s Snot tu
Notice that this initial load r
e Info t h i Extract
Extract does show up in Info All, nor Info with an
asterisk, but does @ e completed). If youeini.
n a g show up in
u s It will show with a Status of STOPPED
(which means
j i t ฺ that it is already are very fast, you may briefly see
s
Status
( u STARTING.
N ag
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Configuring Initial Load


Chapter 9 - Page 10
8. On the target EURO_EAST_GGSCI tab, view the report by executing the following command:
GGSCI (EURO)> View Report rini
... Many lines omitted for clarity ...
***********************************************************************
* ** Run Time Statistics ** *
***********************************************************************
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Report at 2013-12-03 13:48:06 (activity since 2013-12-03 13:48:00)

From Table WEST.ACCOUNT to EAST.ACCOUNT:


# inserts: 1000
# updates: 0
# deletes: 0
# discards: 0
From Table WEST.BRANCH to EAST.BRANCH:
e to
# inserts: 43
cens
# updates: 0
l i
# deletes: 0
a ble
# discards: 0
fe r
From Table WEST.TELLER to EAST.TELLER:
a ns
# inserts: 800
n- t r
# updates: 0
a no
# deletes: 0
h a s ideฺ
# discards:
m ) 0
G u
... Many lines omitted for n
o
ฺc ... e n t
o clarity
d
tuthe initial load.
Make a note of the number
r i c ssinsertss from
of S
@
Note: If you entered e Tables
List
e t hi WEST.* on the source AMER_WEST_GGSCI tab, you
g areusixs tables, but only three of them came over in the initial load, the
would see thatathere
n
t ฺ
uji had rows in them. The other three tables, ACCOUNT_TRANS, TELLER_TRANS,
three that
and(s
agexamined by Oracle GoldenGate and then wisely ignored; they do not show up in the
BRANCH_ATM existed on source and target, but were empty. The truncated tables are

jit N
Su
statistics, nor in the report.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Configuring Initial Load


Chapter 9 - Page 11
9. On the source database AMER_WEST_SQLPLUS tab, verify that the count for the tables
matches: (The numbers should match in both databases.)
AMER_SQL> SELECT count(*) FROM account;

COUNT(*)
----------
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

1000

AMER_SQL> SELECT count(*) FROM branch;

COUNT(*)
----------
43

AMER_SQL> SELECT count(*) FROM teller;


e to
COUNT(*)
cens
---------- l i
800
a ble
and then on the target database EURO_EAST_SQLPLUS tab: fe r
a ns
EURO_SQL> SELECT count(*) FROM account;
n- t r
COUNT(*)
a no
----------
h a s ideฺ
1000
m ) G u
o t
ฺc FROMdebranch;
n
EURO_SQL> SELECT count(*)
o n
r i c ss s Stu
COUNT(*)
----------@e
e t hi
n g us
a43
t ฺ
( s uji
EURO_SQL> SELECT count(*) FROM teller;
ag
N
ujit
COUNT(*)
S ----------
800
Leave SQL*Plus running.
10. Because you will not need the initial load process groups again, delete them from both
Oracle GoldenGate instances. To unregister them from the databases, GGSCI needs to be
logged in to the databases. There is no harm if you log in to the database more than once.
On the source AMER_WEST_GGSCI tab:
GGSCI (AMER)> DBLogin UserIDAlias gguamer
GGSCI (AMER)> Delete Extract eini
On the target EURO_EAST_GGSCI tab:
GGSCI (EURO)> DBLogin UserIDAlias ggueuro
GGSCI (EURO)> Delete Replicat rini
This completes Practice 9-2. Continue now with Practice 9-3.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Configuring Initial Load


Chapter 9 - Page 12
Practice 9-3: Putting it All Together
Overview
In this practice, you will restart the Extract and Replicat from earlier practices, and run a
transaction generator to verify that all the data flows from source tables to target tables.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Assumptions
• You successfully completed the previous practices.
• The source and target tables in the WEST and EAST schemas are now identical as a
result of the successful initial load.
• GGSCI and SQL*Plus are all running on both source and targets.
• DBLogin is still in effect on both GGSCI sessions.

e to
ns
Tasks
1. On the source system AMER_WEST_GGSCI tab, start all the processes and make sure they
l i ce
are all running:
a ble
GGSCI (AMER)> Start ER * fe r
a n s
Sending START request to MANAGER ...
n- t r
EXTRACT EXTWEST starting
a no
Sending START request to MANAGER ...
h a s ideฺ
EXTRACT PWEST starting
m ) G u
GGSCI (AMER)> Info Allnฺc
o e n t
o d
Statusric
ssGroups Stu Lag at Chkpt Time Since Chkpt
Program
@ e
e t hi
MANAGER
g us EXTWEST 00:00:00
RUNNING
EXTRACTna RUNNING
j i t ฺ 00:00:05

( s u
EXTRACT RUNNING PWEST 00:01:00 00:00:02

ag GGSCI (AMER)>
N
S ujit 2. On the target system EURO_EAST_GGSCI tab, start all the processes and make sure they
are all running:
GGSCI (EURO)> Start ER *
Sending START request to MANAGER ...
REPLICAT REAST starting

GGSCI (EURO)> Info All


Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING REAST 00:00:00 00:00:05

GGSCI (EURO)>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Configuring Initial Load


Chapter 9 - Page 13
3. On the source AMER_WEST_SQLPLUS tab, from ~/labs/Section9/sqlscripts, run the
transaction generator as the owner of the source schema:
AMER_SQL> show user
USER is "WEST"
AMER_SQL>
@/home/oracle/labs/Section9/sqlscripts/trans_generator.sql
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

PL/SQL procedure successfully completed.

Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -


64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
[OS_prompt sqlscripts]
The PL/SQL procedure takes a few seconds to complete.
e to
4. Make sure that your Oracle GoldenGate processes are still running.
cens
l i
 On the source system GGSCI, gather information:
a ble
GGSCI (AMER)> !
fe r
Info All
a n s
n r
-t Since Chkpt
Program Status Group
o
Lag at Chkpt Time
n
MANAGER RUNNING
s a ฺ
e00:00:01
EXTRACT RUNNING EXTWEST
h a
00:00:00
i d
)00:00:00Gu 00:00:00
EXTRACT RUNNING PWEST
m
c dent
o
n ฺ
GGSCI (AMER)>
c s sogatherSinformation:
tu
i
 On the target systemrGGSCI,
e! hi s
@ e t
t ฺ n ag us
GGSCI (EURO)>

uji
Info All

g ( s
Program Status Group Lag at Chkpt Time Since Chkpt
N a MANAGER RUNNING

S ujit REPLICAT RUNNING REAST 00:00:00 00:00:04

GGSCI (EURO)>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Configuring Initial Load


Chapter 9 - Page 14
5. Examine the row count on both the source and the target tables:
a. On the source database AMER_WEST_SQLPLUS tab:
[OS_prompt labs] rlsqlplus west@amer/oracle_4U
SQL*Plus: Release 12.1.0.1.0 Production on Wed Dec 4 07:58:18 2013
SQL> set sqlprompt AMER_SQL>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

AMER_SQL> SELECT count(*) FROM account;


COUNT(*)
----------
1060

AMER_SQL> SELECT count(*) FROM account_trans;


COUNT(*)
----------
1500

AMER_SQL> SELECT count(*) FROM teller_trans;


e to
ns
COUNT(*)

ce
----------
559
l i
a ble
AMER_SQL> SELECT count(*) FROM branch_atm;
fe r
COUNT(*)
----------
a ns
563
n- t r
AMER_SQL>
a no
a
b. On the target database EURO_EAST_SQLPLUS tab:
h s ideฺ
[OS_prompt labs] rlsqlplus m ) G u
east@euro/oracle_4U
SQL*Plus: Release 12.1.0.1.0 ฺc o e t
non Wed Dec 4 07:58:18 2013
o n Production
d
SQL> set sqlprompt s
r i c s s Stu
EURO_SQL>
EURO_SQL> SELECT
COUNT(*) g@
e count(*)
e thi FROM account;
1060jitฺn
----------a us
g (su
EURO_SQL> SELECT count(*) FROM account_trans;
Na
ujit
COUNT(*)
----------
S 1500

EURO_SQL> SELECT count(*) FROM teller_trans;


COUNT(*)
----------
559

EURO_SQL> SELECT count(*) FROM branch_atm;


COUNT(*)
----------
563

EURO_SQL>
Source and target row counts should match. Your numbers may be slightly different. (There
is a random number generator as part of the transaction generator function.)

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Configuring Initial Load


Chapter 9 - Page 15
6. Examine the statistics. Five of the six tables had activity:
a. On the source system, on the AMER_WEST_GGSCI tab, gather statistics:
GGSCI (AMER)> Stats pwest
Sending STATS request to EXTRACT PWEST ...
Start of Statistics at 2013-12-04 12:55:44.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Output to ./dirdat/pe:

Extracting from WEST.ACCOUNT_TRANS to WEST.ACCOUNT_TRANS:


*** Total statistics since 2013-12-04 12:11:20 ***
Total inserts 1500.00

Extracting from WEST.BRANCH_ATM to WEST.BRANCH_ATM:


*** Total statistics since 2013-12-04 12:11:20 ***
Total inserts 563.00
e to
cens
Extracting from WEST.ACCOUNT to WEST.ACCOUNT:
l i
*** Total statistics since 2013-12-04 12:11:20 ***
a ble
Total inserts 60.00
fe r
a n s
t r
on-
Extracting from WEST.TELLER_TRANS to WEST.TELLER_TRANS:
*** Total statistics since 2013-12-04 12:11:20 n ***
s a 559.00
eฺ
Total inserts
) h a u i d
Extracting from WEST.BRANCH to o m t G
*** Total statistics since n
o ฺc de12:11:20
n
WEST.BRANCH:

s s S t u
2013-12-04 ***
Total deletes
e r i c i s 3.00
...many lines have
g @
been
e th
omitted for clarity...

a
ฺnStatistics.u s
j
End of
u i t
g ( s
N a GGSCI (AMER)>

S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Configuring Initial Load


Chapter 9 - Page 16
b. On the target system, on the EURO_EAST_GGSCI tab, gather statistics:
GGSCI (EURO)> Stats reast
Sending STATS request to REPLICAT REAST ...
Start of Statistics at 2013-12-04 12:59:20.

Replicating from WEST.ACCOUNT_TRANS to EAST.ACCOUNT_TRANS:


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

*** Total statistics since 2013-12-04 12:11:22 ***


Total inserts 1500.00

Replicating from WEST.BRANCH_ATM to EAST.BRANCH_ATM:


*** Total statistics since 2013-12-04 12:11:22 ***
Total inserts 563.00

Replicating from WEST.ACCOUNT to EAST.ACCOUNT:


e to
*** Total statistics since 2013-12-04 12:11:22 ***
cens
Total inserts 60.00
l i
a ble
Replicating from WEST.TELLER_TRANS to EAST.TELLER_TRANS:
fe r
*** Total statistics since 2013-12-04 12:11:22 ***
a ns
Total inserts 559.00
n- t r
a no
Replicating from WEST.BRANCH to EAST.BRANCH:
h a s ideฺ
) u
*** Total statistics since 2013-12-04 12:11:22 ***
m G
Total deletes
o
ฺc den t 3.00

o n
...many lines have been omitted for clarity...

r i c ss s Stu
End of Statistics.
@ e
e t hi
t ฺ n ag us
s ji
GGSCI
uthat
(EURO)>

g (
Notice data pump pwest is from WEST to WEST, but the Replicat reast is from WEST
Na to EAST. Also notice that the Replicat is lagging 2 seconds behind the pump. Your counts
S ujit and times may be slightly different; the important thing is that source WEST matches target
EAST.
This completes Practice 9-3. Continue now with Practice 9-4.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Configuring Initial Load


Chapter 9 - Page 17
Practice 9-4: Converting from Classic Mode to Integrated Mode
Overview
The process for converting the Extract and Replicat from Classic Mode to Integrated Mode is
slightly different on a production database than on a test or development database due to the
lack of other log traffic. On the classroom one-CPU machines, you will not be able to see
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

anything very different.

Assumptions
• The Extract, Data Pump, and Replicat are all working from the previous lab
• No other practice depends on this conversion being completed; it is, therefore,
optional.

Tasks
e to
1. Register the Extract with the database. On the AMER_WEST_GGSCI tab, enter:
cens
l i
GGSCI (AMER)> Stop extwest
a ble
Sending STOP request to EXTRACT EXTWEST ...
fe r
Request processed.
a ns
n- t r
no
GGSCI (AMER)> Register Extract extwest Database
a
h a s ideฺ
Extract EXTWEST successfully registered with database at SCN 5988879.

GGSCI (AMER)> Start extwestm


) G u
EXTRACT EXTWEST starting nฺc
o e n t
o d
r i c ss s Stu
GGSCI (AMER)>e
@ e t hi
Your SCN willa
n gdifferent.
be u s
t ฺ
ji database AMER_WEST_SQLPLUS tab, enter the following DML:
2. On theusource
( s
N ag AMER_SQL> INSERT INTO west.account VALUES (7000,7000);
S ujit AMER_SQL> COMMIT;
AMER_SQL> INSERT INTO west.account VALUES (8000,8000);
AMER_SQL> COMMIT;
The goal is to create some database traffic to increase the SCN value from what it was
when the Extract was registered. In a busy production environment, this would happen from
other traffic automatically.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Configuring Initial Load


Chapter 9 - Page 18
3. On the target database EURO_EAST_SQLPLUS tab, enter the following query:
EURO_SQL> SELECT * FROM east.account
WHERE account_number > 6000;

ACCOUNT_NUMBER ACCOUNT_BALANCE
-------------- ---------------
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

7000 7000
8000 8000
This just makes sure that the GGSCI processes are still working.
4. You want to convert the target process before you convert the source process. On the
target system EURO_EAST_GGSCI tab, enter the following commands:
GGSCI (EURO)> Stop reast
Sending STOP request to REPLICAT REAST ...
e to
Request processed.
cens
l i
GGSCI (EURO)> Alter Replicat reast, Integrated
a ble
REPLICAT (Integrated) altered.
fe r
a ns
GGSCI (EURO)> n- t r
NOTE: Do not restart it yet! a no
5. h a s ideฺ
When all GGSCI processes are stopped, convert the source Extract (not the data pump).
m ) G u
o
ฺc den t
On the source system AMER_WEST_GGSCI tab, enter the following commands:
GGSCI (AMER)> Stop extwest
o n tu ...
Sending STOP requestcs tosEXTRACTS
e r i hi s EXTWEST
Request processed.
@ e t
t ฺ n ag Alteru s
s u ji
GGSCI (AMER)> Extract extwest, Upgrade Integrated TranLog

ag ( Extract EXTWEST successfully upgraded to integrated capture.


N
S ujit GGSCI (AMER)> Start *
Sending START request to MANAGER ...
EXTRACT EXTWEST starting
EXTRACT PWEST is already running.

GGSCI (AMER)>
6. Restart the replicat. On the target system EURO_EAST_GGSCI tab, enter the following
command:
GGSCI (EURO)> Start *
7. Make sure that the replication is still working. On the source database
AMER_WEST_SQLPLUS tab, enter the following DML:
AMER_SQL> INSERT INTO west.account VALUES (9000,9000);
AMER_SQL> COMMIT;

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Configuring Initial Load


Chapter 9 - Page 19
8. On the target database EURO_EAST_SQLPLUS tab, enter the following query:
EURO_SQL> SELECT * FROM east.account
WHERE account_number > 6000;

ACCOUNT_NUMBER ACCOUNT_BALANCE
-------------- ---------------
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

7000 7000
8000 8000
9000 9000
Make sure that the last row was added.
9. The only indication that the Replicat is now integrated (as opposed to classic) is in:
GGSCI (EURO)> View Report reast
where it says:
e to
2013-12-04 13:39:41 INFO OGG-02527 Integrated Replicat does not populate ans
trace table.
l i ce
2013-12-04 13:39:41 INFO OGG-02545 Parameter GROUPTRANSOPS is a
r ble by
ignored
Integrated Replicat when parallelism is greater than 1.
n s fe
n tra
2013-12-04 13:39:48 INFO OGG-02528 REPLICAT REAST -successfully registered
with database as inbound server OGG$REAST.
a no
attached to inbound server OGG$REAST. ha
2013-12-04 13:39:50 INFO OGG-02530 Integrated
eฺ successfully
s idreplicat
m ) G u
o
ฺc ... e n t
o n
... Many lines omitted for clarity
d
tuintegrated (as opposed to classic) is in:
r i c ss sis now
10. The only indication that the Extract
S
GGSCI (AMER)>eInfo extwest
@ e t hi
where it says:ag s
t ฺ n u
Logji Read Checkpoint Oracle Integrated Redo Logs
( s u
N ag GGSCI (AMER)> View Report extwest
and in:

S ujit where it says:


2013-12-04 13:35:27 INFO OGG-02068 Integrated capture successfully attached
to logmining server OGG$CAP_EXTWEST using OGGCapture API.

2013-12-04 13:35:27 INFO OGG-02086 Integrated Dictionary will be used.

... Many lines omitted for clarity ...

This completes Practice 9-4. This completes the practices for Lesson 9. Stop here.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 9: Configuring Initial Load


Chapter 9 - Page 20
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a n s
Practices for n t r
-Lesson 10:
n o
Oracle s aGoldenGate
eฺ
) h a
Parameters u i d
o m t G
o n ฺc Chapter
d e n 10
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 10: Oracle GoldenGate Parameters


Chapter 10 - Page 1
Practices for Lesson 10: Overview
Practices Overview
In this practice, you will modify the existing Manager and Extract processes by using more
advanced parameters.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

During this practice, you will modify:


• The source system Manager parameters
• The target system Manager parameters
• The Extract parameters and restart the Extract process
You can check your work by looking in ~/labs/Section10/solutions for answers.

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 10: Oracle GoldenGate Parameters


Chapter 10 - Page 2
Practice 10-1: Modifying Source Manager Parameters
Tasks
1. Following the instructions in the Oracle GoldenGate documentation (~/Documents),
modify the Manager parameter file on the source system AMER_WEST_GGSCI tab. You will
find some of the information in Section 3.5 Recommended Manager Parameters of
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Administering Oracle GoldenGate (ggate12c_admin_e29388.pdf), and other


information scattered alphabetically in Section 2.1.2 Summary of Manager Parameters of
Reference for Oracle GoldenGate (ggate12c_reference_oracle_e29392.pdf).
GGSCI (AMER)> Edit Param mgr

• Have an Extract group automatically start when the Manager process is started.
Answer: __________________________________________________________
• Have all Extract groups automatically restart after abending. Manager should retry the e to
operation three times, waiting one minute between each attempt.
cens
l i
Answer: __________________________________________________________
a ble
• Report the current lag for each Extract/Replicat group every hour to the application log
fe r
file.
a ns
Answer: __________________________________________________________
n- t r
no
• Write an informational message to the application log file if the lag for any
a
h a s ideฺ
Extract/Replicat group exceeds 30 minutes.
Answer: __________________________________________________________
m ) G u
o t
• Write a critical message to the application log file if the lag for any Extract/ Replicat
ฺc den
o
group exceeds 45 minutes. n
c ss s Stu
Answer: __________________________________________________________
r i
2. e t hi
Activate the changes by bouncing (stopping, and starting, or restarting) the Manager
@ e
g us
ti ฺna
process:

u j (AMER)> Stop Manager


GGSCI
s
(
g Manager process is required by other GGS processes.
N a
ujit
Are you sure you want to stop it (y/n)? y

S Sending STOP request to MANAGER ...


Request processed.
Manager stopped.

GGSCI (AMER)> Start Manager


Manager started.

GGSCI (AMER)>
Note: You do not have to stop any of the Extracts or Replicats to bounce the Manager.
After the Extracts are running, they are independent of the Manager.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 10: Oracle GoldenGate Parameters


Chapter 10 - Page 3
3. Verify that the Manager has restarted:
GGSCI (AMER)> Info mgr
Manager is running (IP port westhost.15000, Process ID 12655).

GGSCI (AMER)>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Your host name and PID will be different.


This completes Practice 10-1. Continue now with Practice 10-2.

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
N a
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 10: Oracle GoldenGate Parameters


Chapter 10 - Page 4
Practice 10-2: Modifying the Target Manager Parameters
Tasks
1. Following the instructions in the Oracle GoldenGate documentation (found in the same
places as Practice 10-1, Task 1), modify the Manager parameter file on the target
EURO_EAST_GGSCI tab with the following parameters:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

GGSCI (EURO)> Edit Param mgr

• Use ports in the range of 15151 through 15199 when starting Oracle GoldenGate
processes. See footnote for checking port availability. 1
Answer: __________________________________________________________
• Have all Replicat groups that have a group name of R* automatically start when the
Manager process is started.
Answer: __________________________________________________________ e to
• Have all Replicat groups automatically restart after abending. Manager should retry the cens
l i
operation three times, waiting one minute between each attempt.
a ble
Answer: __________________________________________________________
fe r
• Delete the remote trail files after the Replicat has finished processing them and the trail
a ns
has been kept for at least two hours.
n- t r
no
Answer: __________________________________________________________
a
• s ideฺ
Report the current lag for each Extract/Replicat group every hour to the application log
h a
file.
m ) G u
o t
Answer: __________________________________________________________
ฺc den
• o n
ss s Stu
Write an informational message to the application log file if the lag for any
i c
Extract/Replicat group exceeds 30 minutes.
r
e t hi
Answer: __________________________________________________________
@ e
g us
ti ฺna
• Write a critical message to the application log file if the lag for any Extract/ Replicat

s u j
group exceeds 45 minutes.
g ( Answer: __________________________________________________________
N a
S ujit

1
Port Availability: The basic UNIX command to check for a single free port is:
netstat -na | grep LISTEN | grep 15001
but it gets trickier when trying to check for a range. Using regex (regular expressions), this will search a range of
15151-15199 inclusive:
netstat -na | grep LISTEN | egrep 1515[1-9]\|151[6-9][0-9]
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 10: Oracle GoldenGate Parameters


Chapter 10 - Page 5
2. Activate the changes by bouncing (stopping, and starting, or restarting) the Manager to
make the changes take effect:
GGSCI (EURO)> Stop Manager
Manager process is required by other GGS processes.
Are you sure you want to stop it (y/n)? y
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Sending STOP request to MANAGER ...


Request processed.
Manager stopped.

GGSCI (EURO)> Start Manager


Manager started.

GGSCI (EURO)>
Note: You do not have to stop any of the Extracts or Replicats to bounce the Manager.
e to
After they are running, they are independent of the Manager.
cens
Note: If you do Stop mgr ! (by adding an exclamation point!), it will not prompt you for l i
“Are you sure?” a ble
fe r
3. Verify that the Manager has started:
a ns
GGSCI (EURO)> Info mgr
n- t r
no
Manager is running (IP port easthost.15001, Process ID 22613).
a
h a s ideฺ
GGSCI (EURO)>
m ) G u
o
ฺc den
Your host name and PID will be different. t
o n u Practice 10-3.
r i c ss snowStwith
This completes Practice 10-2. Continue

@ e
e t hi
t ฺ n ag us
( s uji
N ag
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 10: Oracle GoldenGate Parameters


Chapter 10 - Page 6
Practice 10-3: Modifying the Extract Parameters on the Source
Database
Tasks
1. Using the Oracle GoldenGate Reference Manual (online or the
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

ggate12c_reference_oracle_e29392.pdf file located in the ~/Documents


directory), find the parameters that perform the following and add them to the
extwest.prm file before the Table listings. Modify the Extract parameter file on the
source database AMER_WEST_GGSCI tab for the following:
GGSCI (AMER)> Edit Param extwest

• Controls whether or not statistics generated by the REPORT parameter are reset when a
new process report is created
e to
• Generates interim runtime statistics in a process report. Set this parameter to report at
cens
one minute after midnight daily.
l i
• Forces report files to age on a regular schedule, instead of when a process starts. Set
a ble
this report roll-over parameter to occur at one minute after midnight daily.
fe r
• a ns
Reports a count of transaction records processed since startup. Set this report
parameter to occur every 60 seconds, and report the number of operations per secondn- t r
and the change in rate.
a no
• a s ideฺ
Writes a message to the report file after processing every 1000 records.
h
• Only extracts data from the ACCOUNT_TRANS m ) tableGif uthe account_trans_type is equal
to "CR" n ฺ c dent
o
s so Stu
Answer: __________________________________________________________
c
e
You can check your answers ri against
t h is a sample file in
a g@ use
~/labs/Section10/solutions/amer/extwest.prm.
n
Look for these parameters later

u itฺ ofbest
in the macro
jSet practices settings MACRO #bpsettings in Practice 12-4: “Modifying an

g ( s
Existing Macros and User Tokens.”

jit Na
Su

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 10: Oracle GoldenGate Parameters


Chapter 10 - Page 7
2. Activate the changes by stopping, and starting or restarting the Extract to have the changes
take effect. Then verify that the Extract has started:
GGSCI (AMER)> Stop Extract extwest
Sending STOP request to EXTRACT EXTWEST ...
Request processed.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

GGSCI (AMER)> Start Extract extwest


Sending START request to MANAGER ...
EXTRACT EXTWEST starting

GGSCI (AMER)> Info ER *


EXTRACT EXTWEST Last Started 2013-12-04 14:24 Status RUNNING
Checkpoint Lag 00:00:06 (updated 00:00:00 ago)
Process ID 12774
Log Read Checkpoint Oracle Integrated Redo Logs
e to
2013-12-04 14:24:47
cens
SCN 0.6020566 (6020566) l i
a ble
EXTRACT PWEST Last Started 2013-12-04 07:41 Status RUNNING
fe r
Checkpoint Lag 00:00:00 (updated 00:00:06 ago)
a ns
Process ID 5429
n- t r
Log Read Checkpoint
no
File ./dirdat/ew000005
a
h a s ideฺ
2013-12-04 14:24:33.234481 RBA 1479

GGSCI (AMER)>
m ) G u
3. Clean up the Oracle GoldenGate n labฺc
o e t
n by executing the following GGSCI
environment
o tu d
commands on the target server
r i c ss EURO_EAST_GGSCI
s S tab:
GGSCI (EURO)>eStop ERhi*
g @ e t UserIDAlias ggueuro
GGSCI (EURO)>
a
ฺn(EURO)> s
DBLogin
u
u j
GGSCI i t Delete ER * (confirm the deletion)
( s
g GGSCI (EURO)> Delete CheckpointTable (only on the EURO db)
N a
ujit
GGSCI (EURO)> Stop mgr !
S GGSCI (EURO)> Exit
OS_prompt> rm $GG_EURO_HOME/dirdat/*
OS_prompt> rm $GG_EURO_HOME/dirrpt/*
Do not type the (red comments); those are only for clarification. Shown below is an example
of the dialog from the target (EURO) server:

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 10: Oracle GoldenGate Parameters


Chapter 10 - Page 8
GGSCI (EURO)> Stop ER *
Sending STOP request to REPLICAT REAST ...
Request processed.

GGSCI (EURO)> DBLogin UserIDAlias ggueuro


Successfully logged into database.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

GGSCI (EURO)> Delete ER *


Are you sure you want to delete all groups? y
2013-12-04 14:30:54 INFO OGG-02529 Successfully unregistered REPLICAT REAST
inbound server OGG$REAST from database.
Deleted REPLICAT REAST.

GGSCI (EURO)> Delete CheckpointTable


No checkpoint table specified, using GLOBALS specification (GGS_CHECKPOINT)...
e to
ns
This checkpoint table may be required for other installations. Are you sure
you want to delete this checkpoint table? y
l i ce
Successfully deleted checkpoint table GGS_CHECKPOINT.
a ble
GGSCI (EURO)> Stop mgr ! fe r
a ns
Sending STOP request to MANAGER ...
n- t r
no
Request processed.
Manager stopped.
a
s ideฺ
GGSCI (EURO)> Exit ) h a u
o m t G
[OS_prompt gg_euro]$orm n ฺc$GG_EURO_HOME/dirrpt/*
[OS_prompt gg_euro]$ rm $GG_EURO_HOME/dirdat/*
d e n
i c tu
ssbe runs inSfuture
e
4. This cleanup script above r will
t h i labs as well. You can find it as a shell script in
g @ se
~/labs/setup/kill-all-ogg.sh.
a
Exit in any GGSCI sessions on all terminal tabs,
then run kill-all-ogg u
itฺnFrom the fifth for the AMER source server. (It will also re-kill the EURO
s u j
processes.) tab oracle@hostname OS prompt, enter:
(
N ag [OS_prompt] ~/labs/setup/kill-all-ogg.sh
S ujit It is normal for Oracle shell scripts to warn when trying to drop a non-existent object. This is
also a good example of a shell script that invokes GGSCI commands. The reason you run
this from the fifth tab (and not from either of the GGSCI tabs) is that the script may leave
the oraenv and $ORACLE_SID set to other than what you want.
You can check your work by looking in ~/labs/Section10/solutions for answers.
This completes Practice 10-3. This completes the practices for Lesson 10. Stop here.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 10: Oracle GoldenGate Parameters


Chapter 10 - Page 9
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 10: Oracle GoldenGate Parameters


Chapter 10 - Page 10
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a n s
Practices for n t r
-Lesson 11: Data
n o
Selection
s a and
e ฺ Filtering
a
) h 11Gui d
m
co dent
Chapter
n ฺ
c s so Stu
e ri this
n a g@ use
u jitฺ
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Data Selection and Filtering


Chapter 11 - Page 1
Practices for Lesson 11: Overview
Practices Overview
In these practices, you will increase the performance of Oracle GoldenGate replication by
configuring multiple replication streams running in parallel. One of the techniques used to
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

achieve parallelism is based on the @RANGE function, which computes a hash value of the
columns specified in the input. The @RANGE function, combined with the FILTER option, allows
the Extract/Replicat processes to split the flow of replicated data into two or more streams.

Assumptions
• You completed the lab practices for all previous lessons.
• Nothing is running in GGSCI at the moment.
• You have two configured Extract processes (extwest and pwest) and one configured
e to
Replicat process (reast). All processes are currently stopped.
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Data Selection and Filtering


Chapter 11 - Page 2
Practice 11-1: Increasing Performance by Splitting Replication Loads
Overview
In this practice, you create a new source table and a stored procedure that populates the source
table with random data. The content of the table is replicated using an Extract process, which
writes three remote trail files, each consumed on the target environment by three dedicated
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Replicat processes.

Tasks
1. Create the source and target table range_split. Its definition is stored in the
range_split.sql file. On the fifth tab, oracle@hostname, at an OS prompt, navigate
to the Section 11 directory, and view the script:
[OS_prompt] cat ~/labs/Section11/sqlscripts/range_split.sql
e to
ns
DROP TABLE range_split;
CREATE TABLE range_split
l i ce
( ROW_ID NUMBER NOT NULL PRIMARY KEY,
a ble
split_value NUMBER NOT NULL ,
fe r
split_text VARCHAR2(128) NOT NULL , a ns
n- t r
no
split_date TIMESTAMP DEFAULT systimestamp );
2. a
s ideฺ
You also will create the populate_range_split stored procedure, defined in
h
populate_range_split.sql. View the PL/SQL code:
) a u
o m t G
[OS] cat ~/labs/Section11/sqlscripts/populate_range_split.sql
o n ฺc populate_range_split
d e n
CREATE OR REPLACE PROCEDURE
i c ssIN NUMBER
S tu
( num_rows
e r t s
hiNUMBER )
@
g omitted
, commit_interval
alines s e IN

i
...manyt ฺ n u for clarity...
u j
ag (sThe stored procedure takes two parameters:
− The number of rows to be created
N
S ujit − The commit interval (in number of rows)
The PL/SQL stored procedure defines a cursor used to generate random strings, then
loops until the number of rows to be created has been reached, generating random
numbers and random strings and storing them in the RANGE_SPLIT table.
3. On the AMER_WEST_SQLPLUS tab, connect to the source Oracle database by using
SQL*Plus. If you are already connected as west@amer, skip to the next task.
[OS_prompt labs] rlsqlplus west@amer/oracle_4U
SQL*Plus: Release 12.1.0.1.0 Production on Thu Dec 5 08:28:43 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Last Successful login time: Wed Dec 04 2013 07:58:18 +00:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With Partitioning, OLAP, Advanced Analytics, Real Application Testing options
SQL> set sqlprompt AMER_SQL>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Data Selection and Filtering


Chapter 11 - Page 3
4. Use the @ command in SQL*Plus to create the RANGE_SPLIT table:
AMER_SQL> @Section11/sqlscripts/range_split.sql
Table created.
As always, if the initial table to be dropped does not exist, you get an error that you can
ignore. As long as the script says Table created at the end, it worked.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

5. Load and compile the stored procedure by using the @ command into the west schema:
AMER_SQL> @Section11/sqlscripts/populate_range_split.sql
Procedure created.

6. Change to the source AMER_WEST_GGSCI tab, and make sure that the GGSCI command
interpreter and manager are started:
[OS prompt ~] cd $GG_AMER_HOME
[OS prompt gg_amer] rlggsci
e to
ns
Oracle GoldenGate Command Interpreter for Oracle

ce
Version 12.1.2.0.0 17185003 OGGCORE_12.1.2.0.0_PLATFORMS_130924.1316_FBO
Linux, x64, 64bit (optimized), Oracle 12c on Sep 25 2013 02:33:54
l i
Operating system character set identified as UTF-8.
a ble
Copyright (C) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
fe r
GGSCI (AMER) 1> Start mgr a ns
Manager started.
n- t r
a no
It may be helpful to eventually define a startup.oby “obey” script file that contains the
a s ideฺ
half-dozen or so common GGSCI housekeeping tasks, such as starting the manager, doing
h
)
DBLogin, setting the default editor, and so on.
m G u
o
ฺc den t
7.
n
You must set the additional logging for the new RANGE_SPLIT table:
o tu
GGSCI (AMER) 2> DBLogin
r i c ss s UserIDAlias
S gguamer
e
Successfully logged into
th i
database.

a g @ s e
GGSCIฺn 3>uAdd TranData WEST.RANGE_SPLIT
j i t (AMER)
u of supplemental redo data enabled for table WEST.RANGE_SPLIT.
g ( s
Logging

N a TRANDATA for scheduling columns has been added on table 'WEST.RANGE_SPLIT'.

S ujit GGSCI (AMER) 4> Info TranData WEST.R*


8. Edit the parameters for defgen and add the RANGE_SPLIT table:
GGSCI (AMER) 5> Edit Param defsrc
DefsFile ./dirdef/rangesplit.def, Purge
UserIDAlias gguamer
Table WEST.RANGE_SPLIT;

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Data Selection and Filtering


Chapter 11 - Page 4
9. Run the defgen utility from the OS command shell to generate the table definitions. You
could exit GGSCI, run defgen, and then restart GGSCI. However, it is easier to just run
defgen from the sh command inside of GGSCI. Note that defgen is NOT a GGSCI
command. The response should look similar to:
GGSCI (AMER)> sh ./defgen paramfile dirprm/defsrc.prm
...many lines omitted for clarity...
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

***********************************************************************
** Running with the following parameters **
***********************************************************************
DefsFile ./dirdef/rangesplit.def, Purge
UserIDAlias gguamer
Table WEST.RANGE_SPLIT;
Retrieving definition for WEST.RANGE_SPLIT

e to
Definitions generated for 1 table in ./dirdef/rangesplit.def
cens
l i
10. Copy the rangesplit.def file to the EURO target environment, under the dirdef
a ble
directory:
fe r
GGSCI (AMER)> sh cp ./dirdef/*.def $GG_EURO_HOME/dirdef
a ns
GGSCI (AMER)> sh ls $GG_EURO_HOME/dirdef
n- t r
rangesplit.def
a no
In a production environment, you might need to h a
use eฺ instead of cp if the target
s scp iordsftp
is a remote host. m ) G u
o
ฺctab ande t
n to the target EURO database by
11. Change to the EURO_EAST_SQLPLUS
o n tu d connect
using SQL*Plus to create the
r i c sstargetsRANGE_SPLIT
S table. If you are already connected as
east@euro, skip to the
@ e next task.
e t hi
[OS_prompt
n a g uslabs] rlsqlplus east@euro/oracle_4U

s u jitฺempty target RANGE_SPLIT table:


12. Create the

a g ( EURO_SQL> @Section11/sqlscripts/range_split.sql
N
ujit
Table created.
S As before, an attempt to drop a non-existent table results in an error that you can safely
ignore.
13. On the AMER_WEST_GGSCI tab, create three Extract processes (erangea, erangeb, and
erangec), which use the FILTER command combined with the @RANGE function to create
three separate trail files. These files will be processed by three separate Replicat
processes, thus achieving parallelism and significantly improving load performance. Note
where the files differ by a, b, c, and by 1, 2, 3:
GGSCI (AMER)> Edit Param erangea
Extract erangea
UserIDAlias gguamer
RmtHost easthost, MgrPort 15001
RmtTrail ./dirdat/ea
Table WEST.RANGE_SPLIT, Filter (@RANGE (1, 3));

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Data Selection and Filtering


Chapter 11 - Page 5
14. Save the parameter file erangea and create the second parameter file:
GGSCI (AMER)> Edit Param erangeb
Extract erangeb
UserIDAlias gguamer
RmtHost easthost, MgrPort 15001
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

RmtTrail ./dirdat/eb
Table WEST.RANGE_SPLIT, Filter (@RANGE (2, 3));
15. Save the parameter file erangeb and create the third parameter file:
GGSCI (AMER)> Edit Param erangec
Extract erangec
UserIDAlias gguamer
RmtHost easthost, MgrPort 15001
e to
RmtTrail ./dirdat/ec
cens
Table WEST.RANGE_SPLIT, Filter (@RANGE (3, 3)); l i
a ble
16. Add the three Extract processes:
fe r
GGSCI (AMER)> Add Extract erangea, TranLog, Begin Now
a n s
EXTRACT added.
n- t r
a no
GGSCI (AMER)> Add Extract erangeb, TranLog, Begin Now
EXTRACT added.
h a s ideฺ
m ) G u
GGSCI (AMER)> Add Extract erangec, TranLog, Begin Now
o
ฺc den t
EXTRACT added.
o n
17. Add the three remote trailic
r ss s Stu
definitions:
GGSCI (AMER)> @ e hi ./dirdat/ea, Extract
eAdd RmtTrail
t erangea
RMTTRAIL
t ฺ n agadded.us
( s uji (AMER)> Add RmtTrail ./dirdat/eb, Extract
GGSCI erangeb

N ag RMTTRAIL added.
S ujit GGSCI (AMER)> Add RmtTrail ./dirdat/ec, Extract
RMTTRAIL added.
erangec

18. Assess the current situation of your Extract processes by entering Info All:
GGSCI (AMER)> Info All
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT STOPPED ERANGEA 00:00:00 00:02:35
EXTRACT STOPPED ERANGEB 00:00:00 00:02:28
EXTRACT STOPPED ERANGEC 00:00:00 00:02:20

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Data Selection and Filtering


Chapter 11 - Page 6
19. Start the three new Extract processes:
GSCI (AMER)> Start Extract erange*
Sending START request to MANAGER ...
EXTRACT ERANGEA starting
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Sending START request to MANAGER ...


EXTRACT ERANGEB starting

Sending START request to MANAGER ...


EXTRACT ERANGEC starting
20. Issue Info All once again, to verify that no process is in an ABENDED status:
GGSCI (AMER)> Info All
e to
ns
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
l i ce
EXTRACT RUNNING ERANGEA 00:00:00 00:05:53
a ble
EXTRACT RUNNING ERANGEB 00:00:00
fe r
00:05:46
EXTRACT RUNNING ERANGEC 00:00:00
a n s
00:05:38
21. On the EURO_EAST_GGSCI tab, start GGSCI: n- t r
[OS_prompt ~] cd $GG_EURO_HOME a no
[OS_prompt gg_euro] rlggsci h a s ideฺ
m ) G u
o t
22. Do basic housekeeping in preparation for configuration. Start the Manager, log in to the
ฺc den
n
database, and make sure that there is a Checkpoint table.
o
i c ss s Stu
GGSCI (EURO) 1> DBLogin UserIDAlias ggueuro
r
@ e t
GGSCI (EURO) 2> Start Manager
e hi
g us
If u
ti ฺna
GGSCI (EURO) 3> Info CheckpointTable
j checkpoint table exists, then skip the next line; otherwise create the checkpoint table.
the
( s
g GGSCI (EURO) 4> Add CheckpointTable
Na
S ujit GGSCI (EURO) 5> Set Editor gedit  optional
Optional: If this housekeeping seems repetitive for each time you start a new GGSCI
session, look at ~/labs/setup/startup.oby.
23. Create three Replicat processes (rrangea, rrangeb, and rrangec), which source their
data from the trail files created by the three Extract processes created previously.
GGSCI (EURO)> Edit Param rrangea
Replicat rrangea
UserIDAlias ggueuro
SourceDefs ./dirdef/rangesplit.def
DiscardFile ./dirrpt/rrangea.dsc, Append
Map WEST.RANGE_SPLIT, Target EAST.RANGE_SPLIT;

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Data Selection and Filtering


Chapter 11 - Page 7
24. Save the parameter file rrangea and create the second parameter file:
GGSCI (EURO)> Edit Param rrangeb
Replicat rrangeb
UserIDAlias ggueuro
SourceDefs ./dirdef/rangesplit.def
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

DiscardFile ./dirrpt/rrangeb.dsc, Append


Map WEST.RANGE_SPLIT, Target EAST.RANGE_SPLIT;
25. Save the parameter file rrangeb and create the third parameter file:
GGSCI (EURO)> Edit Param rrangec
Replicat rrangec
UserIDAlias ggueuro
SourceDefs ./dirdef/rangesplit.def
e to
DiscardFile ./dirrpt/rrangec.dsc, Append
cens
Map WEST.RANGE_SPLIT, Target EAST.RANGE_SPLIT; l i
a ble
26. Add the three Replicat processes, connecting them to their respective trail files:
fe r
GGSCI (EURO)> Add Replicat rrangea, exttrail ./dirdat/ea
a n s
REPLICAT added.
n- t r
a no
GGSCI (EURO)> Add Replicat rrangeb, exttrail ./dirdat/eb
REPLICAT added.
h a s ideฺ
m ) G u
GGSCI (EURO)> Add Replicat rrangec, exttrail ./dirdat/ec
o
ฺc den t
REPLICAT added.
o n tu all to verify that they started successfully:
s enterSinfo
i
27. Start the Replicat processes
r c sand s
GGSCI (EURO)> @ e hi
eStart tReplicat rrange*
a g request
SendingnSTART u s
jitฺ RRANGEA starting
to MANAGER ...

s u
REPLICAT

a g ( Sending START request to MANAGER ...


N
S ujit REPLICAT RRANGEB starting

Sending START request to MANAGER ...


REPLICAT RRANGEC starting

GGSCI (EURO)> Info All


Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING RRANGEA 00:00:00 00:00:02
REPLICAT RUNNING RRANGEB 00:00:00 00:00:02
REPLICAT RUNNING RRANGEC 00:00:00 00:00:02
Check the status of the source GGSCI processes as well. It may have a problem… Why?
28. Go to the AMER_WEST_SQLPLUS tab, and execute the stored procedure which populates
the table WEST.RANGE_SPLIT:
AMER_SQL> exec populate_range_split(500000,1000);
You will not see anything while it executes. This is normal. Keep reading the next steps.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Data Selection and Filtering


Chapter 11 - Page 8
29. The stored procedure inserts half a million rows, committing every one thousand rows. It
takes a few minutes to complete. During its execution, you can monitor the Extract and
Replicat processes to verify that data is being replicated. Click the AMER_WEST_GGSCI tab
where you are running the source Oracle GoldenGate installation and use the statistics
command to show total DMLs on the Extract process:
GGSCI (AMER)> Stats Extract erangea
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Sending STATS request to EXTRACT ERANGEA ...

Start of Statistics at 2013-12-05 14:43:37.

Output to ./dirdat/ea:

Extracting from WEST.RANGE_SPLIT to WEST.RANGE_SPLIT:

...many lines omitted for clarity... e to


cens
*** Latest statistics since 2013-12-05 14:43:14 *** l i
Total inserts 92846.00
a ble
Total updates 0.00 fe r
Total deletes 0.00
a ns
Total discards 0.00
n- t r
Total operations no
92846.00
a
h a s ideฺ
End of Statistics.
)
mtarget G u
ฺ o
30. Go to the EURO_EAST_GGSCI tab forcthe
e n t
environment, and display statistics for the
Replicat processes: n
soReplicat d
tu rrangea
r i c s s S
erequestthito REPLICAT RRANGEA...
GGSCI (EAST)> Stats
@
n a g use
Sending STATS

u jitฺ of Statistics at 2013-12-05 14:44:50.


Start
s
a g ( Replicating from WEST.RANGE_SPLIT to EAST.RANGE_SPLIT:
N
S ujit ...many lines omitted for clarity...

*** Latest statistics since 2013-12-05 14:43:17 ***


Total inserts 28964.00
Total updates 0.00
Total deletes 0.00
Total discards 0.00
Total operations 28964.00

End of Statistics.
GGSCI (EURO)> Stats Replicat rrangeb
[omitted similar output…]
GGSCI (EURO)> Stats Replicat rrangec
[omitted similar output…]

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Data Selection and Filtering


Chapter 11 - Page 9
31. A short time after the stored procedure finishes its execution, the replication ends (not to be
confused with the Replicat which keeps running until you stop it). You can assess the
status of your replicated rows by viewing the reports on the Extract and Replicat processes
from GGSCI:
GGSCI (AMER)> Stop ER *
GGSCI (AMER)> View Report erangea
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

GGSCI (EURO)> Stop ER *


GGSCI (EURO)> View Report rrangea
The reports will not contain final stats until you stop the processes with Stop ER * or
equivalent.
32. View the report produced for all Extract processes (erangea, erangeb, and erangec)
and all Replicat processes (rrangea, rrangeb, and rrangec) and make sure that
e to
replication was successful at both ends, and no rows were missed (discards: 0). Were
cens
all the Extracts identical in count? Why or why not? l i
This completes Practice 11-1. Continue now with Practice 11-2. a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Data Selection and Filtering


Chapter 11 - Page 10
Practice 11-2: Increasing Performance by Coordinated Applies
Overview
This practice modifies the previous practice by changing the @RANGE() to a coordinated replicat
ThreadRange(), which is new with 12c.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Tasks
1. Stop all previous Extract and Replicat processes:
 On the source AMER_WEST_GGSCI tab, enter:
GGSCI (AMER)> Stop ER *
 On the target EURO_EAST_GGSCI tab, enter:
GGSCI (EURO)> Stop ER *
2. Truncate both source and target tables in SQL*Plus as you will reuse them:
e to
a) On the source database AMER_WEST_SQLPLUS tab, enter:
cens
l i
AMER_SQL> TRUNCATE TABLE west.range_split;
a ble
b) On the target database EURO_EAST_SQLPLUS tab, enter:
fe r
EURO_SQL> TRUNCATE TABLE east.range_split;
a n s
3. On the AMER_WEST_GGSCI tab, create a new parameter filen
r
-t on the source:
o ecord
GGSCI (AMER)> Edit Param ecord
s a n eฺ
Extract ecord
) ha uid
UserIDAlias gguamer
ฺ c om ent G
RmtHost easthost, MgrPort
s s on 15001
t u d
RmtTrail ./dirdat/ed
e r ic his S
@
Table WEST.RANGE_SPLIT;
g e t
Save and tclose
s
ฺna the file. Note
u that there is nothing in the Extract that indicates anything
j i
u about the apply. The only difference between this Extract and the previous
s
“coordinated”
(
N agthree,was removing the Table clause:

ujit
Filter (@RANGE (n, 3))
S and the fact that you needed three of them. Now we only need one Extract.
4. On the EURO_EAST_GGSCI tab, create a new parameter file rcord on the target:
GGSCI (EURO)> Edit Param rcord
Replicat rcord
UserIDAlias ggueuro
SourceDefs ./dirdef/rangesplit.def
DiscardFile ./dirrpt/rrangea.dsc, Append
Map WEST.RANGE_SPLIT, Target EAST.RANGE_SPLIT
ThreadRange (1-3, ROW_ID);
The replicat group name must be five characters or less, or you get the following error:
ERROR: Invalid Coordinated Replicat group name. Must be at most
5 characters..

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Data Selection and Filtering


Chapter 11 - Page 11
This is because it will create rcord001, rcord002, …, rcordnnn, and so on.
Note the new map clause:
ThreadRange (1-nnn, column)
and the fact that you only need one Replicat. Save and close the file.
5. On the AMER_WEST_GGSCI tab, add and start the source processes:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

GGSCI (AMER)> Add Extract ecord, TranLog, Begin Now


EXTRACT added.

GGSCI (AMER)> Add RmtTrail ./dirdat/ed, Extract ecord


RMTTRAIL added.

GGSCI (AMER)> Start ER ec*


Sending START request to MANAGER ...
e to
EXTRACT ECORD starting
cens
6. On the EURO_EAST_GGSCI tab, add and start the target processes (all on one line; no l i
breaks):
a ble
fe r
GGSCI (EURO)> Add Replicat rcord, Coordinated, ExtTrail
a ns
./dirdat/ed, MaxThreads 3
n- t r
no
REPLICAT (Coordinated) added.

a
s ideฺ
GGSCI (EURO)> Start ER rc*
h a
Sending START request to MANAGER ...) G u
o m t
REPLICAT RCORD starting
o n ฺc den
r i c ss s Stu
Info ircord
GGSCI (EURO) 41>
@ e th
g s e
i
REPLICAT
j t ฺ na RCORD u Last Started 2013-12-05 12:04 Status RUNNING
( s u
COORDINATED Coordinator MAXTHREADS 3

ag Checkpoint Lag 00:00:00 (updated 00:00:00 ago)


N
ujit
Process ID 18375

S Log Read Checkpoint File ./dirdat/ed000000


First Record RBA 1415

GGSCI (EURO)>
7. Generate DML traffic. On the AMER_WEST_SQLPLUS source database tab, enter:
AMER_SQL> exec populate_range_split(10000,1000);

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Data Selection and Filtering


Chapter 11 - Page 12
8. On the target EURO_EAST_GGSCI tab, view the process and thread information. Enter:
GGSCI (EURO)> Info rcord, Detail

REPLICAT RCORD Last Started 2013-12-06 08:29 Status RUNNING


COORDINATED Coordinator MAXTHREADS 3
Checkpoint Lag 00:00:00 (updated 00:00:02 ago)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Process ID 18375
Log Read Checkpoint File ./dirdat/ed000000
2013-12-06 12:15:08.818086 RBA 3169467

Lowest Log BSN value: <NULL>

Active Threads:
ID Group Name PID Status Lag at Chkpt Time Since Chkpt
e to
1 RCORD001 18382 RUNNING 00:00:00 00:00:02
cens
2 RCORD002 18383 RUNNING 00:00:00 00:00:02
l i
3 RCORD003 18384 RUNNING 00:00:00 00:00:02
a ble
fe r
Current directory /u01/app/oracle/product/gg_euro
a ns
n- t r
Report file
no
/u01/app/oracle/product/gg_euro/dirrpt/RCORD.rpt
a
Parameter file
s ideฺ
/u01/app/oracle/product/gg_euro/dirprm/rcord.prm
h a
Checkpoint file
) u
/u01/app/oracle/product/gg_euro/dirchk/RCORD.cpr
m G
Checkpoint table
o
GGS_CHECKPOINT
ฺc den t
Process file
o n
/u01/app/oracle/product/gg_euro/dirpcs/RCORD.pcr
Error log
r i c ss s Stu
/u01/app/oracle/product/gg_euro/ggserr.log

@ e
e t hi
t ฺ n ag us
GGSCI (EURO)> Info rcord002

( s uji
REPLICAT RCORD002 Last Started 2013-12-06 08:29 Status RUNNING
a g COORDINATED Replicat Thread Thread 2
i t N
S uj Checkpoint Lag
Process ID
00:00:00 (updated 00:00:06 ago)
18383
Log Read Checkpoint File ./dirdat/ed000000
2013-12-06 08:30:52.000182 RBA 3169467

GGSCI (EURO)> Info rcord003

REPLICAT RCORD003 Last Started 2013-12-06 08:29 Status RUNNING


COORDINATED Replicat Thread Thread 3
Checkpoint Lag 00:00:00 (updated 00:00:00 ago)
Process ID 18384
Log Read Checkpoint File ./dirdat/ed000000
2013-12-06 08:30:52.000182 RBA 3169467
GGSCI (EURO)>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Data Selection and Filtering


Chapter 11 - Page 13
9. On the target EURO_EAST_GGSCI tab, view the Replicat statistics for all threads. Enter:
GGSCI (EURO)> Stats rcord
Sending STATS request to REPLICAT RCORD ...
Coordinated Replicat Statistics:

Thread Lag Gap: 00:00:00 (updated


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

00:00:09 ago)
Coordinated Total DDLs: 0
Coordinated Total PK-update transactions: 0
Coordinated Total EMI transactions: 0
Total transactions with user-requested coordination: 0
Average Coordination Time: 00:00:00

Start of Statistics at 2013-12-06 12:21:15.


Replicating from WEST.RANGE_SPLIT to EAST.RANGE_SPLIT:
e to
cens
...many lines omitted for clarity...
l i
a ble
*** Latest statistics since 2013-12-06 08:30:54 ***
fe r
Total inserts 10000.00
a n s
Total updates 0.00
n- t r
no
Total deletes 0.00
Total discards
a
s ideฺ
0.00
Total operations
) h a u
10000.00

End of Statistics.
o m t G
GGSCI (EURO)> Statsso nฺc tuden
rcord002
r i c s sS
i
e tothREPLICAT
g @
Sending STATS request
s e
RCORD002 ...

ฺna from WEST.RANGE_SPLIT


u
Start of Statistics at 2013-12-06 12:21:23.
j i t
Replicating
u to EAST.RANGE_SPLIT:
s
g ( ...many lines omitted for clarity...
N a
S ujit *** Latest
Total
statistics since 2013-12-06 08:30:54 ***
inserts 3346.00
Total updates 0.00
Total deletes 0.00
Total discards 0.00
Total operations 3346.00

End of Statistics.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Data Selection and Filtering


Chapter 11 - Page 14
GGSCI (EURO)> Stats rcord003
Sending STATS request to REPLICAT RCORD003 ...
Start of Statistics at 2013-12-06 12:21:26.
Replicating from WEST.RANGE_SPLIT to EAST.RANGE_SPLIT:

...many lines omitted for clarity...


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

*** Latest statistics since 2013-12-06 08:30:54 ***


Total inserts 3322.00
Total updates 0.00
Total deletes 0.00
Total discards 0.00
Total operations 3322.00

End of Statistics.
e to
GGSCI (EURO)>
cens
l i
Notice that the division of labor among the three threads is approximately equal but not
a ble
exactly.
fe r
This completes Practice 11-2. This completes the practices for Lesson 11. Stop here.
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Data Selection and Filtering


Chapter 11 - Page 15
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 11: Data Selection and Filtering


Chapter 11 - Page 16
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a n s
Practices for n t r
-Lesson 12:
n o
Additional
s a Transformation
eฺ
) h a
Topics u i d
o m t G
o n ฺc Chapter
d e n 12
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 12: Additional Transformation Topics


Chapter 12 - Page 1
Practices for Lesson 12: Overview
Practices Overview
In this practice, 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.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 12: Additional Transformation Topics


Chapter 12 - Page 2
Practice 12-1: Modifying an Existing Set of Macros and Using User
Tokens
Overview
In this practice, you will create three macros. Oracle GoldenGate Macros provide functionality
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

for sharing parameters or other runtime configuration settings across multiple components and
externalizing complex configuration settings to streamline parameter file contents.
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, $OGG_HOME/dirmac).
1. On the fifth oracle@hostname tab, at the OS prompt, edit the
~/labs/Section12/macrolib_shell.mac file in the text editor of your choice (for
example, vi, gedit). Referring to the Oracle GoldenGate Windows and UNIX Reference
Guide (~/Documents/ggate12c_reference_oracle_e29392.pdf), fill in the
e to
ns
<blanks> with the appropriate values to complete the three macros:
− #dbconnect l i ce
− #bpsettings
a ble
fe r
− #funcsmap
a ns
<a> The keyword that starts a macro body
n- t r
<b> The keyword that finishes a macro
a no
a s ideฺ
<c> Reset the statistics when a new report is generated
h
<d> Generates a report every day at onem ) afterGmidnight
minute u
o
ฺccreateda enewt
n one daily at one minute after midnight
o n
<e> Close the current report file and
s between tu different source and target columns
<f> The keyword that maps
r i c srecords
s S
i information about the Oracle GoldenGate
eis used tothreturn
@
<g> The function that
ag us e
t ฺ n
environment
<h> The
( s ujifunction used to identify a user token
g
jit Na
Su

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 12: Additional Transformation Topics


Chapter 12 - Page 3
MACRO #dbconnect
<a>
UserID gguser, Password <encrypted_pswd> AES256, EncryptKey MyKey3
<b>;

MACRO #bpsettings
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

BEGIN
<c>
<d>
<e>
ReportCount Every 60 Seconds, Rate
END;

e to
ns
MACRO #funcsmap
PARAMS (#src_table, #target_table)
l i ce
BEGIN
a ble
MAP #src_table, TARGET #target_table,
fe r
<f> (usedefaults,
a ns
gg_commit_ts = <g> ( 'GGHEADER' , 'COMMITTIMESTAMP' ),
n- t r
lag_extract_ms = <h> ( 'TKN-EXTLAG-MSEC' ),
a no
a s ideฺ
lag_replicat_ms = @GETENV ( 'LAG' , 'MSEC' ),
h
) G
src_db_name = @TOKEN ( 'TKN-SRC-DBNAME' ),
m u
o
ฺc den t
src_db_version = @TOKEN ( 'TKN-SRC-DBVERSION' ),
o n
r i c ss s Stu
src_txn_csn = @TOKEN ( 'TKN-TXN-CSN' )
);
@ e
e t hi
END;
n g us
aparameters
After all oft ฺ
ji that the token quotes
the have been set correctly, save and close the file. It is very
s u
g(
important be 'single, straight' quotes. Verify that it has the correct

N a ~/labs/Section12 directory.
parameters by comparing it with the macrolib.mac file, which is also located in the

uj i t
S 2. On the AMER_WEST_GGSCI source tab, create a directory named dirmac. Copy the
macrolib.mac file to this directory:
GGSCI (AMER)> sh mkdir dirmac
GGSCI (AMER)> sh cp ~/labs/Section12/macrolib.mac dirmac
GGSCI (AMER)> sh ls dirmac
macrolib.mac
GGSCI (AMER)>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 12: Additional Transformation Topics


Chapter 12 - Page 4
3. On the EURO_EAST_GGSCI target tab, perform the same steps. Create a directory named
dirmac. Copy the macrolib.mac file to this directory.
GGSCI (EURO)> sh mkdir dirmac
GGSCI (EURO)> sh cp ~/labs/Section12/macrolib.mac dirmac
GGSCI (EURO)> sh ls dirmac
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

macrolib.mac
GGSCI (EURO)>
Note: Both the macros and user tokens will be used in subsequent labs.
This completes Practice 12-1. This completes the practices for Lesson 12. Stop here.

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
N a
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 12: Additional Transformation Topics


Chapter 12 - Page 5
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 12: Additional Transformation Topics


Chapter 12 - Page 6
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a n s
Practices for n t r
-Lesson 13:
n o
a eฺ Options
Configuration
s
) a
h 13 uid
ฺ c om ent G
Chapter

s s on tud
e ric this S
n a g@ use
u jitฺ
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 13: Configuration Options


Chapter 13 - Page 1
Practices for Lesson 13: Overview
Practices Overview
In this practice, you will set up a configuration as depicted in the following graphic. You will also
use the macros and tokens created in the previous practice, including password encryption, trail
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

encryption, and SQLEXEC.

Big Picture

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 13: Configuration Options


Chapter 13 - Page 2
Practice 13-1: Setting Up the Database and Source Definitions File
Overview
In this practice, you set up the new tables in the databases and create a defgen file.

Assumptions
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

You have successfully completed the previous lab where you created the macros. If the
SQL*Plus tabs are still signed on as the proper users, you can just execute the script; no need
to exit/restart.

Tasks

Adding Transaction Data


1. On the source database AMER_WEST_SQLPLUS tab, execute the following command:
e to
[OS_prompt labs] sqlplus west@amer/oracle_4U
cens
@Section13/sqlscripts/source_database.sql l i
a ble
As always, the first time you see the “ORA-00942: table or view does not exist”
fe r
warning in a SQL script, it can probably be safely ignored.
a ns
2. On the target database EURO_EAST_SQLPLUS tab, execute the following command:
n- t r
[OS_prompt labs] sqlplus east@euro/oracle_4U
a no
h a s ideฺ
@Section13/sqlscripts/target_database.sql
3. On the source system AMER_WEST_GGSCI tab,
m ) G u
configure the database to log table key
If you tare still logged in from a previous lab,
n ฺco with
values by issuing the following commands.
skip the first three lines and justocontinue d e n
the Add TranData step.
i c ss s Stu
[OS_prompt] cd r$GG_AMER_HOME
[OS_prompt@
e
e t hi
ag 1>usDBLogin UserIDAlias gguamer
gg_amer] rlggsci
GGSCIฺn
t (AMER)
uji (AMER) 2> Add TranData WEST.*
( s
GGSCI

N agNote: Supplemental logging has already been enabled for the existing tables in the
S ujit database and will cause many WARNING OGG-00706 messages that can be ignored.
Verify that supplemental logging has been enabled for the new tables: WEST.CUST_ZIP,
WEST.WSHOP_ENCRYPT, and WEST.WSHOP_FUNCS.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 13: Configuration Options


Chapter 13 - Page 3
Generating Source Table Definitions
4. Because the target tables differ from the source, a source definitions file must be generated
for use in Replicat to perform the table name, column name, and data type conversions.
The defgen utility is used to create this file. To create the defgen file, on the source
AMER_WEST_GGSCI tab, execute the following command:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

GGSCI (AMER)> Edit Param defgen


The text editor of your choice opens the empty defgen.prm file. Add the following runtime
parameters to the text file:
DefsFile ./dirdef/section13.defs, Purge
UserIDAlias gguamer
Table WEST.wshop_encrypt;
Table WEST.wshop_funcs;
e to
ns
Table WEST.cust_zip;
You could have used a wildcard for Table WEST.wshop*. Save and close the file. l i ce
5. On the AMER_WEST_GGSCI tab, execute the OS command:
a b le
fe r
GGSCI (AMER)> sh ./defgen paramfile ./dirprm/defgen.prm
n s
...many lines omitted for clarity...
n - tra
a no
h a s ideฺ
***********************************************************************
**
)
Running with the following
u
parameters **

ฺ c omPurge
e n tG
***********************************************************************

s s on tud
DefsFile ./dirdef/section13.defs,

ric this S
UserIDAlias gguamer

e
Table WEST.wshop_encrypt;
@ sefor WEST.WSHOP_ENCRYPT.
n g
Retrieving definition
a u
Table ฺWEST.wshop_funcs;
u j i t
g ( s
Retrieving definition for WEST.WSHOP_FUNCS.

N a Table WEST.cust_zip;

ujit
Retrieving definition for WEST.CUST_ZIP.

S Definitions generated for 3 tables in ./dirdef/section13.defs.

GGSCI (AMER)>
The defgen utility will report runtime data to the screen. If any errors are reported, fix
them and rerun the utility.
6. On the source AMER_WEST_GGSCI tab, copy the dirdef/section13.defs file to the
same location on the target server:
GGSCI (AMER)> sh cp dirdef/section13.defs $GG_EURO_HOME/dirdef
7. On the EURO_EAST_GGSCI tab, verify that the section13 definition file is there:
GGSCI (EURO)> sh ls -al dirdef/s*
-rw-r----- 1 oracle oinstall 2098 Dec 6 dirdef/section13.defs
This completes Practice 13-1. Continue now with Practice 13-2.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 13: Configuration Options


Chapter 13 - Page 4
Practice 13-2: Oracle GoldenGate Encryption Using ENCKEYS
Overview
Oracle GoldenGate offers three types of encryption: Oracle GoldenGate Trail, Data
Transmission, and password. In this practice, you will use the AES256 FIPS-compliant
encryption to encrypt the password for the database login.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Tasks
1. Before data encryption can occur, encryption keys must be generated using the keygen
utility.
To run keygen and create keys that will be used for password and data transmission
encryption, on the fifth oracle@hostname tab Linux shell session, navigate to the
$GG_AMER_HOME directory. Using the keygen utility, create five keys, with one having 64
bits, one with 128 bits, and three having 256 bits. Then open the file with the text editor of e to
your choice:
cens
l i
[OS_prompt] cd $GG_AMER_HOME
a ble
[OS_prompt gg_amer] ./keygen 64 1 > ENCKEYS
fe r
[OS_prompt gg_amer] ./keygen 128 1 >> ENCKEYS
a ns
[OS_prompt gg_amer] ./keygen 256 3 >> ENCKEYS
n- t r
[OS_prompt gg_amer] gedit ENCKEYS
a no
h
The double greater-than “>>” appends the standard a s outputidtoeaฺ file.
m ) G u
2. Name the keys MyKey1 through MyKey5
different. Save and close the file: nฺc
o by adding
e n t the prefixes. Your hex numbers will be
o d
i
MyKey1 0x449FFE730EF5634F
r c ss s Stu
e t hi
MyKey2 0x1F1914181FDE5B2048A11E5B0F712377
@ e
MyKey3 a
n g us
0xBEE3A6170DCA34671DBF8D12524DD403312ECE240529CA5C37A7540C7F790642
t ฺ
( s uji 0xB177611C9714FB1DC1A6936BA8CAE2359B0D642EF3FB1609CAD9914DA13BA45E
MyKey4

agCopy this file to the same location on the target (GG_EURO_HOME) system:
MyKey5 0x4EB616219242DA1B110026107AAB910530AC224BC874E40E0421B9113114A008
N
ujit
3.
S [OS_prompt gg_amer] cp ENCKEYS $GG_EURO_HOME
Verify that the file is there in the target installation directory:
[OS_prompt gg_amer] more $GG_EURO_HOME/ENCKEYS
MyKey1 0x449FFE730EF5634F
MyKey2 0x1F1914181FDE5B2048A11E5B0F712377
MyKey3 0xBEE3A6170DCA34671DBF8D12524DD403312ECE240529CA5C37A7540C7F790642
MyKey4 0xB177611C9714FB1DC1A6936BA8CAE2359B0D642EF3FB1609CAD9914DA13BA45E
MyKey5 0x4EB616219242DA1B110026107AAB910530AC224BC874E40E0421B9113114A008
[OS_prompt gg_amer]

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 13: Configuration Options


Chapter 13 - Page 5
Password Encryption Using Oracle GoldenGate Default Encryption
4. Having clear text database login credentials stored in edit files may be deemed a security
violation. To solve this issue, Oracle GoldenGate provides a mechanism for encrypting the
database access password stored in its configuration files.
The Encrypt Password GGSCI command is used to accomplish this task. Two different
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

levels of encryption are offered: AES and Blowfish.


The Encrypt Password <password> GGSCI command uses the default Oracle
GoldenGate encryption key to encrypt the provided text. The returned encrypted text is then
copied to the parameter file in place of the clear text password. For correct decryption, the
default key must be specified in the parameter file as well.
Navigate to the $GG_AMER_HOME/dirmac directory to retrieve the file that was completed
in Practice 12 (macrolib.mac).
To encrypt the password used by the Oracle GoldenGate macro #dbconnect, perform the
e to
following:
cens
l i
a. On the source AMER_WEST_GGSCI tab, execute the following command: Encrypt
a ble
Password oracle_4U. If you are still logged in to GGSCI from a previous lab, skip
fe r
the first two steps and just continue with the Encrypt command.
a ns
[OS_prompt ~] cd $GG_AMER_HOME
n- t r
[OS_prompt gg_amer] rlggsci
a no
h a s ideฺ
GGSCI 1> Encrypt Password oracle_4U
m ) G u EncryptKey MyKey3
AES256
Encrypted password: o
ฺc den t
o n tu
AADAAAAAAAAAAAJAMEHJTEOAXDFHGGSILHRGKAXIFJUGMCIEDECEUCXFAFWEWADFECLCEEUFAIVAJH
s
c s
QEIEKETECCOCJBAGJJGGAGYFRBVDLCHDIB
r i s S
Algorithm used: eAES256
@ e t hi
t ฺ n ag us
uji
GGSCI 2>
b. (s
Copy the encrypted password output (not the label prompt, just the hex password
N ag itself) into the clipboard with no line breaks.
jit
Su c. Use your text editor of choice to edit the existing AMER copy of the macrolib.mac file.
GGSCI (AMER)> sh gedit dirmac/macrolib.mac
d. In the #dbconnect macro, replace <encrypted_password> with the copied value.
MACRO #dbconnect
BEGIN
Userid gguser, Password
AADAAAAAAAAAAAJAMEHJTEOAXDFHGGSILHRGKAXIFJUGMCIEDECEUCXFAFWEWADFECLCEEUFAIVAJH
QEIEKETECCOCJBAGJJGGAGYFRBVDLCHDIB AES256, EncryptKey MyKey3
END;

MACRO #bpsettings
BEGIN
... Many lines omitted for clarity ...

Note: All the way from Userid through MyKey3 is all one line with no line breaks.
e. Save the file and exit.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 13: Configuration Options


Chapter 13 - Page 6
f. Replace the same value in the macrolib.mac file on the EURO database
(/u01/app/oracle/product/gg_euro/dirmac/macrolib.mac).

Setting Oracle GoldenGate Change Data Capture (efuncs)


5. On the source server AMER_WEST_GGSCI tab, configure the change data capture extract
from a GGSCI prompt:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

GGSCI (AMER)> Edit Param efuncs


The editor of your choice opens the empty efuncs.prm file. Add the following runtime
parameters to the text file:
NoList
Include ./dirmac/macrolib.mac
List
Extract efuncs
e to
ns
EncryptTrail AES256 KeyName MyKey3
ExtTrail ./dirdat/ex
l i ce
a ble
#dbconnect ()
fe r
#bpsettings ()
a ns
Table WEST.WSHOP_ENCRYPT;
n- t r
a no
NoEncryptTrail
h a s ideฺ
ExtTrail ./dirdat/ec
Table WEST.WSHOP_ENCRYPT; co
m) nt Gu
Table WEST.CUST_ZIP; son
ฺ de
s TOKENS t u
r i
Table WEST.WSHOP_FUNCS,
e c
t h i sS (
g @ se= @GETENV ( 'LAG' , 'MSEC' ),
TKN-EXTLAG-MSEC
a
i t ฺ n
TKN-SRC-DBNAMEu = @GETENV ( 'DBENVIRONMENT' , 'DBNAME' ),
s j
u TKN-SRC-DBVERSION = @GETENV ( 'DBENVIRONMENT' , 'DBVERSION'
g ( ),

N a TKN-TXN-CSN = @GETENV ( 'TRANSACTION' , 'CSN' )

ujit
);
S Save and close the file.
6. On the source server AMER_WEST_GGSCI tab, add the Extract group and two local Extract
Trails by executing the following GGSCI commands:
GGSCI (AMER)> DBLogin UserIDAlias gguamer
Successfully logged into database.

GGSCI (AMER)> Add Extract efuncs, TranLog, Begin Now


EXTRACT added.

GGSCI (AMER)> Add ExtTrail ./dirdat/ex, Extract efuncs


EXTTRAIL added.

GGSCI (AMER)> Add ExtTrail ./dirdat/ec, Extract efuncs


EXTTRAIL added.

GGSCI (AMER)>
Notice this Extract group will have two trails: one encrypted (ex) and one plain text (ec).
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 13: Configuration Options


Chapter 13 - Page 7
Setting Up the First GoldenGate Extract Data Pump (pfuncs)
7. On the source server AMER_WEST_GGSCI tab, configure the first Extract Data Pump to read
from the local Extract Trail ./dirdat/ex, transmit the data to the target server, and write
it to the Remote Trail ./dirdat/px:
GGSCI (AMER) > Edit Param pfuncs
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Your text editor opens the empty pfuncs.prm file. Add the following runtime parameters to
the text file:
Extract pfuncs
RmtHost easthost, MgrPort 15001, Compress
RmtTrail ./dirdat/px
Passthru
Table WEST.*;
Save and close the file. e to
8. On the source server AMER_WEST_GGSCI tab, add the Extract group by executing the cens
l i
following commands:
a ble
GGSCI (AMER)> Add Extract pfuncs, ExtTrailsource ./dirdat/ex
fe r
EXTRACT added.
a ns
n- t r
no
GGSCI (AMER)> Add RmtTrail ./dirdat/px, Extract pfuncs
a
RMTTRAIL added.
h a s ideฺ
GGSCI (AMER) >
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
t ฺ n ag us
( s uji
ag
N
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 13: Configuration Options


Chapter 13 - Page 8
Setting Up the Second Oracle GoldenGate Extract Data Pump (pfunca)
9. On the source server AMER_WEST_GGSCI tab, configure the second Extract Data Pump to
read from the local Extract Trail ./dirdat/ec, transmit the data to the target server, and
write it to the Remote Trail ./dirdat/pc:
GGSCI (AMER) > Edit Param pfunca
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

The text editor of your choice opens the empty pfunca.prm file. Add the following runtime
parameters to the text file:
Extract pfunca
RmtHost easthost, MgrPort 15001, Compress
RmtTrail ./dirdat/pc
Passthru
Table WEST.*;
e to
10. On the source server AMER_WEST_GGSCI tab, add the Extract group by executing the
cens
l i
following commands:
a ble
GGSCI (AMER)> Add Extract pfunca, ExtTrailsource ./dirdat/ec
fe r
GGSCI (AMER)> Add RmtTrail ./dirdat/pc, Extract pfunca
a ns
n- t r
Creating the Oracle GoldenGate Checkpoint Table
a no
a s ideฺ
On the target server, Replicat checkpoints to a special table created in the database. This
h
) u
checkpoint table ensures that the Replicat checkpoint is part of the transaction and is used to
m G
o t
ensure data integrity. If it does not already exist, create the checkpoint table:
ฺc den
o n
ss s Stu
11. On the target server EURO_EAST_GGSCI tab, start GGSCI and execute the following
r i c
startup commands. If you are still logged in to GGSCI from a previous lab, skip this task
e t hi
and just continue with the next task.
@ e
g us
ti ฺna
[OS_prompt gg_euro] rlggsci
uj
( s
g GGSCI
N a (EURO) 1> DBLogin UserIDAlias ggueuro

uj i t Successfully logged into database.


S
GGSCI (EURO) 2> Info CheckpointTable
No checkpoint table specified, using GLOBALS specification (GGS_CHECKPOINT)...
Checkpoint table GGS_CHECKPOINT does not exist.

GGSCI (EURO) 3> Add CheckpointTable


No checkpoint table specified, using GLOBALS specification (GGS_CHECKPOINT)...
Successfully created checkpoint table GGS_CHECKPOINT.

GGSCI (EURO) 4> Start mgr

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 13: Configuration Options


Chapter 13 - Page 9
Setting Up Oracle GoldenGate Delivery (Two Replicats: rfunca and rfunc)
12. On the target server EURO_EAST_GGSCI tab, configure the Replicat Delivery components:
GGSCI (EURO) > Edit Param rfunca
The editor of your choice opens the empty rfunca.prm file. Add the following runtime
parameters to the text file:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

NoList
Include ./dirmac/macrolib.mac
List
Replicat rfunca
#dbconnect ()
SourceDefs ./dirdef/section13.defs
DiscardFile ./dirrpt/rfunca.dsc, Purge
e to
#bpsettings ()
cens
#funcsmap (WEST.WSHOP_FUNCS, EAST.WSHOP_FUNCS)
l i
Map WEST.CUST_ZIP, TARGET EAST.CUST_CITY_STATE,
a ble
SQLEXEC (ID ZIPLKUP,
fe r
QUERY ' SELECT zip_city, zip_state FROM east.zip_lookup WHERE
a ns
zip = :vzip ',
n- t r
PARAMS (vzip = cust_zip)),
a no
ColMap (usedefaults,
h a s ideฺ
)
cust_city = @GETVAL (ZIPLKUP.zip_city),
m G u
o
ฺc den
cust_state = @GETVAL (ZIPLKUP.zip_state) t
); s o n tu
r i c s s S
@ e straight'
Note the QUERY has 'single,
e t hi quotes. Save and close the file.
t ฺ n ag > uEdit
13. On the EURO_EAST_GGSCI s tab, execute the command:
s u ji
GGSCI (EURO) Param rfunc
( text editor of your choice opens the empty rfunc.prm file. Add the following runtime
gThe
a
N parameters to the text file:
u j i t
S Replicat rfunc
UserIDAlias ggueuro
AssumeTargetDefs
DiscardFile ./dirrpt/rfunc.dsc, Purge
DecryptTrail AES256 KeyName MyKey3
Map WEST.*, Target EAST.*;
Save and close the file.
14. On the EURO_EAST_GGSCI tab, add the Replicats by executing the following commands:
GGSCI (EURO)> Add Replicat rfunc, ExtTrail ./dirdat/px
GGSCI (EURO)> Add Replicat rfunca, ExtTrail ./dirdat/pc
15. Ensure on both systems that the manager is up and running (if not, start the Manager):
GGSCI (both)> Info mgr
GGSCI (both)> Start mgr

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 13: Configuration Options


Chapter 13 - Page 10
16. In the GG_AMER_HOME window, start all the extracts:
GGSCI (AMER)> Start ER ef*

Sending START request to MANAGER ...


EXTRACT EFUNCS starting
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

GGSCI (AMER)> Start ER pf*

Sending START request to MANAGER ...


EXTRACT PFUNCA starting

Sending START request to MANAGER ...


EXTRACT PFUNCS starting

e to
GGSCI (AMER)>
cens
l i
Verify that all process from this practice are running by executing the Info ER *
a ble
command. You do not care if other processes from previous labs (such as erange*) are
fe r
stopped.
a ns
17. In the GG_EURO_HOME window, start all the Replicats:
n- t r
GGSCI (EURO) > Start ER rf*
a no
Sending START request to MANAGER ...) h
as uideฺ
REPLICAT RFUNC starting
ฺ c om ent G
s n tud
oMANAGER
r i
Sending START request c sto
s S ...
REPLICAT RFUNCA e
startingth i
a g @ s e
n u
s u jitฺ (EURO) >
GGSCI
( that all process are running by executing the Info ER * command. You do not care
gVerify
Na if other processes from previous labs (such as rrange*) are stopped.
S ujit Note: The Replicats may already be running if the mgr.prm was not deleted in an earlier
lab.
This completes Practice 13-2. Continue now with Practice 13-3.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 13: Configuration Options


Chapter 13 - Page 11
Practice 13-3: Generating Transactions and Validating Results
Tasks
1. On the AMER_WEST_SQLPLUS tab, at the SQL prompt, generate source database
transactions by executing the following command:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

[OS_prompt labs] sqlplus west@amer/oracle_4U


@Section13/sqlscripts/trans_generator.sql
2. Verify that the data applied to the target wshop_encrypt table from the encrypted Oracle
GoldenGate Trails is the same as the source data. On the AMER_WEST_SQLPLUS tab, at
the shell prompt, start SQL*Plus and query all rows from the wshop_encrypt table:
[OS_prompt labs] rlsqlplus west@amer/oracle_4U

SQL*Plus: Release 12.1.0.1.0 Production on Mon Dec 9 12:30:54 2013


e to
Copyright (c) 1982, 2013, Oracle. All rights reserved.
cens
l i
SQL> set sqlprompt AMER_SQL>
a ble
AMER_SQL> SELECT * FROM wshop_encrypt;
fe r
a ns
ROW_NUMBER ROW_TEXT
n- t r
---------- -------------------------
a no
1 AWUpbEBePRhIKhRuKBJsrweLW
h a s ideฺ
2 )
yoHddMMKXlGpQLuKSDTRqSSoX
m G u
3 o
ฺc den
ziJvSXUJxEiNqapSPAxdoVUNL t
o n
ss s Stu
4 JnweLVnqmYfjfhjLXeCUAlTTP
5
r i c
UGoIkLswswiqxoqHtaFXBaYcf
6 e t hi
JVFgfYHDSUFyjjQbSWeXBfXca
@ e
g us
ti ฺna
7 XntsrAQJOQqREvPDwvXZYVsbB

s u j 8 ZcDzHjttaYQHUciWpAnMqVSav

g ( 9 bDsUBZNWwrHADHqOhMQrlSlXN

N a 10 lLNtcVEHsclSGwUHPUfqNEhAd

S ujit 10 rows selected.

AMER_SQL>
Your text will be different, but you should have 10 rows of 25 encrypted characters each.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 13: Configuration Options


Chapter 13 - Page 12
3. On the EURO_EAST_SQLPLUS tab, at the shell prompt, start rlsqlplus and query the
wshop_encrypt table:
[OS_prompt labs] rlsqlplus east@euro/oracle_4U

SQL*Plus: Release 12.1.0.1.0 Production on Mon Dec 9 12:30:54 2013


Copyright (c) 1982, 2013, Oracle. All rights reserved.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

SQL> set sqlprompt EURO_SQL>


EURO_SQL> SELECT * FROM wshop_encrypt;

ROW_NUMBER ROW_TEXT
---------- -------------------------
1 AWUpbEBePRhIKhRuKBJsrweLW
2 yoHddMMKXlGpQLuKSDTRqSSoX
e to
3 ziJvSXUJxEiNqapSPAxdoVUNL
cens
4 JnweLVnqmYfjfhjLXeCUAlTTP l i
5 UGoIkLswswiqxoqHtaFXBaYcf
a ble
fe r
6 JVFgfYHDSUFyjjQbSWeXBfXca
a ns
7 XntsrAQJOQqREvPDwvXZYVsbB
n- t r
no
8 ZcDzHjttaYQHUciWpAnMqVSav
9 bDsUBZNWwrHADHqOhMQrlSlXN
a
s ideฺ
10 lLNtcVEHsclSGwUHPUfqNEhAd
) h a u
o m t G
10 rows selected.
o n ฺc den
r i c ss s Stu
hiof encrypted equivalent data.
EURO_SQL>
@ e 10 rows t
Each table should
ag us
contain e
Validatinguthe t ฺ n
ji Token, Macro, and SQLEXEC Information
4. g
( s
N a Inuser-defined
the GG_AMER_HOME terminal window, view the efuncs.prm parameter file. Four

ujit
tokens will be added to each record captured for this table.
S • TKN-EXTLAG-MSEC uses the @GETENV function (all GoldenGate function names begin
with the @ character) to get the Extract database lag from the GoldenGate
environment.
• TKN-SRC-DBNAME gets the source database name from the database environment.
• TKN-SRC-DBVERSION gets the source database version from the database
environment.
• TKN-TXN-CSN gets the commit sequence number for the transaction from the
database.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 13: Configuration Options


Chapter 13 - Page 13
5. On the EURO_EAST_GGSCI tab, view the rfunca.prm parameter file, especially the
SQLEXEC query:
GGSCI (EURO)> View Param rfunca

NOLIST
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

INCLUDE ./dirmac/macrolib.mac
LIST
Replicat rfunca
#dbconnect ()
SourceDefs ./dirdef/section13.defs
DiscardFile ./dirrpt/rfunca.dsc, Purge
#bpsettings ()
#funcsmap (WEST.wshop_funcs, EAST.wshop_funcs)
e to
Map WEST.CUST_ZIP, TARGET EAST.CUST_CITY_STATE,
cens
SQLEXEC (ID ZIPLKUP,
l i
QUERY ' SELECT zip_city, zip_state FROM EAST.zip_lookup
a ble
WHERE zip = :vzip ',
fe r
PARAMS (vzip = cust_zip) ),
a ns
ColMap (usedefaults,
n- t r
cust_city = @GETVAL (ZIPLKUP.zip_city),
a no
a s ideฺ
cust_state = @GETVAL (ZIPLKUP.zip_state)
h
);
m ) G u
o
ฺc den t
o n
GGSCI (EURO)>
r i c ss s Stu
Note: The QUERY must
@ e t hi straight' quotes.
ehave 'single,
ag for the
The Map statement
t ฺ n u swshop_funcs table uses the #funcsmap macro:
u ji #funcsmap
MACRO
s
(
ag BEGIN
PARAMS (#src_table, #target_table)

jit N
Su Map #src_table, TARGET #target_table,
ColMap (usedefaults,
gg_commit_ts = @GETENV ( 'GGHEADER' , 'COMMITTIMESTAMP' ),
lag_extract_ms = @TOKEN ( 'TKN-EXTLAG-MSEC' ),
lag_replicat_ms = @GETENV ( 'LAG' , 'MSEC' ),
src_db_name = @TOKEN ( 'TKN-SRC-DBNAME' ),
src_db_version = @TOKEN ( 'TKN-SRC-DBVERSION' ),
src_txn_csn = @TOKEN ( 'TKN-TXN-CSN' )
);
END;
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, and @TOKEN to get the tokens set by the source Extract. The @GETENV
quotes must be 'single straight' quotes.
Also notice that for the rfunca parameters, the Map statement for EAST.CUST_ZIP uses
the SQLEXEC option to query a lookup table.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 13: Configuration Options


Chapter 13 - Page 14
For every WEST.CUST_ZIP record, the query will be executed using the incoming data for
the cust_zip column in the WHERE clause. The returned data is mapped to the target
zip_city and zip_state columns.
6. On the target database EURO_EAST_SQLPLUS tab, execute the queries from a SQL
prompt. If necessary, restart SQL*Plus:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

[OS_prompt labs] rlsqlplus east@euro/oracle_4U


a. Verify that the token data was applied to the target by executing the following query:
EURO_SQL> SELECT src_db_name, src_db_version, src_txn_csn
FROM wshop_funcs;

SRC_DB_NAM SRC_DB_VERSION SRC_TXN_CSN


---------- ------------------------------------------------------- -----------
AMER Oracle Database 12c Enterprise Edition Release 12.1.0.1 2768888
e to
ns
AMER Oracle Database 12c Enterprise Edition Release 12.1.0.1 2768890
AMER Oracle Database 12c Enterprise Edition Release 12.1.0.1 2768892
l i ce
AMER Oracle Database 12c Enterprise Edition Release 12.1.0.1 2768894
a ble
AMER Oracle Database 12c Enterprise Edition Release 12.1.0.1 2768896
fe r
AMER Oracle Database 12c Enterprise Edition Release 12.1.0.1 2768898
a ns
AMER Oracle Database 12c Enterprise Edition Release 12.1.0.1 2768900
n- t r
AMER
AMER a no
Oracle Database 12c Enterprise Edition Release 12.1.0.1
Oracle Database 12c Enterprise Edition Release 12.1.0.1
2768878
2768882
AMER
h a s ideฺ
Oracle Database 12c Enterprise Edition Release 12.1.0.1 2768886

m ) G u
10 rows selected. o
ฺc den t
o n
r i c ss s Stu
thi
SQL>
@ e
Your SCNs g
a will e
be different.
us execute the following query:
t ฺ n
Still iniEURO_EAST_SQLPLUS,
uj
b.

g (sEURO_SQL> SELECT lag_extract_ms, lag_replicat_ms


N a FROM wshop_funcs;
uj i t
S LAG_EXTRACT_MS LAG_REPLICAT_MS
-------------- ---------------
3369 7470
3369 7472
3369 8473
3369 8473
3369 8473
3369 8473
3369 8473
3369 7470
3369 7470
3369 7470

10 rows selected.

EURO_SQL>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 13: Configuration Options


Chapter 13 - Page 15
In the above example, Extract took 3.3 seconds to capture each record from Oracle
redo, while Replicat lag time (Replicat current time – transaction commit timestamp)
was around 8 seconds. Your lag values may vary.
c. To return the data that was recorded as the source record commit timestamp, execute
the following query:
EURO_SQL> SELECT gg_commit_ts FROM wshop_funcs;
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

GG_COMMIT_TS
---------------------------------------------------------------------------
09-DEC-13 02.37.03.000396 PM
09-DEC-13 02.37.03.000396 PM
09-DEC-13 02.37.03.000396 PM
09-DEC-13 02.37.03.000396 PM
09-DEC-13 02.37.03.000396 PM
e to
09-DEC-13 02.37.03.000396 PM
cens
09-DEC-13 02.37.03.000396 PM
l i
09-DEC-13 02.37.03.000396 PM
a ble
09-DEC-13 02.37.03.000396 PM
fe r
09-DEC-13 02.37.03.000396 PM
a ns
n- t r
10 rows selected.
a no
h a s ideฺ
EURO_SQL>
m ) G u
d. ฺ o
c den
Back on the source database AMER_WEST_SQLPLUS t tab, execute the following query:
n
so Stwest@amer/oracle_4U
u
[OS_prompt labs] rlsqlplus
r i c s s
e. e
Verify the ZIP codes:
@ e t hi
AMER_SQL>
t ฺ n agSELECTu s* FROM cust_zip;
ji
g (suCUST_ID CUST_ZIP
N a ---------- ----------
uj i t 1 80033
S 2 70117
3 94105
4 80202
5 70001

AMER_SQL>
f. Verify the SQLEXEC functionality by executing the following query on the target database
EURO_EAST_SQLPLUS tab:

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 13: Configuration Options


Chapter 13 - Page 16
EURO_SQL> SELECT * FROM cust_city_state;

CUST_ID CUST_CITY CU CUST_ZIP


---------- ------------------------- -- ----------
1 Wheat Ridge CO 80033
2 New Orleans LA 70117
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

3 San Francisco CA 94105


4 Denver CO 80202
5 Jefferson LA 70001

EURO_SQL>
7. Stop the processes for Practice 13-3 and clean up:
a. On the source system AMER_WEST_GGSCI tab, enter the following commands:
e to
ns
GGSCI (AMER)> Stop ER *
GGSCI (AMER)> Delete ER * !
l i ce
GGSCI (AMER)> sh rm dirdat/*
a b le
fe r
s
b. On the target system EURO_EAST_GGSCI tab, enter the following commands:
n
GGSCI (EURO)> Stop ER *
n - tra
GGSCI (EURO)> Delete ER * !
a no
GGSCI (EURO)> sh rm dirdat/*
h a s ideฺ
This completes Practice 13-3. Continue now with) Practice 13-4.
u
o m t G
o n ฺc den
r i c ss s Stu
@ e
e t hi
t ฺ n ag us
( s uji
N ag
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 13: Configuration Options


Chapter 13 - Page 17
Practice 13-4: Encryption Using Wallets
Overview
In previous practices, you used ENCKEYS to manually maintain encryption keys. In this practice,
you will use the Wallet to maintain encryption keys. Wallet keys are the preferred method of
specifying trail encryption.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Tasks
1. On the AMER_WEST_GGSCI tab, open the Wallet:
GGSCI (AMER)> Open Wallet
Opened wallet at location 'dirwlt'.

2. On the AMER_WEST_GGSCI tab, add a master key: (You need only one, but you can have
more than one.)
e to
GGSCI (AMER)> Add MasterKey
cens
Master key 'OGG_DEFAULT_MASTERKEY' added to wallet at location 'dirwlt'. l i
a ble
fe r
GGSCI (AMER)> Info MasterKey
a ns
Masterkey Name: OGG_DEFAULT_MASTERKEY
n- t r
no
Creation Date: Mon Dec 9 15:10:14 2013

a eฺ
s idStatus:
Version: Creation Date:
Mon Dec 9 15:10:14 )2013
h a u Current
1
o m t G
3. The Wallet cannot be explicitly closed,
o n ฺc nor does
d e nit need to be. You can still copy it at this
point. If this really bothers you,
i c tu GGSCI to completely release the Wallet. On
syou canSExit
scopy
the AMER_WEST_GGSCI e rtab,
t h i s
the Wallet single-sign-on file from source to target:

a
GGSCI (AMER)>
n g@ sh u s e dircrd/cwallet.sso $GG_EURO_HOME/dircrd
cp

s
GGSCI
u jitฺ (AMER)> sh cp dirwlt/cwallet.sso $GG_EURO_HOME/dirwlt
4. g ( that the master key made it to the target. On the EURO_EAST_GGSCI tab, execute
Verify
a
N the following commands:
u j i t
S GGSCI (EURO)> Open Wallet
GGSCI (EURO)> Info MasterKey
The information should match on both the source and the target. If you had a shared disk,
this extra step to copy would not be necessary.
5. You are going to use the original extwest, pwest, and reast from the earlier labs. The
two files that need to be modified are the Extract extwest and data pump pwest; the
replicat is okay as is.
On the AMER_WEST_GGSCI tab, edit the extwest and make sure that the last Table line
is a wildcard (as in Lab 6), not restricted (as in Lab 10).
GGSCI (AMER)> Edit Param extwest
Extract extwest
ExtTrail ./dirdat/ew
UserIDAlias gguamer
--Table WEST.ACCOUNT_TRANS, Where (ACCOUNT_TRANS_TYPE = "CR");
Table WEST.*;
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 13: Configuration Options


Chapter 13 - Page 18
6. On the AMER_WEST_GGSCI tab, edit pwest and add one line “EncryptTrail AES256”:
GGSCI (AMER)> Edit Param pwest
Extract pwest
-- Add the following one line:
EncryptTrail AES256
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

RmtHost easthost, MgrPort 15001, Compress


RmtTrail ./dirdat/pe
Passthru
Table WEST.*;
The matching Decrypt in the Replicat is automatic; you do not need to specify it.
7. Start up the source processes. (These are the same as in earlier labs). On the
AMER_WEST_GGSCI tab, enter the following commands:
e to
GGSCI (AMER)> Add Extract extwest, TranLog, Begin Now
cens
EXTRACT added.
l i
a ble
GGSCI (AMER)> Add ExtTrail ./dirdat/ew, Extract extwest
fe r
EXTTRAIL added.
a n s
n r
-t ./dirdat/ew
o
GGSCI (AMER)> Add Extract pwest, ExtTrailSource
EXTRACT added.
s a n eฺ
) ha uidExtract pwest
GGSCI (AMER)> Add RmtTrail ./dirdat/pe,
RMTTRAIL added.
ฺ c om ent G
s s o* n tud
is S ...
ric tothMANAGER
GGSCI (AMER)> Start
e
Sending START request

a g@ starting
EXTRACT EXTWEST
n u s e
s u jitฺ START request to MANAGER ...
Sending

ag ( EXTRACT PWEST starting


N
S ujit GGSCI (AMER)> Info All
8. Start up the target processes. (These are the same as in the earlier labs.) On the
EURO_EAST_GGSCI tab, enter the following commands:
GGSCI (EURO)> Add Replicat reast, ExtTrail ./dirdat/pe
REPLICAT added.

GGSCI (EURO)> Start *


Sending START request to MANAGER ...
REPLICAT REAST starting

GGSCI (EURO)> Info All


9. Insert a row on the source database. On the AMER_WEST_SQLPLUS tab, enter the following
DML:
AMER_SQL> INSERT INTO west.branch VALUES ( 50, 80071 );
AMER_SQL> COMMIT;

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 13: Configuration Options


Chapter 13 - Page 19
10. Verify that the row was replicated to the target database. On the EURO_EAST_SQLPLUS
tab, enter the following query:
EURO_SQL> SELECT * FROM east.branch WHERE branch_number > 45;
BRANCH_NUMBER BRANCH_ZIP
------------- ----------
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

50 80071

EURO_SQL>
11. View the report for the pump. You should see the encryption type at the very end. On the
AMER_WEST_GGSCI tab, enter the following command:
GGSCI (AMER)> View Report pwest
...many lines omitted for clarity...
2013-12-09 16:04:26 INFO OGG-05519 Output trail file encryption: AES256.
e to
This was much simpler than the previous ENCKEYS method. The Wallet method is the
cens
l i
preferred method if available. The only reason that the previous method was shown first is
a ble
that not all Oracle GoldenGate platforms support the Wallet.
fe r
12. Clean up the Oracle GoldenGate environment by executing the following GGSCI
a ns
commands on both the source and target servers in the OGG HOME directories:
n- t r
GGSCI (both)> Stop ER *
a no
a s ideฺ
GGSCI (both)> DBLogin UserID gguser, Password oracle_4U
h
GGSCI (both)> Delete ER *
m ) G u (confirm the delete)
o
ฺc den t (only for the EURO db)
GGSCI (both)> Stopss o n
GGSCI (EURO)> Delete CheckpointTable
mgr ! tu
i
GGSCI (both)>eExit his
r c S
t
g@rm u./dirdat/*
e
[OS_PROMPT]
n a s
u jitฺ
[OS_PROMPT]
s
rm ./dirrpt/*
(
gDo not type the (red comments). If you wanted to automate this cleanup, then stop both
Na GGSCI sessions and run ~/labs/setup/kill-all-ogg.sh from the fifth
S ujit oracle@hostname tab.
This completes Practice 13-4. This completes the practices for Lesson 13. Stop here.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 13: Configuration Options


Chapter 13 - Page 20
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a n s
Practices for n t r
-Lesson 14:
n o
a eฺ Replication
Bidirectional
s
) a
h 14 uid
ฺ c om ent G
Chapter

s s on tud
e ric this S
n a g@ use
u jitฺ
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 1
Practices for Lesson 14: Overview
Practices Overview
In this practice, you configure Oracle GoldenGate to perform real-time data capture and apply
on two active databases with data segregated by location.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Big Picture

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
In the preceding diagram, e
@ t
the AMER and
e hi two
EURO databases are exact copies of one another. Your

n a gEach data
application is load-balanced
u s
across the data centers so that each data center services 50%

u j itฺin sync. This is accomplished bytheconfiguring


of all active accounts. center is also backup to the other, so the two databases
must always
( s be Oracle GoldenGate in Active-
ag mode, with Change Data Capture Extracts reading from each database’s Redo and
Active
N
jit Archive logs, pumping the captured data over TCP/IP to a staging queue (Oracle GoldenGate
Su Remote Trail), and applying via Replicat. Notice the potential for a loop.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 2
Practice 14-1: Two-Way Active-Active Data Replication
Overview
In this practice, you will create the two databases (AMER and EURO) and seed them both with
identical data, and then you will ensure that database logging is enabled.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

In a two-way active-active (bidirectional) replication environment, you must avoid data looping,
where data changes replicated from system A to system B are replicated back to system A.
There are several loop detection and avoidance methods. You will configure each Extract
process to ignore transactions originated by its local Replicat user. This is done by setting the
TranLogOptions ExcludeUser parameter in the Extract parameter file.
Note: If at any time or for any reason you exit GGSCI, make sure you re-DBLogin when you
restart GGSCI. You can do this easily by entering:
GGSCI (BOTH)> Obey /home/oracle/labs/setup/startup.oby
e to
Tasks
cens
l i
1. Note that AMER is no longer the only source database and EURO is no longer the only target
a ble
database. Pay particular attention then to which tab you are entering the commands into.
fe r
On the AMER_WEST_SQLPLUS tab, navigate to the Section14/Practice14-
a ns
1/sqlscripts directory to run the script. To create the AMER database, execute the
n- t r
following commands:
a no
h a s ideฺ
[OS_prompt labs] rlsqlplus west@amer/oracle_4U

m ) G u
SQL> set sqlprompt AMER_SQL> o
ฺc den t
o n
ss s Stu
AMER_SQL> set echo on

e r i c i
AMER_SQL> @Section14/Practice14-1/sqlscripts/ database.sql
AMER_SQL> /*@ t h
n a g use Script to create the source database tables
s u jitฺSQL> This will simulate a banking database used with an OLTP
AMER_ SQL>

g ( AMER_

N a application

uj i t ... Many lines omitted for clarity ...


S Scroll down the terminal window to see what objects were created, and what SQL
statements were executed.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 3
2. To seed the West AMER source database, on the AMER_WEST_SQLPLUS tab, execute the
following commands:
AMER_SQL> @Section14/Practice14-1/sqlscripts/seed_database.sql
AMER_SQL> /*
AMER_SQL> Seed the branch and teller lookup tables with these values
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

AMER_SQL> Number of accounts: 2000


AMER_SQL> Starting account balance: Random up to $10000
AMER_SQL> Number of branches: 40
AMER_SQL> Tellers per branch: 20
AMER_SQL> */
AMER_SQL>
AMER_SQL> TRUNCATE TABLE ACCOUNT;
Table truncated.
e to
cens
l i
... Many lines omitted for clarity ...

a ble
Scroll down the terminal window to see what objects were created, and what SQL
fe r
statements were executed.
a ns
3. On the EURO_EAST_SQLPLUS tab, navigate to the same Section14/Practice14-1/
n- t r
no
sqlscripts directory to run the same scripts. To create the EURO database, execute the
a
following commands:
h a s ideฺ
)
[OS_prompt labs] rlsqlplus east@euro/oracle_4U
m G u
o
ฺc den t
o n
sson s Stu
SQL> set sqlprompt EURO_SQL>
r i c
hi
EURO_SQL> set echo
EURO_SQL> @
e t
a g u s e
@Section14/Practice14-1/sqlscripts/ database.sql
EURO_
j i n /*
tฺSQL>
u
(sEURO_SQL> Script to create the source database tables
a g
i t N EURO_SQL> This will simulate a banking database used with an OLTP

S uj application
... Many lines omitted for clarity ...
Scroll down the terminal window to see that the same objects were created for schema
east as for west, and the same SQL statements were executed.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 4
4. To seed the East EURO source database, on the EURO_EAST_SQLPLUS tab, execute the
following commands:
EURO_SQL> @Section14/Practice14-1/sqlscripts/seed_database.sql
EURO_SQL> /*
EURO_SQL> Seed the branch and teller lookup tables with these values
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

EURO_SQL> Number of accounts: 2000


EURO_SQL> Starting account balance: Random up to $10000
EURO_SQL> Number of branches: 40
EURO_SQL> Tellers per branch: 20
EURO_SQL> */
EURO_SQL>
EURO_SQL> TRUNCATE TABLE ACCOUNT;
Table truncated.
e to
cens
l i
... Many lines omitted for clarity ...

a ble
Scroll down the terminal window to see what objects were created, and what SQL
fe r
statements were executed.
a ns
n- t r
Creating the Replicat Checkpoint Table on AMER
a no
h a s ideฺ
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. You
m ) G u
already had configured one for EURO (but it was deleted as part of the last cleanup).
o
c Todecreate
ฺAMER. t
n the GLOBALS parameter file, on the
5. Make sure GGSCI is not running in
o n tu command:
r i c
AMER_WEST_GGSCI tab, execute ss the s S
following
e
[OS_prompt gg_amer]
@ e t hi GLOBALS
vi
ag or any
You can usengedit
t ฺ u stext editor instead of vi. Input the following parameter line:
( s uji
CheckpointTable GGS_CHECKPOINT

N agNote: The file name must be all uppercase with no extension. Save and close the file.
S ujit 6. To create the checkpoint table on the AMER database server, on the AMER_WEST_GGSCI
tab, start GGSCI and execute the following commands:
[OS_prompt gg_amer] more GLOBALS
CheckpointTable GGS_CHECKPOINT

[OS_prompt gg_amer] rlggsci


Oracle GoldenGate Command Interpreter for Oracle

GGSCI (AMER) 1> DBLogin UserIDAlias gguamer


Successfully logged into database.

GGSCI (AMER) 2> Add CheckpointTable


No checkpoint table specified, using GLOBALS specification (GGS_CHECKPOINT)...
Successfully created checkpoint table GGS_CHECKPOINT.

GGSCI (AMER) 3> set editor gedit  This is optional…

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 5
Note: If the checkpoint table already exists, you will receive an error message. If so, issue
the Delete CheckpointTable command, confirm the deletion, and then try adding the
checkpoint table again.

Creating the Replicat Checkpoint Table on EURO


7. To create the checkpoint table on the EURO database server, start GGSCI and execute the
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

following commands:
[OS_prompt gg_euro] rlggsci

Oracle GoldenGate Command Interpreter for Oracle

GGSCI (EURO) 1> DBLogin UserIDAlias ggueuro


Successfully logged into database.

e to
GGSCI (EURO) 2> Add CheckpointTable
cens
l i
No checkpoint table specified, using GLOBALS specification (GGS_CHECKPOINT)...

a ble
Successfully created checkpoint table GGS_CHECKPOINT.
fe r
a ns
GGSCI (EURO) 3> set editor gedit
n- t r
 This is optional…

no
Note: If the checkpoint table already exists, you will receive an error message. If so, issue
a
h a s ideฺ
the Delete CheckpointTable command, confirm the deletion, and then try adding the
checkpoint table again.
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
N a
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 6
Getting the Database to Log Keys
As you have seen in previous practices, the Oracle database must be set to log the table key
values whenever it logs a row change, so that they are available to Oracle GoldenGate in Redo.
8. On the AMER_WEST_GGSCI database server tab, execute the following commands:
GGSCI (AMER) > Add TranData WEST.*
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Many of these were already enabled. Had you originally done SchemaTranData, the
added tables would have automatically been picked up. Validate table-level supplemental
logging is on by executing the following command in the GG_AMER_HOME terminal window:
GGSCI (AMER) > Info TranData WEST.*
9. On the EURO_EAST_GGSCI database server tab, execute the following commands:
GGSCI (EURO) > Add TranData EAST.*
All of these were new (as compared to AMER’s TranData). Validate that table-level
e to
supplemental logging is on by executing the following command in the GG_EURO_HOME
cens
terminal window:
l i
GGSCI (EURO) > Info TranData EAST.*
a ble
Dropping a table and re-creating it will cause you to need to re-add the TranData, fe r
a ns
because TranData does not persist across a DDL TABLE DROP/CREATE. However,
SchemaTranData does effectively persist (well, actually it gets re-added) across a TABLE n- t r
DROP/CREATE. a no
h a s ideฺ
Creating the Oracle GoldenGate Components
m ) onGAMER u
o
ฺc Extract, e t
n Data Pump Extract, and Replicat on the
s o n
In this practice, you will configure the Manager,
tu d
AMER instance.
r i c s s S
From the previous practices,
@ e t hi still
ethisyoupractice,
should have a number of parameter files already created
for the AMER database.
n a g usFor you will be using:

s u jitฺ
• mgr.prm

a g• ( extwest.prm
N • pwest.prm
S ujit You will modify those three parameter files for this practice and create a number of new entries
for both the AMER and EURO databases.

Configuring Change Data Capture, AMER to EURO


10. On the AMER_WEST_GGSCI tab, execute the following command:
GGSCI (AMER) > Edit Param mgr
Verify that it includes the following:
Port 15000
DynamicPortList 15100-15150
PurgeOldExtracts ./dirdat/*, UseCheckpoints

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 7
11. Start the Manager and verify that it is running. Note there is no harm in trying to start it
twice:
GGSCI (AMER)> Start mgr
Manager started.

GGSCI (AMER)> Start mgr


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

MGR is already running.

GGSCI (AMER)> Info mgr


Manager is running (IP port westhost.15000, Process ID 32173).

GGSCI (AMER)>
12. On the AMER_WEST_GGSCI tab, modify the extract file by executing the following
e to
ns
command:
GGSCI (AMER) > Edit Param extwest
l i ce
b
Add the following parameter on an empty line just before the first Table statement:
a le
TranLogOptions ExcludeUser gguser fe r
n s
n - tra
Edit and verify that the extwest.prm file looks similar to the following:
Extract extwest
a no
ExtTrail ./dirdat/ew
h a s ideฺ
UserIDAlias gguamer
m ) G u
StatOptions ResetReportStats o
ฺc den t
Report At 00:01 s o n tu
ReportRollover rAt i c s00:01 s S
@ e 1000
e t hi Records
ReportCount
t ฺ n ag Every
Every
u s 60 Seconds, Rate
uji
ReportCount

g ( sTranLogOptions ExcludeUser gguser


N a Table WEST.*;
jit
Su Note: Your file may look slightly different depending on how you completed Lab 10-3.
If extwest has the line that says:
Table WEST.ACCOUNT_TRANS, Where (ACCOUNT_TRANS_TYPE = "CR");
then remove that one line, or comment it out, and replace it with:
Table WEST.*;
because the Where () clause will cause conflicts here.
Do not forget the last trailing semi-colon. Save and close the file.
13. Add the Extract group by executing the following GGSCI commands:
• Add Extract extwest, Tranlog, Begin Now
This adds the extwest Extract to Oracle GoldenGate specifying that it will read from
Oracle DB Redo/Archive logs, with an initial Redo checkpoint of the current timestamp.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 8
• Add ExtTrail ./dirdat/ew, Extract extwest, Megabytes 50
This adds the dirdat/ew Local Extract Trail, and links the trail to the extwest
Extract.
GGSCI (AMER)> Add Extract extwest, TranLog, Begin Now
EXTRACT added.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

GGSCI (AMER)> Add ExtTrail ./dirdat/ew, Extract extwest


EXTTRAIL added.

GGSCI (AMER)>
14. On the AMER_WEST_GGSCI tab, configure the Extract Data Pump to read from the
dirdat/ew (“Extract West”) local Extract Trail, transmit the data to the EURO server, and
write it to the ./dirdat/pe (“Pump East”) Remote Trail:
e to
Execute the following command:
cens
GGSCI (AMER)> Edit Param pwest
l i
Verify that the file includes the following: (EncryptTrail is optional.)
a ble
fe r
Extract pwest
a ns
EncryptTrail AES256  This is optional…
n- t r
RmtHost easthost, MgrPort 15001, Compress
a no
RmtTrail ./dirdat/pe
h a s ideฺ
Passthru
m ) G u
Table WEST.*; o
ฺc den t
o n
Save and close the file.
r i c ss s Stu
15. Add the Extract groupe
@ t
by executing
e hi the following commands:
n ag Add
GGSCI (AMER)>
t ฺ u s Extract pwest, ExtTrailSource ./dirdat/ew

( s uji added.
EXTRACT

N ag GGSCI (AMER)> Add RmtTrail ./dirdat/pe, Extract pwest


S ujit RMTTRAIL added.

GGSCI (AMER)>
16. To set up Oracle GoldenGate Delivery on the AMER database, you must configure the
Replicat component. On the AMER_WEST_GGSCI tab, execute the following command:
GGSCI (AMER)> Edit Param rwest
The text editor of your choice opens the empty rwest.prm file. Add the following runtime
parameters to the text file:
Replicat rwest
AssumeTargetDefs
DiscardFile ./dirrpt/rwest.dsc, Purge
UserIDAlias gguamer
Map EAST.*, Target WEST.*;
Save and close the file.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 9
17. Add the Replicat by executing the following GGSCI command:
GGSCI (AMER)> Add Replicat rwest, ExtTrail ./dirdat/pw
REPLICAT added.

GGSCI (AMER)>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Creating the Oracle GoldenGate Components on EURO


Now you will configure the Manager, Extract, Data Pump Extract, and Replicat on the EURO
instance.
From the previous practices, you should still have a number of parameter files already created
for the EURO database. For this practice, you will be using:
• mgr.prm
• reast.prm
e to
You will modify these parameter files in this practice and create a number of new entries and a
cens
new parameter file for both the AMER and EURO databases. l i
a ble
Configuring the Change Data Capture, EURO to AMER fe r
a ns
18. On the EURO_EAST_GGSCI tab, execute the following:
n- t r
GGSCI (EURO)> Edit Param mgr
a no
Verify that it includes at least the following:
h a s ideฺ
Port 15001
m ) G u
PurgeOldExtracts ./dirdat/*, o e n t
ฺc dUseCheckpoints
o n tu
s it is running:
19. Start the Manager and verifysthat S
r i c s
GGSCI (EURO)>eStart tmgr
@ e hi
t ฺ n
GGSCI (EURO)>ag Info
u s manager
s
20. On the ji
uEURO_EAST_GGSCI tab, create the extract file by executing the following:
(
N ag GGSCI (EURO)> Edit Param eeast
S ujit The text editor of your choice opens the empty eeast.prm file. Add the following runtime
parameters to the text file:
Extract eeast
ExtTrail ./dirdat/ee
UserIDAlias ggueuro
TranLogOptions ExcludeUser GGUSER
Table EAST.*;
Save and close the file.
21. On the EURO_EAST_GGSCI tab, add the Extract group by executing the following
commands:
• Add Extract eeast, Tranlog, Begin Now
This adds the eeast Extract to GoldenGate, specifying that it will read from Oracle
Redo/Archive with an initial Redo checkpoint of the current timestamp.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 10
• Add ExtTrail ./dirdat/ee, Extract eeast
This adds the dirdat/ee local Extract Trail, and links the trail to the Extract eeast.
GGSCI (EURO)> Add Extract eeast, TranLog, Begin Now
EXTRACT added.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

GGSCI (EURO)> Add ExtTrail ./dirdat/ee, Extract eeast


EXTTRAIL added.

GGSCI (EURO)>
22. On the EURO_EAST_GGSCI tab, configure the Extract Data Pump to read from the
dirdat/ee local Extract Trail, transmit the data to the AMER server, and write it to the
dirdat/pw Remote Trail:
From a GGSCI prompt, execute the following command:
e to
GGSCI(EURO)> Edit Param peast
cens
Your text editor of choice opens the empty peast.prm file. Add the following runtime l i
parameters to the text file:
a ble
fe r
Extract peast
a ns
RmtHost westhost, MgrPort 15000, Compress
n- t r
RmtTrail ./dirdat/pw
a no
Passthru
h a s ideฺ
Table EAST.*;
m ) G u
o
ฺc den t
Save and close the file.
o n
s add the u group by executing the following
tExtract
23. On the EURO_EAST_GGSCIs tab, S
r i c s
commands:
@ e
e t hi
ag Add
GGSCI (EURO)>
t ฺ n u s Extract peast, ExtTrailSource ./dirdat/ee
( s uji
EXTRACT added.

N ag GGSCI (EURO)> Add RmtTrail ./dirdat/pw, Extract peast


S ujit RMTTRAIL added.

GGSCI (EURO) >


24. To set up Oracle GoldenGate Delivery on the EURO database, you must modify the Replicat
parameter file. On the EURO_EAST_GGSCI tab, execute the following command:
GGSCI (EURO)> Edit Param reast
Verify that it includes the following:
Replicat reast
AssumeTargetDefs
DiscardFile ./dirrpt/reast.dsc, Purge
UserIDAlias ggueuro
Map WEST.*, Target EAST.*;
Save and close the file.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 11
25. On the EURO_EAST_GGSCI tab, add the Replicat by executing the following command:
GGSCI (EURO)> Add Replicat reast, ExtTrail ./dirdat/pe
REPLICAT added.

GGSCI (EURO) >


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Validating the Results


26. On both the AMER_WEST_GGSCI tab and the EURO_EAST_GGSCI tab, execute the
following commands to start all of the configured Extracts and Replicats:
For AMER, the processes should all end in WEST:
GGSCI (AMER)> Start ER *

to
Sending START request to MANAGER ...
EXTRACT EXTWEST starting
ns e
Sending START request to MANAGER ...
l i ce
EXTRACT PWEST starting
a ble
Sending START request to MANAGER ...
fe r
REPLICAT RWEST starting
a ns
n- t r
GGSCI (AMER)>
a no
h a s ideฺ
For EURO, the processes should all end in EAST:
GGSCI (EURO)> Start ER *
m ) G u
o
ฺc ...den t
o n
Sending START request to MANAGER

r i c s s Stu
EXTRACT EEAST starting s
i ...
e tothMANAGER
@
Sending START request
ag us
EXTRACT PEAST starting e
t ฺ n
( s uji START request to MANAGER ...
Sending

a g REPLICAT REAST starting

N
ujit
GGSCI (EURO)>
S

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 12
27. Execute the following GGSCI commands to make sure that all of the components are in the
RUNNING state:
On the AMER_WEST_GGSCI tab:
GGSCI (AMER)> Info ER *
EXTRACT EXTWEST Last Started 2013-12-10 14:24 Status RUNNING
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Checkpoint Lag 00:00:00 (updated 00:00:07 ago)


Process ID 425
Log Read Checkpoint Oracle Redo Logs
2013-12-10 14:25:14 Seqno 301, RBA 25918464
SCN 0.6226792 (6226792)

EXTRACT PWEST Last Started 2013-12-10 14:24 Status RUNNING


Checkpoint Lag 00:00:00 (updated 00:00:02 ago)
Process ID 426
Log Read Checkpoint File ./dirdat/ew000000
First Record RBA 1417
e to
cens
REPLICAT RWEST Last Started 2013-12-10 14:24 Status RUNNING
l i
Checkpoint Lag
Process ID
00:00:00 (updated 00:00:05 ago)
427
a ble
Log Read Checkpoint File ./dirdat/pw000000
fe r
First Record RBA 0
a ns
n- t r
no
GGSCI (AMER) >
a
s ideฺ
Write down the Log Read Checkpoint RBA numbers you see on your screen:
) h a u
Answer:__________________________________________________________________
o m t G
On the EURO_EAST_GGSCI tab:
GGSCI (EURO) > Infoso
ฺc
ERn* tud
en
ics hStarted
EEASTer Last is S 2013-12-10 14:24 Status RUNNING
EXTRACT
Checkpoint g @ s00:00:00
e t
ProcessnIDa Lag
u
(updated 00:00:08 ago)

itฺ Checkpoint Oracle Redo Logs


Log jRead
u
460

g( s 2013-12-10 14:28:30 Seqno 234, RBA 372736

N a SCN 0.4194269 (4194269)

uj i t
S EXTRACT PEAST
Checkpoint Lag
Last Started 2013-12-10 14:24
00:00:00 (updated 00:00:01 ago)
Status RUNNING

Process ID 461
Log Read Checkpoint File ./dirdat/ee000000
First Record RBA 1413

REPLICAT REAST Last Started 2013-12-10 14:24 Status RUNNING


Checkpoint Lag 00:00:00 (updated 00:00:06 ago)
Process ID 462
Log Read Checkpoint File ./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, view the group’s
report file, fix the error condition, and restart the group.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 13
28. Start database activity by running the transaction generators simultaneously in the shells.
On the AMER_WEST_SQLPLUS tab, generate transactions for the AMER database by
executing the following script:
AMER_SQL> @Section14/Practice14-1/sqlscripts/trans_generator_west.sql
On the EURO_EAST_SQLPLUS tab, generate transactions for the EURO database by
executing the following script:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

EURO_SQL> @Section14/Practice14-1/sqlscripts/trans_generator_east.sql
29. After a minute (West takes longer than East), the transaction generator scripts complete.
Then execute the GGSCI command on each system:
GGSCI (BOTH)> Info ER *
This will display information for the two Replicats. When the Log Read Checkpoint RBA
value returned stops (slows) incrementing for the Replicats, all the captured data has been
applied.
e to
ns
Compare the RBA values with those you wrote down earlier, after you started the Replicats
and Extracts. The RBA values should now be much higher.
l i ce
30. Execute the command on the AMER_WEST_GGSCI tab to get operation counts per table for
a ble
the change data capture Extract:
fe r
GGSCI (AMER)> Stats extwest, Total
a n s
On the EURO_EAST_GGSCI tab, execute the same commandnfor
r
-t the Replicat.
o
GGSCI (EURO)> Stats reast, Total
s a n eฺ
ha (on EURO)
The counts for the Extract (on AMER) and Replicat
) u id numbers should match.
31. Do the same for the EEAST Extract andothe
c mRWESTn G The transaction counts for
t Replicat.
these components should match as ฺ e
on tud tab to get operation counts per table for
well.
s sEURO_EAST_GGSCI
is S
Execute the command on c
e i the
rExtract: h
the change data capture
g@ Stats t
e eeast, Total
a
GGSCI (EURO)>
n u s
s jitฺ
On theuAMER_WEST_GGSCI tab, execute the same command for the Replicat.
(
g GGSCI (AMER)> Stats rwest, Total
a
N The counts for the Extract (on EURO) and Replicat (on AMER) numbers should match.
S ujit Because TranLogOptions ExcludeUser GGUSER was specified in the Extract
parameter files on both AMER and EURO, it ensured that changes made by the local Replicat
user will not be extracted along with changes made by other users on that site.
32. Clean up the Oracle GoldenGate environment by executing the following GGSCI command.
This one script will reset both the source and target servers:
a. Exit both GGSCI prompts. This is necessary for the kill shell script.
b. On the fifth tab oracle@hostname, at the OS prompt, run:
[OS_prompt] ~/labs/setup/kill-all-ogg.sh
This completes Practice 14-1. Continue now with Practice 14-2.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 14
Practice 14-2: Conflict Detection and Resolution
Overview
Because Oracle GoldenGate is an asynchronous solution, in a dual active environment,
conflicts can occur when modifications are made to identical sets of data on separate systems
at the same time.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Conflicts occur when the timing of simultaneous changes results in one of the following out-of-
sync conditions:
• A replicated insert attempts to add a row that already exists in the target.
• The Before image of a replicated update does not match the current row in the target.
• A replicated delete attempts to remove a row that does not exist in the target.
For example, UserA on DatabaseA updates a row, and UserB on DatabaseB updates the same
row. If UserB’s transaction occurs before UserA’s transaction is synchronized to DatabaseB,
e to
there will be a conflict on the replicated transaction.
cens
In this practice, you will set up a very simple Oracle GoldenGate configuration to demonstrate l i
net change value. Conflict detection and conflict resolution will be implemented to maintain
a ble
accurate inventory counts when the application uses update statements to decrement inventory.
fe r
The premise for this demonstration is an online retail environment where:
a ns
1. The warehouse is stocked with 20 widgets. If the quantity on hand goes to 0, the item n- t r
no
is tagged as out of stock in our online ordering system.
a
a s ideฺ
2. Customer A places an order for 15 widgets that is routed through the AMER (also
h
known as West) database.
m ) G u
o
ฺc den
• The SQL statement executed is: t
o n
r i c ss s Stu
UPDATE products SET qty_in_stock = qty_in_stock + 10

hi
WHERE products_name = 'widget' AND qty_in_stock = 20;
@ e t
e
3. Customer B simultaneously places an order for 4 widgets that is routed through the
g us
ti ฺna
EURO (also known as East) database.
• ujThe SQL statement executed is:
g ( s
N a UPDATE products SET qty_in_stock = qty_in_stock + 4

uj i t WHERE products_name = 'widget' AND qty_in_stock = 20;


S In this example, the number of widgets in stock according to the AMER database is 30, and
the number in stock according to the EURO database is 24.
With conflict detection enabled, when Oracle GoldenGate attempts to update the EURO
(East) database with the transaction from customer A, routed through AMER (West), the
transaction will fail because the before image (from AMER) of qty_in_stock is 20, which
does not match the current column value of 24 in EURO. Conversely, the transaction
replicated to the AMER (West) database will also fail because the before image (from EURO)
of qty_in_stock, 20, does not match the current column value of 30 in AMER.
To resolve the conflict, you will add code in the Replicat Delivery configuration to add the
sum total of the orders from both sites, so that the resulting qty_in_stock values after
the replicated transactions are applied will be the same on both sites. The result is 34.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 15
Big Picture
The following flowchart shows the components and relationships that you will create:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
Tasks
h a s ideฺ
m ) G u
Creating the Table and Data in the ฺDatabase o
c den t
o
1. On the AMER_WEST_SQLPLUSstab, create
n tuthe table in the AMER database by executing the
following commands. If r i c sare stillsconnected
S
e you
t h i as west@amer, then just run the .sql
script:
n a g@ use
j i tฺ
[OS_prompt
u
labs] rlsqlplus west@amer/oracle_4U

g (sSQL> set sqlprompt AMER_SQL>


N a AMER_SQL> set echo on
uj i t AMER_SQL> @Section14/Practice14-2/sqlscripts/database_west.sql
S Scroll down the terminal window to see what objects were created, and what SQL
statements were executed.
2. On the EURO_EAST_SQLPLUS tab, create the identical table in the EURO database by
executing the following commands. If you are still connected as east@euro, then just run
the .sql script:
[OS_prompt labs] rlsqlplus east@euro/oracle_4U
SQL> set sqlprompt EURO_SQL>
EURO_SQL> set echo on
EURO_SQL> @Section14/Practice14-2/sqlscripts/database_east.sql
So far the tables and data are identical for schemas east and west. Leave sqlplus
running.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 16
Getting the Database to Log Keys and Columns
3. On the AMER_WEST_GGSCI tab, execute the following commands to turn on supplemental
logging. The Cols option adds more than the primary key to the Before image. Enter each
command all on one line, with no line breaks:
[OS_prompt gg_amer] rlggsci
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Oracle GoldenGate Command Interpreter for Oracle

GGSCI (AMER) 1> DBLogin UserIDAlias gguamer


Successfully logged into database.

GGSCI (AMER) 2> Add TranData WEST.PRODUCTS, Cols (product_name,


vendor, qty_in_stock, modified_ts)
Logging of supplemental redo data enabled for table WEST.PRODUCTS.
TRANDATA for scheduling columns has been added on table 'WEST.PRODUCTS'.
e to
GGSCI (AMER) 3> Info TranData WEST.PRODUCTS
cens
l i
le
Logging of supplemental redo log data is enabled for table WEST.PRODUCTS.
Columns supplementally logged for table WEST.PRODUCTS: PRODUCT_NUMBER,
r a b
PRODUCT_NAME, VENDOR, QTY_IN_STOCK, MODIFIED_TS.

ns fe
4. On the EURO_EAST_GGSCI tab, execute the following commands to enable supplemental
t r a
logging:
no n-
[OS_prompt gg_euro] rlggsci a
sOracleideฺ
Oracle GoldenGate Command Interpreter for
h a
GGSCI (EURO) 1> DBLogin c o m) nt Gggueuro
UserIDAlias
u
Successfully logged into o
s nฺ tude
database.

GGSCI (EURO) e
cs is S EAST.PRODUCTS, Cols (product_name,
2>ri Add TranData
g @ e th modified_ts)
vendor,
s
qty_in_stock,
ฺnofa supplemental
u
u j i
Loggingt redo data enabled for table WEST.PRODUCTS.

g (sTRANDATA for scheduling columns has been added on table 'EAST.PRODUCTS'.

N a
uj i t GGSCI (EURO) 3> Info TranData EAST.PRODUCTS
S Logging of supplemental redo log data is enabled for table EAST.PRODUCTS.
Columns supplementally logged for table EAST.PRODUCTS: PRODUCT_NUMBER,
PRODUCT_NAME, VENDOR, QTY_IN_STOCK, MODIFIED_TS.

Configuring and Starting the GoldenGate Manager on AMER and EURO


5. On the AMER_WEST_GGSCI tab, verify that the Manager parameter file is configured:
GGSCI (AMER)> Edit Param mgr
Verify that the following parameters are present:
Port 15000
DynamicPortList 15100-15150
PurgeOldExtracts ./dirdat/*, Usecheckpoints
Save and close this file.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 17
6. Start the West Manager process:
GGSCI (AMER)> Start mgr
Manager started.

GGSCI (AMER)> Info manager


Manager is running (IP port westhost.15000 , Process ID 1993).
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

GGSCI (AMER)>
7. On the EURO_EAST_GGSCI tab, verify that the Manager parameter file is configured:
GGSCI (EURO)> Edit Param mgr
Verify that at least the following parameters are present:
Port 15001
PurgeOldExtracts ./dirdat/*, UseCheckpoints
e to
Save and close this file.
cens
8. Start the East Manager process: l i
GGSCI (EURO)> Start mgr
a ble
fe r
Manager started.
a ns
n- t r
no
GGSCI (EURO)> Info manager
a
Manager is running (IP port easthost.15001, Process ID 18408).
s ideฺ
) h a u
GGSCI (EURO)>
o m t G
o n ฺc den
Setting Up Change Data Capture
i c ss on tu
AMER
S
9. On the AMER_WEST_GGSCI r i
e tab,thexecutes the following command to create and edit the
a @
g us
parameter file for the “Extracte West Conf lict” group, ewconf:
n
jitฺ (AMER)> Edit Param ewconf
GGSCI
s u
( text editor of your choice opens the empty ewconf.prm file. Add the following runtime
a gThe
jit N parameters to the text file:
Su Extract ewconf
ExtTrail ./dirdat/wf
UserIDAlias gguamer
GetUpdateBefores
TranLogOptions ExcludeUser gguser
Table WEST.PRODUCTS GetBeforeCols(On Update All);
Check the Reference for Oracle GoldenGate in ~/Documents. Write down the purpose of
the GetUpdateBefores parameter:
Answer:_________________________________________________________________
Save and close the file.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 18
10. On the AMER_WEST_GGSCI tab, add the Extract Group, ewconf to start extracting now and
to write to a trail file in the dirdat directory with a name of wf by executing the following
commands:
GGSCI (AMER)> Add Extract ewconf, TranLog, Begin Now
EXTRACT added.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

GGSCI (AMER)> Add ExtTrail ./dirdat/wf, Extract ewconf


EXTTRAIL added.

GGSCI (AMER)>
11. On the AMER_WEST_GGSCI tab, set up the Extract Data Pump on the AMER database by
executing the following command:
GGSCI (AMER)> Edit Param pwconf
The text editor of your choice opens the empty pwconf.prm file. Add the following runtime
e to
parameters to the text file:
cens
Extract pwconf l i
a ble
RmtHost easthost, MgrPort 15001, Compress
fe r
RmtTrail ./dirdat/pf
a ns
Passthru
n- t r
Table WEST.*;
a no
Save and close the file.
h a s ideฺ
12. On the AMER_WEST_GGSCI tab, add the m ) PumpGExtract
Data u group by executing the
o
c dData
following commands. Configure the ฺExtract e t
nPump to read from the dirdat/wf local
o n
r i c s s Stuserver, and write it to the dirdat/pf Remote
Extract Trail, transmit the datasto the AMER
Trail:
@ e
e t hi pwconf, ExtTrailSource ./dirdat/wf
t ฺ n ag us
GGSCI (AMER)> Add Extract

uji
EXTRACT added.

( s
g GGSCI (AMER)> Add RmtTrail ./dirdat/pf, Extract pwconf
N a
ujit
RMTTRAIL added.

S GGSCI (AMER) >

Setting Up the EURO Database for Delivery


13. You need a checkpoint table for this task. It may already exist from a previous lab. After
logging in to the database, try the Info command. If the checkpoint table exists, go to the
next step. If the checkpoint table does not exist, run the Add command. To test or create
the checkpoint table, on the EURO_EAST_GGSCI tab, execute the following commands:
GGSCI (EURO)> Info CheckpointTable
GGSCI (EURO)> Add CheckpointTable

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 19
14. On the EURO_EAST_GGSCI tab, configure the Replicat Delivery component by executing
the following command:
GGSCI (EURO)> Edit Param reconf
The text editor of your choice opens the empty reconf.prm file. Add the following runtime
parameters to the text file:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Replicat reconf
AssumeTargetDefs
DiscardFile ./dirrpt/reconf.dsc, Purge
UserIDAlias ggueuro
AllowDupTargetMap
IgnoreUpdates
Map WEST.*, Target EAST.*;
GetUpdates
e to
IgnoreInserts
cens
l i
IgnoreDeletes
a ble
Map WEST.products, Target EAST.products,
fe r
CompareCols(On Update All),
a ns
ResolveConflict (UpdateRowExists, n- t r
a no
(delta_resolution_method, UseDelta, Cols (qty_in_stock)),
(max_resolution_method,
h a s ideฺ
UseMax (modified_ts), Cols
(vendor, modified_ts)),
m ) G u
o
ฺc den t
(Default, Overwrite));
o n u
This Map statement performs
r i c ssthe conflict
s S tdetection and resolution on the WEST.PRODUCTS
e
table for transactions performed t h
oni the EAST.PRODUCTS table. For all update operations, a
@ e
ag againstusthe target table and the data from the qty_in_stock column is
query is executed
returned.jitฺn
(
If thes u
Before (source) and current (target) values for qty_in_stock are not equal (that is,
N aga conflict is detected), the source table value for qty_in_stock is subtracted from the
jit
Su source Before image qty_in_stock value. The result is then subtracted from the current
target qty_in_stock value (returned from the query), and the result is applied to the
target table.
Save and close the file.
15. On the EURO_EAST_GGSCI tab, add the Replicat by executing the following command:
GGSCI (EURO)> Add Replicat reconf, ExtTrail ./dirdat/pf
REPLICAT added.

GGSCI (EURO)>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 20
Configuring Data Capture on EURO
16. On the EURO_EAST_GGSCI tab, execute the following command to configure the primary
Extract:
GGSCI (EURO)> Edit Param eeconf
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

The text editor of your choice opens the empty eeconf.prm file. Add the following runtime
parameters to the text file:
Extract eeconf
ExtTrail ./dirdat/eg
UserIDAlias ggueuro
GetUpdateBefores
TranLogOptions ExcludeUser gguser
Table EAST.PRODUCTS GetBeforeCols(On Update All);
e to
17. On the EURO_EAST_GGSCI tab, add the Extract group by executing the following
cens
l i
commands. Add the Extract group eeconf to start extracting now and to write to a trail file
a ble
in the dirdat directory with a name of eg.
fe r
GGSCI (EURO)> Add Extract eeconf, TranLog, Begin Now
a ns
EXTRACT added.
n- t r
a no
h a s ideฺ
GGSCI (EURO)> Add ExtTrail ./dirdat/eg, Extract eeconf
EXTTRAIL added.
m ) G u
GGSCI (EURO)> o
ฺc den t
o n tuthe Extract Data Pump to read from the
s configure
18. On the EURO_EAST_GGSCIs tab, S
r i c s
dirdat/eg local Extract
@ e hi the data to the AMER server, and write it to the
e Trail,ttransmit
dirdat/pg Remote
t ฺ n ag Edit
Trail:
u s
s u ji
GGSCI (EURO)> Param peconf
( text editor of your choice opens the empty peconf.prm file. Add the following runtime
gThe
a
N parameters to the text file:
u j i t
S Extract peconf
RmtHost westhost, MgrPort 15000, Compress
RmtTrail ./dirdat/pg
Passthru
Table EAST.*;
Save and close the file.
19. On the EURO_EAST_GGSCI tab, add the Extract group by executing the following
commands:
GGSCI (EURO)> Add Extract peconf, ExtTrailSource ./dirdat/eg
EXTRACT added.

GGSCI (EURO)> Add RmtTrail ./dirdat/pg, Extract peconf


RMTTRAIL added.

GGSCI (EURO)>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 21
Creating the Delivery Components on the AMER Database
20. On the AMER_WEST_GGSCI tab, create the checkpoint table on the AMER database server
by executing the following command:
GGSCI (AMER)> Add CheckpointTable
No checkpoint table specified, using GLOBALS specification (GGS_CHECKPOINT)...
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Successfully created checkpoint table GGS_CHECKPOINT.

GGSCI (AMER)>
21. On the AMER_WEST_GGSCI tab, configure the Replicat delivery component:
GGSCI (AMER)> Edit Param rwconf
The text editor of your choice opens the empty rwconf.prm file. Add the following runtime
parameters to the text file:
Replicat rwconf
e to
AssumeTargetDefs
cens
DiscardFile ./dirrpt/rwconf.dsc, Purge l i
a ble
UserIDAlias gguamer
fe r
AllowDupTargetMap
a ns
IgnoreUpdates
n- t r
Map EAST.*, Target WEST.*;
a no
GetUpdates
h a s ideฺ
IgnoreInserts
m ) G u
IgnoreDeletes o
ฺc den t
o n
r i c ss s Stu
Map EAST.products, Target WEST.products,

@ e
e t hi
CompareCols(On Update All),
g us
ti ฺna
ResolveConflict (UpdateRowExists,

s u j(delta_resolution_method, UseDelta, Cols (qty_in_stock)),

g ( (max_resolution_method, UseMax (modified_ts), Cols


Na (vendor, modified_ts)),

S ujit (Default, Overwrite));


This is essentially the same conflict detection and resolution code as defined on the EURO
delivery component, except that Map EAST/WEST is reversed.
Save and close the file.
22. On the AMER_WEST_GGSCI tab, add the Replicat by executing the following commands:
GGSCI (AMER)> Add Replicat rwconf, ExtTrail ./dirdat/pg
REPLICAT added.

GGSCI (AMER)>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 22
Starting the GoldenGate Processes and Generating Data
23. On both the AMER_WEST_GGSCI and the EURO_EAST_GGSCI tabs, execute the following
commands to start all of the configured Extracts and Replicats. Make sure that they are all
in the RUNNING status.
In AMER_WEST_GGSCI:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

GGSCI (AMER)> Start ER *


Sending START request to MANAGER ...
EXTRACT EWCONF starting

Sending START request to MANAGER ...


EXTRACT PWCONF starting

Sending START request to MANAGER ...


REPLICAT RWCONF starting
e to
GGSCI (AMER)> Info ER *
cens
l i
EXTRACT EWCONF Last Started 2013-12-11 09:47 Status RUNNING
a ble
fe r
Checkpoint Lag 00:00:00 (updated 00:00:09 ago)
a ns
Process ID 20712
n- t r
no
Log Read Checkpoint Oracle Redo Logs

a
2013-12-11 09:47:48 Seqno 307, RBA 8429056
s ideฺ
) h a
SCN 0.6297903 (6297903)
u
EXTRACT PWCONF Last Startedm
c o t G
2013-12-11
n
09:47 Status RUNNING
Checkpoint Lag
o nฺ (updated
00:00:00
s t u de00:00:05 ago)
sFile ./dirdat/wf000000
c is S
Process ID 20713
e r i h
Log Read Checkpoint
g@ usFirst t
e Record RBA 1415
n a
s u jitฺ RWCONF Last Started 2013-12-11 09:47 Status RUNNING
REPLICAT

a g ( Checkpoint Lag 00:00:00 (updated 00:00:00 ago)

N Process ID 20714

S ujit Log Read Checkpoint File ./dirdat/pg000000


First Record RBA 0

GGSCI (AMER)>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 23
In EURO_EAST_GGSCI:
GGSCI (EURO)> Start ER *
Sending START request to MANAGER ...
EXTRACT EECONF starting

Sending START request to MANAGER ...


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

EXTRACT PECONF starting

Sending START request to MANAGER ...


REPLICAT RECONF starting

GGSCI (EURO)> Info ER *

EXTRACT EECONF Last Started 2013-12-11 09:49 Status RUNNING


Checkpoint Lag 00:00:00 (updated 00:00:08 ago)
e to
Process ID 20783
cens
Log Read Checkpoint Oracle Redo Logs
l i
2013-12-11 09:52:01 Seqno 240, RBA 25440256
a ble
SCN 0.4263409 (4263409)
fe r
a ns
EXTRACT PECONF Last Started 2013-12-11 09:52 Status RUNNING
n- t r
Checkpoint Lag
no
00:00:00 (updated 00:00:04 ago)
a
s ideฺ
Process ID 20846
Log Read Checkpoint
h a
File ./dirdat/eg000000
) u
m G
First Record RBA 1415
o t
o n ฺc 2013-12-11
d e n 09:49 Status RUNNING
tu 00:00:08 ago)
REPLICAT RECONF Last Started

c s
s00:00:00 S
Checkpoint Lag
r i
e 20784 hi s (updated
Process ID
@ e t
t ฺ n ag usFile
Log Read Checkpoint ./dirdat/pf000000

s u ji First Record RBA 0

a g ( GGSCI (EURO)>
N
S ujit If any Oracle GoldenGate group shows a status of STOPPED or ABEND, view the report file,
correct any errors, and then restart the group.
24. SQL*Plus should still be running for both instances AMER and EURO. Set the screen size to
be friendlier:
a. On the AMER_WEST_SQLPLUS tab, enter:
AMER_SQL> set lines 200
AMER_SQL> set pages 40
b. On the EURO_EAST_SQLPLUS tab, enter:
EURO_SQL> set lines 200
EURO_SQL> set pages 40

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 24
25. Make sure that both the tables in both the instances have the same data, even down to the
timestamp:
BOTH_SQL> SELECT * FROM products;
PRODUCT_NUMBER PRODUCT_NA VENDOR QTY_IN_STOCK MODIFIED_TS
-------------- ---------- ---------- ------------ ----------------------------
100 widget Vendor ABC 20 21-MAY-12 12.00.00.000000 AM
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

26. Make sure non-conflicted updates get replicated through.


a. On the AMER_WEST_SQLPLUS tab, enter:
AMER_SQL> UPDATE west.products SET product_name='foobar';
AMER_SQL> COMMIT;
b. On the EURO_EAST_SQLPLUS tab, enter:
EURO_SQL> SELECT * FROM east.products;
e to
ns
PRODUCT_NUMBER PRODUCT_NA VENDOR QTY_IN_STOCK MODIFIED_TS
-------------- ---------- ---------- ------------ ----------------------------
l i ce
100 foobar Vendor ABC 20 21-MAY-12 12.00.00.000000 AM
a ble
EURO_SQL> UPDATE east.products SET product_name='whizbang';
fe r
EURO_SQL> COMMIT;
a ns
c. On the AMER_WEST_SQLPLUS tab, enter: n- t r
AMER_SQL> SELECT * FROM west.products; a no
a ฺ
s ideMODIFIED_TS
PRODUCT_NUMBER PRODUCT_NA VENDOR
h
QTY_IN_STOCK
) ------------
u ----------------------------
-------------- ---------- ----------
o m t G
100 whizbang
o n ฺc ABCden
Vendor 20 21-MAY-12 12.00.00.000000 AM
Notice that Oracle Database
i c ss does S tuautomatically update a timestamp unless you
not
explicitly tell it to. e r t hi s
d. Reset botha @ e
g usEnter the following script at the SQL prompt for both:
databases.
SQL>ji t ฺ n
@Section14/Practice14-2/sqlscripts/database_reset.sql
( s u
aa.g Stop both pumps to simulate a network lag.
27. The basic testing methodology is as follows:
N
S ujit b. Update and commit different local changes. This is the conflict.
c. Restart both pumps to simulate end-of-lag.
d. Examine the conflict resolution.
e. Reset the database for the next test.
While the Befores are checking all columns, the business rules you have chosen are:
− For name, you do not 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.prm to see the syntax to accomplish these rules.
28. The first test is to change the vendor and quantity on AMER/west first and EURO/east
second. Perform the steps in this order! WEST first…
a. On AMER, enter: GGSCI (AMER)> Stop pwconf
On EURO enter: GGSCI (EURO)> Stop peconf

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 25
b. On WEST, enter:
SQL> @Section14/Practice14-2/sqlscripts/trans_generator_west
On EAST, enter:
SQL> @Section14/Practice14-2/sqlscripts/trans_generator_east
On both of them it will SELECT * FROM products; so you see what you did.
c. On AMER, enter: GGSCI (AMER)> Start pwconf
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

On EURO, enter: GGSCI (EURO)> Start peconf


d. Enter SELECT * FROM products; on both sides so you see what it did.
Applying the rules from the Replicats:
− Because vendor takes the latest based on timestamp, both sides show EURO’s
value of XYZ.
− Because timestamp is also the latest, both sides show EURO’s value.
− Because qty_in_stock started at 20, then both additions are applied, so both
e to
sides show 20+10+4=34.
cens
e. Reset both databases. Enter the following script at the SQL prompt for both: l i
a ble
SQL> @Section14/Practice14-2/sqlscripts/database_reset.sql
fe r
29. The second test is the same as the first but stop and start in a different order (EAST first).
a ns
a. On EURO, enter: GGSCI (EURO)> Stop peconf
n- t r
On AMER, enter: GGSCI (AMER)> Stop pwconf
a no
a shistory):
b. On EAST , enter (or use the up arrow to repeat
h i d eฺ
) u
SQL> @Section14/Practice14-2/sqlscripts/trans_generator_east
m G
On WEST enter: o
ฺc den t
o n
SQL> @Section14/Practice14-2/sqlscripts/trans_generator_west
tu products; so you see what you did.
r i ss s*SFROM
On both of them it willcSELECT
c.
e hi
On EURO, enter:eGGSCI t(EURO)>
@ Start peconf
n g
On AMER,aenter: u
GGSCI s (AMER)> Start pwconf
t ฺ
( s uji SELECT * FROM products; on both sides so you see what it did.
d. Enter
a gApplying the rules from the Replicats:
N
S ujit − Because vendor takes the latest based on timestamp, both sides show AMER’s
value of DEF.
− Because timestamp is also the latest, both sides show AMER’s value.
− Because qty_in_stock started at 20, then both additions are applied, so both
sides show 20+10+4=34. This is unchanged by the test order.
e. Reset both databases. Enter the following script at the SQL prompt for both:
SQL> @Section14/Practice14-2/sqlscripts/database_reset.sql
30. The last test is where there is a conflict, but you do not care.
a. On EURO, enter: GGSCI (EURO)> Stop peconf
On AMER, enter: GGSCI (AMER)> Stop pwconf
b. On EURO, enter SQL> UPDATE products SET product_name='dingbat';
On EURO, enter SQL> COMMIT;
On AMER, enter SQL> UPDATE products SET product_name='wingnut',
qty_in_stock=15;
On AMER, enter SQL> COMMIT;

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 26
c. On AMER, enter: GGSCI (AMER)> Start pwconf
On EURO, enter: GGSCI (EURO)> Start peconf
d. Enter SELECT * FROM products; on both sides so you see what it did.
Applying the rules from the Replicats:
− There is a conflict on product_name, but you do not care, so it defaults to
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Overwrite. EURO sets local product_name to dingbat, AMER sets local


product_name to wingnut. When the pumps start, AMER overwrites
product_name on EURO with wingnut, then the EURO pump starts and overwrites
product_name on AMER with dingbat; in other words, they switch. The “winner”
depends on the order of the pumps, not the order of the transactions.
− Even though there is a conflict, it does not affect qty_in_stock, so that replicates
normally.
− Timestamp was not updated and, therefore, not a conflict.
e to
e. Reset both databases. Enter the following script at the SQL prompt for both:
cens
SQL> @Section14/Practice14-2/sqlscripts/database_reset.sql l i
a ble
31. The statistics record DML and conflicts. Examine the conflict detections and resolutions,
fe r
those items with “CDR” in the field:
a ns
a. On the EURO_EAST_GGSCI tab, enter: Stats reconf, ReportCDR
n- t r
GGSCI (EURO)> Stats reconf, ReportCDR
a no
Sending STATS request to REPLICAT RECONFa...
h s ideฺ
Start of Statistics at 2013-12-11m ) G u
o t
19:47:15.
ฺc to EAST.PRODUCTS:
e n
Replicating from WEST.PRODUCTS
o n tu
s clarity... d
...many lines omitted
r i c sfor s S
@ e since
e t hi2013-12-11 13:06:17 ***
n g us
*** Total statistics
ainserts
t
Total
j ฺ
i updates 0.00

( s uTotal 8.00

a g Total deletes 0.00


N
ujit
Total discards 0.00

S Total operations
Total CDR conflicts
8.00
4.00
CDR resolutions succeeded 4.00
CDR UPDATEROWEXISTS conflicts 4.00
...many lines omitted for clarity...

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 27
b. On the AMER_WEST_GGSCI tab, enter: Stats rwconf, ReportCDR
GGSCI (AMER)> Stats rwconf, ReportCDR
Sending STATS request to REPLICAT RWCONF ...
Start of Statistics at 2013-12-11 19:47:15.
Replicating from EAST.PRODUCTS to WEST.PRODUCTS:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

...many lines omitted for clarity...

*** Total statistics since 2013-12-11 13:06:17 ***


Total inserts 0.00
Total updates 8.00
Total deletes 0.00
Total discards 0.00
Total operations 8.00
e to
ns
Total CDR conflicts 4.00
CDR resolutions succeeded 4.00
l i ce
CDR UPDATEROWEXISTS conflicts 4.00
a ble
...many lines omitted for clarity...
fe r
Your numbers may be slightly different depending on your experimentation.
a ns
32. Clean up the Oracle GoldenGate environment by executing the following GGSCI
n- t r
commands on both the source and target servers:
a no
a s ideฺ
a. Exit both GGSCI prompts. This is necessary for the kill shell script.
h
b. On the fifth tab oracle@hostname, at the
m ) OS prompt,
G u run:
o
ฺc den t
o n
[OS_prompt] ~/labs/setup/kill-all-ogg.sh
tushould be back at the OS prompts, but still in
c. Exit both SQL*Plus prompts.
r i c ss Alls tabs
S
@ e
their proper directories.
e t hi
t ฺ n ag 14-2.uThis
This completes Practice s completes the practices for Lesson 14. Stop here.
( s uji
N ag
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 14: Bidirectional Replication


Chapter 14 - Page 28
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a n s
Practices for n t r
-Lesson 15: DDL
n o
a eฺ
Replication
s
) h a u id
ฺ c omChapter
e n t15G
s s on tud
e ric this S
n a g@ use
u jitฺ
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 15: DDL Replication


Chapter 15 - Page 1
Practices for Lesson 15: Overview

Practices Overview
In this practice, you will support the synchronization of DDL operations in homogeneous,
unidirectional environments.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 15: DDL Replication


Chapter 15 - Page 2
Practice 15-1: DDL Replication Database Setup

Assumptions
To enable DDL capture, several modifications must be made to the source database;
specifically, the creation of five tables in a tablespace with sufficient space to allow growth of the
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

marker and history tables, a database trigger and associated packages, and a user role.
Before attempting to set up DDL capture, all open sessions in the database must be closed
(which requires a database outage in a production environment).

Tasks
To set up the source database for DDL capture, execute the following on the
AMER_WEST_SQLPLUS tab:
1. Choose which schema DDL objects will be created in. (For this practice, the GGUSER e to
schema will be used because it exists on both the source and the target.) Using the text
cens
l i
editor of your choice, edit the GLOBALS file, located in the source Oracle GoldenGate home
a ble
directory, and add the following parameter: GGSCHEMA GGUSER.
fe r
[OS_prompt labs] cd $GG_AMER_HOME
a ns
[OS_prompt gg_amer] gedit GLOBALS n- t r
CheckpointTable GGS_CHECKPOINT a no
GGSCHEMA GGUSER h a s ideฺ
m ) G u
Save and close the file. o
ฺc SQL*Plus e n t
2. On the AMER_WEST_SQLPLUSstab, o nstart t u d as sysdba:
c s S
ri trlsqlplus
e
[OS_prompt gg_amer] h is / as sysdba
@
ag DBA
3. Execute the following e
scommands:
t ฺ n u
( s uji GRANT EXECUTE ON UTL_FILE TO gguser;
SQL>

a g Grant succeeded.
N
S ujit SQL>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 15: DDL Replication


Chapter 15 - Page 3
4. Run the marker_setup.sql script. When prompted for a schema, enter GGUSER:
SQL> @marker_setup.sql
Marker setup script

You will be prompted for the name of a schema for the Oracle GoldenGate
database objects.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

NOTE: The schema must be created prior to running this script.


NOTE: Stop all DDL replication before starting this installation.

Enter Oracle GoldenGate schema name:GGUSER


Marker setup table script complete, running verification script...
Please enter the name of a schema for the GoldenGate database objects:
Setting schema name to GGUSER

e to
MARKER TABLE
-------------------------------
cens
l i
le
OK

r a b
MARKER SEQUENCE
-------------------------------
ns fe
OK
t r a
Script complete. no n-
a
s ideฺ
SQL>
) h a u
o m t G
o n ฺc den
r i c ss s Stu
@ e
e t hi
t ฺ n ag us
( s uji
ag
N
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 15: DDL Replication


Chapter 15 - Page 4
5. Run the ddl_setup.sql script. When prompted for a schema, enter GGUSER.
SQL> @ddl_setup.sql
Oracle GoldenGate DDL Replication setup script

Verifying that current user has privileges to install DDL Replication...


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

You will be prompted for the name of a schema for the Oracle GoldenGate
database objects.
NOTE: For an Oracle 10g source, the system recycle bin must be disabled. For
Oracle 11g and later, it can be enabled.
NOTE: The schema must be created prior to running this script.
NOTE: Stop all DDL replication before starting this installation.

Enter Oracle GoldenGate schema name:GGUSER

to
Working, please wait ...
Spooling to file ddl_setup_spool.txt
ns e
Checking for sessions that are holding locks on Oracle Golden Gate metadata
l i ce
tables ...
a ble
Check complete.
fe r
a ns
Using GGUSER as a Oracle GoldenGate schema name.
n- t r
no
Working, please wait ...

a
s ideฺ
DDL replication setup script complete, running verification script...

) h a u
Please enter the name of a schema for the GoldenGate database objects:
Setting schema name to GGUSER
o m t G
o n ฺc den
CLEAR_TRACE STATUS:

r i c ss s Stu
Line/pos
@ e
e t hi Error

No errorsag s
---------------------------------------- ------------------------------------

i t ฺn u No errors

s j
u Many lines omitted for clarity ...
g ( ...

N a
ujit
Analyzing installation status...

S STATUS OF DDL REPLICATION


-----------------------------------------------------------------------------
SUCCESSFUL installation of DDL Replication software components

Script complete.
SQL>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 15: DDL Replication


Chapter 15 - Page 5
6. Run the role_setup.sql script. When prompted for a schema, enter GGUSER:
SQL> @role_setup.sql
GGS Role setup script

This script will drop and recreate the role GGS_GGSUSER_ROLE


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

To use a different role name, quit this script and then edit the params.sql
script to change the gg_role parameter to the preferred name.

You will be prompted for the name of a schema for GoldenGate database objects.
NOTE: The schema must be created prior to running this script.
NOTE: Stop all DDL replication before starting this installation.

Enter GoldenGate schema name:GGUSER


Wrote file role_setup_set.txt

e to
PL/SQL procedure successfully completed.

cens
l i
le
Role setup script complete
Grant this role to each user assigned to the Extract, GGSCI, and Manager
r a b
processes, by using the following SQL command:
ns fe
GRANT GGS_GGSUSER_ROLE TO <loggedUser>
t r a
where <loggedUser> is the user assigned to the GoldenGate processes.
SQL> no n-
a eฺ
sGGSUSER_ROLE
7. As specified in the role_setup.sql output, h
) a
grant
u i d to the Oracle
GoldenGate database user:
ฺ c om ent G
SQL> GRANT ggs_ggsuser_role
s s on tuTOd gguser;
Grant succeeded.
e ric this S
g@ use
SQL>
n a
jitฺ@ddl_enable.sql
8. Enable DDL triggers:
s u
g ( Trigger altered.
SQL>
N a
S ujit SQL>
9. Make the ddl_pin script part of the database startup. It must be invoked with the Oracle
GoldenGate DDL username. (This script improves the performance of the DDL trigger and
requires the Oracle dbms_shared_pool system package.)
SQL> @ddl_pin GGUSER

PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.

SQL> exit
[OS_prompt]
Exit SQL*Plus. The database is now set up and enabled for DDL capture. Had you been
using Integrated Extract, none of these @scripts for triggers would have been necessary
because Integrated Extract supports DDL replication by default.
This completes Practice 15-1. Continue now with Practice 15-2.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 15: DDL Replication


Chapter 15 - Page 6
Practice 15-2: DDL Replication Oracle GoldenGate Setup

Tasks

Housekeeping Considerations
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

For continuing operations, the DDL marker, history, and trace tables must be monitored and
routinely cleared of old or nonessential data.
1. On the AMER_WEST_GGSCI tab, start GGSCI:
[OS_prompt gg_amer] rlggsci
GGSCI (AMER) 1> set editor gedit
2. On the AMER_WEST_GGSCI tab, edit the mgr.prm parameter file. Add the following three
lines to the end of the file:
e to
UserIDAlias gguamer
cens
l i
PurgeMarkerHistory MinKeepDays 3, MaxKeepDays 5
a ble
PurgeDDLHistory MinKeepDays 3, MaxKeepDays 5
fe r
a ns
Port 15000 n- t r
a no
PurgeOldExtracts ./dirdat/*, UseCheckpoints, MinKeepDays 1
DynamicPortList 15100-15150
h a s ideฺ
UserIDAlias gguamer m ) G u
o
ฺc den t
n
PurgeMarkerHistory MinKeepDays 3, MaxKeepDays 5
o
c ss s Stu
PurgeDDLHistory MinKeepDays 3, MaxKeepDays 5
r i
@ e t hi lines in your file slightly differ from the book. The
Do not be concerned ifethe existing
g is touadd
purpose of thisatask
n s the last three lines that are for PurgeMarkerHistory and
t ฺ
uji
PurgeDDLHistory.
( s
Save and close the file.
3. ag
On the AMER_WEST_GGSCI tab, stop and restart the Oracle GoldenGate Manager:
N
S ujit GGSCI (AMER)> Stop mgr !
GGSCI (AMER)> Start mgr
Note: To prevent the DDL trace file from consuming excessive disk space, run the
@ddl_cleartrace.sql script on a regular basis. This script deletes the file, but Oracle
GoldenGate will create it again. This script must be run manually or via cron.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 15: DDL Replication


Chapter 15 - Page 7
Setting Up the Workshop Database and Configuration
Before continuing further, make sure that you start with clean schema areas for your lab.
4. On the AMER_WEST_SQLPLUS tab, navigate to ~/labs, and then execute the following
SQL script to clean out the source schema:
[OS_prompt] cd ~/labs
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

[OS_prompt labs] rlsqlplus west@amer/oracle_4U


@Section15/sqlscripts/drop_tables.sql
PL/SQL procedure successfully completed.

AMER_SQL> SELECT * FROM user_tables;


no rows selected

5. On the EURO_EAST_SQLPLUS tab, navigate to the same ~/labs, and execute the same
SQL script to clean out the target schema:
e to
[OS_prompt] cd ~/labs
cens
[OS_prompt labs] rlsqlplus east@euro/oracle_4U l i
@Section15/sqlscripts/drop_tables.sql
a ble
PL/SQL procedure successfully completed. fe r
a ns
EURO_SQL> SELECT * FROM user_tables;
n- t r
no rows selected
a no
Leave SQL*Plus running.
h a s ideฺ
6. Dropping the tables in the previous stepsm ) haveGalso
should u cleared the TranData
o
c den t
(transaction data). Verify this on theฺAMER_WEST_GGSCI tab:
o n tu
GGSCI (AMER)> DBLogin
r i c ss UserIDAlias
s S gguamer
Successfully logged
@ e hi
into database.

e t
GGSCI (AMER)>
n g Info
aviable u s TranData WEST.*
ji
ERROR:t ฺ
s u No tables matched specification.

a g ( GGSCI (AMER)>
N
S ujit Note: The last step of the practice verifies that the TranData comes back automatically.
7. To set up Oracle GoldenGate Change Data Capture on the source server
AMER_WEST_SQLPLUS tab, configure the change data capture extract (eddl.prm) with the
following parameters:
GGSCI (AMER)> Edit Param eddl
The text editor of your choice opens the empty eddl.prm file. Enter the following
parameters:
Extract eddl
ExtTrail ./dirdat/ed
UserIDAlias gguamer
-- DDL Include Mapped ObjName "WEST.*" <-- This won’t work!
DDL Include Mapped ObjName WEST.*
DDLOptions AddTranData, Report
Table WEST.*;
Save and close the file.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 15: DDL Replication


Chapter 15 - Page 8
8. On the AMER_WEST_GGSCI tab, add the Extract group and two local Extract Trails by
executing the following commands:
GGSCI (AMER)> Add Extract eddl, TranLog, Begin Now
EXTRACT added.

GGSCI (AMER)> Add ExtTrail ./dirdat/ed, Extract eddl


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

EXTTRAIL added.

GGSCI (AMER)>
9. On the source AMER_WEST_GGSCI tab, configure the Extract Data Pump (pddl.prm) to
read from the dirdat/ed local Extract Trail, transmit the data to the target server, and
write it to the dirdat/pd Remote Trail:
GGSCI (AMER)> Edit Param pddl
The text editor of your choice opens the empty pddl.prm file. Add the following runtime
e to
parameters to the text file:
cens
Extract pddl l i
RmtHost easthost, MgrPort 15001, Compress
a ble
fe r
RmtTrail ./dirdat/pd
a ns
Passthru
n- t r
Table WEST.*;
a no
Save and close the file.
h a s ideฺ
10. Add the Extract group by executing the following
m ) GGSCI G u commands:
o
ฺc pddl, e t
nExtTrailSource ./dirdat/ed
GGSCI (AMER)> Add Extract
s o n u d
t./dirdat/pd,
GGSCI (AMER)> Add sRmtTrail S
e r i c i s
Extract pddl

@
11. On the target EURO_EAST_GGSCI
g e th tab, Replicat checkpoints to a special table created in
the database.a
ฺnandThis s
u table ensures that the Replicat checkpoint is part of the
checkpoint
j i t
u Table.
transaction is used to ensure data integrity. If it does not already exist, create the
( s
Checkpoint
N agOn the target server EURO_EAST_GGSCI tab, start GGSCI and execute the following
S ujit commands:
[OS_prompt gg_euro] rlggsci
GGSCI (EURO) 1> set editor gedit
GGSCI (EURO) 2> DBLogin UserIDAlias ggueuro
GGSCI (EURO) 3> Info CheckpointTable
GGSCI (EURO) 4> Add CheckpointTable
Note: Because this is a frequent-enough sequence, it is useful to create an Obey file with
these commands that could be invoked by entering:
GGSCI> Obey /home/oracle/labs/setup/startup.oby

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 15: DDL Replication


Chapter 15 - Page 9
12. On the target server EURO_EAST_GGSCI tab, configure the Replicat delivery components
by executing the following command:
GGSCI (EURO)> Edit Param rddl
The text editor of your choice opens the empty rddl.prm file. Add the following runtime
parameters to the text file:
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Replicat rddl
DiscardFile ./dirrpt/rddl.dsc, Purge
AssumeTargetDefs
UserIDAlias ggueuro
DDL Include Mapped
Map WEST.*, Target EAST.*;
Save and close the file.
e to
13. Add the Replicat by executing the following GGSCI command:
cens
l i
GGSCI (EURO)> Add Replicat rddl, ExtTrail ./dirdat/pd
a ble
14. Verify that the mgr process is running on both the AMER_WEST_GGSCI tab and the
fe r
EURO_EAST_GGSCI tab.
a ns
n- t r
no
GGSCI (BOTH)> Info mgr
a
s ideฺ
If the manager process is not already running, start it, and then verify that it is running:
) h a u
GGSCI (BOTH)> Start mgr
GGSCI (BOTH)> Info mgr ฺc o m n t G
o n d e
To start the Extract and Replicat
i c tu issue the following command on both the
ss processes,
S
e
AMER and EURO instances. r t hi s
@
ag us e
t ฺ n
( s uji
N ag
jit
Su

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 15: DDL Replication


Chapter 15 - Page 10
On AMER:
GGSCI (AMER)> Start ER *
Sending START request to MANAGER ...
EXTRACT EDDL starting
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Sending START request to MANAGER ...


EXTRACT PDDL starting

GGSCI (AMER)> Info ER *


EXTRACT EDDL Last Started 2013-12-11 17:42 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:04 ago)
Process ID 29972

to
Log Read Checkpoint Oracle Redo Logs
2013-12-11 17:42:51 Seqno 308, RBA 22850048
ns e
SCN 0.6319581 (6319581)
l i ce
EXTRACT PDDL Last Started 2013-12-11 17:42 Status RUNNING
a ble
Checkpoint Lag 00:00:00 (updated 00:00:01 ago)
fe r
Process ID 29973
a ns
Log Read Checkpoint File ./dirdat/ed000000
n- t r
no
First Record RBA 1411
a
GGSCI (AMER)> h a s ideฺ
m ) G u
On EURO: o t
GGSCI (EURO)> Startso
nฺc
ER * tud
en
r i c s sS
i ...
e tothMANAGER
REPLICAT a
@
Sending START request
g starting
s e
t ฺ n RDDL
u
( s uji (EURO)> Info ER *
GGSCI
a g
N
ujit
REPLICAT RDDL Last Started 2013-12-11 17:42 Status RUNNING

S Checkpoint Lag
Process ID
00:00:00 (updated 00:00:08 ago)
29995
Log Read Checkpoint File ./dirdat/pd000000
First Record RBA 0

GGSCI (EURO)>

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 15: DDL Replication


Chapter 15 - Page 11
Generate Source Database Activity
15. On the AMER_WEST_SQLPLUS tab, execute the following SQL script:
AMER_SQL> @Section15/sqlscripts/source_database.sql
Table created.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Table created.
Table created.
Table created.
Table created.
Table created.

AMER_SQL>
16. On the AMER_WEST_SQLPLUS tab, execute the following SQL script:
e to
AMER_SQL> @Section15/sqlscripts/seed_database.sql
cens
l i
PL/SQL procedure successfully completed.
a ble
fe r
AMER_SQL> a ns
n- t r
no
17. On the AMER_WEST_SQLPLUS tab, execute the following SQL script:
a
a s ideฺ
AMER_SQL> @Section15/sqlscripts/trans_generator.sql
h
m ) G u
o
PL/SQL procedure successfully completed.
ฺc den t
o n tu
AMER_SQL>
ss s Sgenerator
rictransaction
Wait a few seconds forethe
t h i to complete.

n a g@ use
s
18. On(the
jitฺ
Validating the Results
uEURO_EAST_SQLPLUS tab, execute the following query:
g
a EURO_SQL> SELECT table_name FROM user_tables;
i t N
S uj TABLE_NAME
------------------------------
ACCOUNT
ACCOUNT_TRANS
BRANCH
TELLER
TELLER_TRANS
BRANCH_ATM

6 rows selected.

SQL>
Six tables should have been created/replicated in the EAST schema.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 15: DDL Replication


Chapter 15 - Page 12
19. From the AMER_WEST_GGSCI tab, execute the following command:
GGSCI (AMER)> Stats eddl, Total
Sending STATS request to EXTRACT EDDL ...
Start of Statistics at 2013-12-12 07:29:28.

DDL replication statistics (for all trails):


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

*** Total statistics since extract started ***


Operations 6.00
Mapped operations 6.00
Unmapped operations 0.00
Other operations 0.00
Excluded operations 0.00

Output to ./dirdat/ed:

e to
ns
Extracting from GGUSER.GGS_MARKER to GGUSER.GGS_MARKER:

*** Total statistics since 2013-12-12 07:22:59 ***


l i ce
No database operations have been performed.
a ble
fe r
Extracting from WEST.ACCOUNT to WEST.ACCOUNT:
a ns
*** Total statistics since 2013-12-12 07:22:59 ***
n- t r
Total inserts
Total updates
a no
1060.00
1500.00
Total deletes
h a s ideฺ
0.00
Total discards
m ) G u0.00
Total operations
o
ฺcclarityde...
n t 2560.00

n
... Many lines omittedofor

End of Statistics.ri
c ss s Stu
@ e
e t hi
GGSCI n
t ฺ ag us
(AMER)>
The s
( uji output should show mapped DDL operations followed by transaction counts for
Stats
a gall tables where data was captured.
N
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 15: DDL Replication


Chapter 15 - Page 13
20. Execute the same command for the Replicat on the EURO_EAST_GGSCI tab:
GGSCI (EURO)> Stats rddl, Total
Sending STATS request to REPLICAT RDDL ...
Start of Statistics at 2013-12-12 07:33:18.

DDL replication statistics:


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

*** Total statistics since replicat started ***


Operations 6.00
Mapped operations 6.00
Unmapped operations 0.00
Other operations 0.00
Excluded operations 0.00
Errors 0.00
Retried errors 0.00
Discarded errors 0.00
e to
ns
Ignored errors 0.00

Replicating from WEST.ACCOUNT to EAST.ACCOUNT:


l i ce
a ble
*** Total statistics since 2013-12-12 07:23:43 ***
fe r
Total inserts
Total updates
1060.00
1500.00
a ns
Total deletes 0.00
n- t r
Total discards
Total operations
a no
0.00
2560.00

... Many lines omitted for clarity h a s ideฺ


m ) ...
G u
o
ฺc den t
End of Statistics.
o n tu
GGSCI (EURO)> icss S
r s
e Noticeththati there is more DDL information on the Replicat than on
@
All counts should match.
the Extract. nag s e
u
s u jitฺ
(
N ag
jit
Su

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 15: DDL Replication


Chapter 15 - Page 14
21. Verify that the transaction data was added to the AMER source because of parameter
DDLOptions AddTranData, Report. You know it had to be added because the
Replicat worked, but check for it anyway.
GGSCI (AMER)> Info TranData WEST.*
Logging of supplemental redo log data is enabled for table WEST.ACCOUNT.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

Columns supplementally logged for table WEST.ACCOUNT: ACCOUNT_NUMBER.

Logging of supplemental redo log data is enabled for table WEST.ACCOUNT_TRANS.


Columns supplementally logged for table WEST.ACCOUNT_TRANS: ACCOUNT_NUMBER,
TRANS_NUMBER, ACCOUNT_TRANS_TS.

Logging of supplemental redo log data is enabled for table WEST.BRANCH.


Columns supplementally logged for table WEST.BRANCH: BRANCH_NUMBER.

Logging of supplemental redo log data is enabled for table WEST.BRANCH_ATM.


Columns supplementally logged for table WEST.BRANCH_ATM: BRANCH_NUMBER,
e to
ATM_NUMBER, TRANS_NUMBER, ATM_TRANS_TS.
cens
l i
Logging of supplemental redo log data is enabled for table WEST.TELLER.
Columns supplementally logged for table WEST.TELLER: TELLER_NUMBER.
a b le
fe r
n s
Logging of supplemental redo log data is enabled for table WEST.TELLER_TRANS.
Columns supplementally logged for table WEST.TELLER_TRANS:
n - tra TELLER_NUMBER,

no
TRANS_NUMBER, TELLER_TRANS_TS.

GGSCI (AMER)> a
s ideฺ
This completes Practice 15-2. This completes the h a
) practicesufor Lesson 15. Stop here.
o m t G
o n ฺc whether
If you are in a classroom, ask the instructor
d e nyou should leave the PCs running or not,
signed in, or logged off.
r i c ss s Stu
@ e
e t hi
t ฺ n ag us
( s uji
g
jit Na
Su

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 15: DDL Replication


Chapter 15 - Page 15
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2017, Oracle and/or its affiliatesฺ

e to
cens
l i
a ble
fe r
a ns
n- t r
a no
h a s ideฺ
m ) G u
o
ฺc den t
o n
r i c ss s Stu
@ e
e t hi
g us
u jti ฺna
g ( s
Na
S ujit

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.

Practices for Lesson 15: DDL Replication


Chapter 15 - Page 16

You might also like