Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Overview
The installation of the software is simply fetching the zip files from the web and unzipping them. To install the
Oracle GoldenGate software, perform the following steps:
You have successfully accessed Oracle GoldenGate documentation as a prerequisite for installing the
software.
Using a web browser, go to https://edelivery.oracle.com and click Sign In. On the Terms and
Conditions page, select Yes for both agreements, and click Continue.
On the Media Pack Search page, select Product Pack = Oracle Fusion Middleware, and Platform =
Linux x86-64.
Click Go.
Select Oracle GoldenGate on Oracle v11.2.1 Media Pack for Linux x86-64.
Click Continue.
Make sure you are looking at part number V34339-01 for "Oracle GoldenGate V11.2.1.0.3 for Oracle
11g on Linux x86-64."
Click Download.
Host01 - Linux
[oggadm1@host01 /]$ cd /u01/app/oracle
[oggadm1@host01 oracle]$ mkdir ogg01
[oggadm1@host01 ogg01]$ cd ogg01/
[oggadm1@host01
ogg01]$
Copy the downloaded zip from wherever you downloaded it to ogg01/. Unzip it and untar (extract) it.
Host01 - Linux
[oggadm1@host01 ogg01]$ cp /stage/V34339-01.zip .
[oggadm1@host01 ogg01]$ unzip V34339-01.zip
Archive: V34339-01.zip
inflating: fbo_ggs_Linux_x64_ora11g_64bit.tar
inflating: Oracle_GoldenGate_11.2.1.0.3_README.doc
inflating: Oracle GoldenGate_11.2.1.0.3_README.txt
inflating: OGG_WinUnix_Rel_Notes_11.2.1.0.3.pdf
[oggadm1@host01 ogg01]$ tar -xvpf
fbo_ggs_Linux_x64_ora11g_64bit.tar
UserExitExamples/
UserExitExamples/ExitDemo_more_recs/
UserExitExamples/ExitDemo_more_recs/Makefile_more_recs.HPUX
ulg.sql
usrdecs.h
zlib.txt
[oggadm1@host01
ogg01]$
Be mindful of the trailing dot in the copy command.
Start the GoldenGate Software Command Interface (GGSCI). Create the default empty subdirectories.
Host01 - Linux
[oggadm1@host01 ogg01]$ ./ggsci
If a directory already exists, the installation leaves the contents of that directory alone.
Do the same steps for the other host. Unpack the software in its directory on host02 (green).
Host02 - Linux
[oggadm2@host02 /]$ cd /u01/app/oracle
[oggadm2@host02 oracle]$ mkdir ogg02
[oggadm2@host02 ogg02]$ cd ogg02/
[oggadm2@host02
ogg02]$
Copy the downloaded zip from wherever you downloaded it to ogg02/. Unzip it and untar (extract) it.
Host02 - Linux
[oggadm2@host02 ogg02]$ cp /stage/V34339-01.zip .
[oggadm2@host02 ogg02]$ unzip V34339-01.zip
Archive: V34339-01.zip
inflating: fbo_ggs_Linux_x64_ora11g_64bit.tar
inflating: Oracle_GoldenGate_11.2.1.0.3_README.doc
inflating: Oracle GoldenGate_11.2.1.0.3_README.txt
inflating: OGG_WinUnix_Rel_Notes_11.2.1.0.3.pdf
[oggadm2@host02 ogg02]$ tar -xvpf
fbo_ggs_Linux_x64_ora11g_64bit.tar
UserExitExamples/
UserExitExamples/ExitDemo_more_recs/
UserExitExamples/ExitDemo_more_recs/Makefile_more_recs.HPUX
ulg.sql
usrdecs.h
zlib.txt
[oggadm2@host02
ogg02]$
Start the GoldenGate Software Command Interface (GGSCI). Create the default empty subdirectories.
Host02 - Linux
[oggadm2@host02 ogg02]$ ./ggsci
If a directory already exists, the installation leaves the contents of that directory alone.
You have successfully installed Oracle GoldenGate on Linux hosts host01 and host02.
The configuration of the environment is done by editing ASCII files and running OS utilities. To configure the
environment, perform the following steps:
Host01 - Linux
[oggadm1@host01 ogg01] sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Sep 17 17:19:01
2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 -
64bit Production
With the Partitioning, OLAP, Data Mining and Real Application
Testing options
LOG_MODE
------------
ARCHIVELOG
SQL>
The result should be ARCHIVELOG. If it is, then skip to the next step. If the result is NOARCHIVELOG, then
do the following:
Host01 - Linux
LOG_MODE
------------
NOARCHIVELOG
LOG_MODE
------------
ARCHIVELOG
SQL>
Verify that supplemental logging and forced logging are set properly.
Host01 - Linux
SQL> SELECT force_logging, supplemental_log_data_min FROM
v$database;
FOR SUPPLEME
--- --------
YES YES
SQL>
The results should both be YES. If it is, then skip to the next step. If either result is NO, then do the
following:
Host01 - Linux
FOR SUPPLEME
--- --------
NO NO
FOR SUPPLEME
--- --------
YES YES
SQL>
In real life, the user/schema owner would probably have more privileges, and the administrator would
have less privileges. The DBMS_GOLDENGATE_AUTH package is not needed for this OBE, but is
commonly used in more advanced configurations, so it is a good idea to see it here. Oddly, the DBA role
is not sufficient for advanced scenarios; you must also run the DBMS_GOLDENGATE_AUTH package.
When keying in the DBMS_GOLDENGATE_AUTH command, the entire string after EXEC is without spaces
or line breaks.
Host01 - Linux
SQL> CREATE USER ogguser1 IDENTIFIED BY pswd1u;
User created.
Host01 - Linux
[oggadm1@host01 ogg01]$ tnsping orcl01
TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on
17-SEP-2012 18:52
Copyright (c) 1997, 2011, Oracle. All rights reserved.
Used parameter files:
[oggadm1@host01
ogg01]$
The results should be OK. If it is, then skip to the next step. If it is not OK, then do the following to
examine tnsnames.ora.
Host01 - Linux
[oggadm1@host01 ogg01]$ more
$ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File:
/u01/app/oracle/product/11.2.0/dbhome_
1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL02 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
host02.example.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl02.example.com)
)
)
ORCL01 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
host01.example.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl01.example.com)
)
)
[oggadm1@host01
ogg01]$
Everything you did for the database orcl01 on host01 needs to be done for orcl02 on host02.
Host02 - Linux
[oggadm2@host02 ogg02] sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Sep 17 17:19:01
2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 -
64bit Production
With the Partitioning, OLAP, Data Mining and Real Application
Testing options
LOG_MODE
------------
ARCHIVELOG
SQL>
The result should be ARCHIVELOG. If it is, then skip to the next step. If the result is NOARCHIVELOG, then
do the following:
Host02 - Linux
LOG_MODE
------------
NOARCHIVELOG
LOG_MODE
------------
ARCHIVELOG
SQL>
Verify that supplemental logging and forced logging are set properly.
Host02 - Linux
SQL> SELECT force_logging, supplemental_log_data_min FROM
v$database;
FOR SUPPLEME
--- --------
YES YES
SQL>
The results should both be YES. If it is, then skip to the next step. If either result is NO, then do the
following:
Host02 - Linux
FOR SUPPLEME
--- --------
NO NO
FOR SUPPLEME
--- --------
YES YES
SQL>
Host02 - Linux
SQL> CREATE USER ogguser2 IDENTIFIED BY pswd2u;
User created.
SQL> exit
[oggadm2@host02
ogg02]$
Verify that both databases can talk to each other.
Host02 - Linux
[oggadm2@host02 ogg02]$ tnsping orcl01
TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on
17-SEP-2012 18:52
Copyright (c) 1997, 2011, Oracle. All rights reserved.
Used parameter files:
[oggadm2@host02
ogg02]$
The results should be OK. If it is, then skip to the next step. If it is not OK, then do the following to
examine tnsnames.ora.
Host02 - Linux
[oggadm2@host02 ogg02]$ more
$ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File:
/u01/app/oracle/product/11.2.0/dbhome_
1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL02 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
host02.example.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl02.example.com)
)
)
ORCL01 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
host01.example.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl01.example.com)
)
)
[oggadm2@host02
ogg02]$
The databases on host01 and host02 are configured to support Oracle Goldengate. Users on each
database are provisioned: one (or more) user and an administrator for each host.
Create the GLOBALS file on host01 (red) in the Oracle GoldenGate installation directory using your text
editor of choice.
It is possible to create and/or edit the GLOBALS file from inside GGSCI by prepending the name with "./".
For example:
GGSCI> Edit Param ./GLOBALS
except that for it to take effect, you have to leave and reenter GGSCI, so you might as well do the editing
outside GGSCI before you start GGSCI the first time.
The GLOBALS file name must be all UPPERCASE, and it contains only one line (plus --comments)
defining the checkpoint table schema and name. You can use any schema and any name. You can
use vi or gedit or any text editor.
Host01 - Linux
[oggadm1@host01 ogg01] vi GLOBALS
-- Created by Joe Admin 10/11/2012 on host01
CheckpointTable oggadm1.oggchkpt
[oggadm1@host01
ogg01]
Checkpoint tables are only used by the Replicat, so this will not be used until the bidirectional section.
Having it present and unused does not hurt anything.
Create the GLOBALS file on host02 (green) in the Oracle GoldenGate installation directory.
Host02 - Linux
[oggadm2@host02 ogg02]$ vi GLOBALS
-- Created by Joe Admin 10/11/2012 on host02
CheckpointTable oggadm2.oggchkpt
[oggadm2@host02
ogg02]$
Create the optional startup.oby (Obey) file on host01 (red) in the Oracle GoldenGate installation
directory.
These are GGSCI commands that are done almost every time you start GGSCI, and they do not persist
between sessions, so you will find yourself entering them many, many times, and therefore it is
convenient to create a startup obey file.
If you have several different databases or schemas that you login to on a regular basis, you may want to
make startup01.oby, startup02.oby, startup03.oby, and so on. This will be revisited later in the
naming conventions of process files.
Host01 - Linux
[oggadm1@host01 ogg01] vi startup.oby
-- Created by Joe Admin 10/11/2012 on host01
DBLogin UserID oggadm1@orcl01, Password pswd1a
Start Mgr
Info Mgr
Info CheckpointTable
Set Editor gedit
[oggadm1@host01
ogg01]
DBLogin:
Connects to the DB using the userid@SID/password specified. The @SID is optional if there is no ambiguity.
Start Mgr:
If the Manager is already started, there is no harm in trying to start it again. This is persistent between sessions.
Info Mgr:
Reports if the Manager started successfully, and if so, the port number being used.
Info CheckpointTable:
Reports if a checkpoint table (used by Replicat) was found.
Set Editor:
The default is vi. You can temporarily change that to a GUI editor such as gedit.
Create the optional startup.oby (Obey) file on host02 (green) in the Oracle GoldenGate installation
directory.
Host02 - Linux
[oggadm2@host02 ogg02]$ vi startup.oby
-- Created by Joe Admin 10/11/2012 on host02
DBLogin UserID oggadm2@orcl02, Password pswd2a
Start Mgr
Info Mgr
Info CheckpointTable
Set Editor gedit
[oggadm2@host02
ogg02]$
Start GGSCI. Edit the file with no extension. Add the two lines (plus comments).
Host01 - Linux
[oggadm1@host01 ogg01] ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.2.1.0.3 14400833
OGGCORE_11.2.1.0.3_PLATFORMS_120823.1258_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Aug 23 2012
20:20:21
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All
rights reserved.
GGSCI (host01)
3>
Note: If you do it correctly, GGSCI automatically adds the .prm extension and stores the file in
the dirprm/ directory. If you wrongly add the extension yourself, GGSCI converts the filename to
UPPERCASE and stores it in the installation directory which renders the file practically unusable.
Host02 - Linux
[oggadm2@host02 ogg02]$ ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.2.1.0.3 14400833
OGGCORE_11.2.1.0.3_PLATFORMS_120823.1258_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Aug 23 2012
20:20:21
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All
rights reserved.
GGSCI (host02)
3>
Notice that the port number is different from host01 to host02. If the Oracle GoldenGate instances are on
different hosts, you don't have to make the ports different, as long as the combination of IP address plus
port is unique. Nevertheless, it is a good practice to make the ports unique.
Start the Manager on host01 using the Obey files. Alternatively, you could type each of the lines every
time you start GGSCI.
Host01 - Linux
GGSCI (host01) 3> Obey startup.oby
GGSCI (host01)
10>
Host02 - Linux
GGSCI (host02) 3> Obey startup.oby
GGSCI (host02)
10>
The global and startup files are all created, and the background Manager processes are started. You can
verify which processes are running at any time by entering the command:
GGSCI (host) > Info All
Create the checkpoint table on host01. (This is not needed on the source, so this is will not be used for
unidirectional replication, but will be used for bidirectional replication when host01 becomes the target.)
Host01 - Linux
GGSCI (host01) 10> Add CheckpointTable
[oggadm1@host01
ogg01]
One checkpoint table will suffice for the whole schema.
Host02 - Linux
GGSCI (host02) 10> Add CheckpointTable
[oggadm2@host02
ogg02]$
If you already have sample tables, you can use those. If not, Oracle GoldenGate software comes with a
script demo_ora_create.sql to create two small sample tables tcustmer and tcustord. You can
use any SQL utility you like to run the script. If you have no preference, use sqlplus.
Host01 - Linux
[oggadm1@host01 ogg01] sqlplus ogguser1@orcl01/pswd1u
@demo_ora_create.sql
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 -
64bit Production
With the Partitioning, OLAP, Data Mining and Real Application
Testing options
Table created.
Table created.
SQL> exit
[oggadm1@host01
ogg01]
The ORA-00942 "errors" are okay to ignore. If you run the script a second time you won't see those
errors.
Warning! If you run the script a second time, it will drop the tables!
Host02 - Linux
[oggadm2@host02 ogg02] sqlplus ogguser2@orcl02/pswd2u
@demo_ora_create.sql
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 -
64bit Production
With the Partitioning, OLAP, Data Mining and Real Application
Testing options
Table created.
Table created.
SQL> exit
[oggadm2@host02
ogg02]$
Oracle 11gR2 does support replicating DDL such as CREATE TABLE, and therefore the empty tables
could be created on the target in other ways before any DML replication begins.
You can check on the tables available any time GGSCI is running (after you have run Obey startup.oby to
login to the database) by entering the commands:
Restart GGSCI and run Add TranData for the whole user schema.
Host01 - Linux
[oggadm1@host01 ogg01] ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
... many lines omitted for clarity ...
... many lines omitted for clarity ... but make sure everything
started.
Note that you can add transaction data for an individual table or for wildcards. The wildcards can be for a
whole schema, but there is a better way to do whole schemas. There is no harm in adding transaction
data twice.
Do almost the same thing on host02. (This is not needed on the target, so this is will not be used for
unidirectional replication, but will be used for bidirectional replication when host02 becomes the source.)
Host02 - Linux
[oggadm2@host02 ogg02] ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
... many lines omitted for clarity ...
... many lines omitted for clarity ... but make sure everything
started.
GGSCI (host02)
xx>
The end result for replication is the same, but there are several administrative differences when
using SchemaTranData:
No tables show up when you query Info TranData ogguser2.*, but they are in fact
enabled.
Any new table added to the schema becomes automatically enabled for transaction data logging
(with plain old TranData you would have to manually add new tables each time for
supplemental logging.)
Not all other OEM databases support SchemaTranData.
The transaction data has been enabled for all user tables involved with Oracle GoldenGate.
Create the column mapping from source to target tables using the OS utility.
This utility is required if the tables have a different (heterogeneous) structure, but is still highly
recommended even if the tables have the same (homogeneous) structure. If they do have the same
structure, you may be able to use the AssumeTargetDefs parameter instead of
the SourceDefs parameter. This is covered later.
Please review the File and Process Naming Conventions in the Overview Topic.
Host01 - Linux
GGSCI (host01) > Edit Param dsalesab
-- defgen column definitions for Sales: tcust* from host01 (a)
to host02 (b)
-- Created by Joe Admin on 10/11/2012
DefsFile dirdef/dsalesab.def, Purge
UserID oggadm1@orcl01, Password pswd1a
Table ogguser1.tcust*;
[oggadm1@host01
ogg01]
You can create definitions for a single table, multiple tables (using wildcards), an entire schema, or
multiple schemas at a time. Having "excess" (that is, unused by Oracle GoldenGate) definitions in the file
is not a problem. You may want to examine the contents of dirdef/dsalesab.def before sending it
over to host02.
Use whatever method you wish to copy the .def files to the target dirdef directory: cut-n-
paste, scp, ftp, and so on. The example will use secure shell copy (scp). Do not break the command
line after /u01/app/oracle/og, the scp command is entered all on one line.
Host01 - Linux
[oggadm1@host01 ogg01] scp dirdef/dsalesab.def
oggadm2@host02:/u01/app/oracle/og
g02/dirdef
The authenticity of host 'host02 (192.0.2.29)' can't be
established.
RSA key fingerprint is
8e:60:d0:a7:fc:55:6e:d9:81:bb:c9:90:19:f4:a8:11.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'host02,192.0.2.29' (RSA) to the list
of known hosts.
oggadm2@host02's password: ********
dsalesab.def 100% 1877
1.8KB/s 00:00
[oggadm1@host01
ogg01]
Of course you replace the asterisks with your password, for example pswd2a.
Make sure the files arrived intact on host02 in the proper directory.
Host02 - Linux
[oggadm2@host02 ogg02]$ ls -l dirdef
total 4
-rw-r--r-- 1 oggadm2 oinstall 1877 Sep 18 13:43 dsalesab.def
[oggadm2@host02
ogg02]$
The column definitions are created and copied. If the table structure changes, you need to do this again.
Data capture, also known as Extract, is done on the source side. A primary extract is required; a secondary
extract, known as a Data Pump, is optional but highly recommended. To configure data capture, perform the
following steps:
Using the naming conventions discussed in the Overview, the path/filename.ext will
be dirprm/esalesaa.prm. The path and extension will be added automatically. (The primary extract
can write a trail file directly to the target host, in which case the suffix would be "ab", but since it is going
to a local data pump before leaving the source host, the suffix is "aa". All of this is just convention, you
can name the processes anything you want.)
Host01 - Linux
[oggadm1@host01 ogg01] ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
... many lines omitted for clarity ...
... many lines omitted for clarity ... but make sure everything
started.
GGSCI (host01)
>
-- :
A comment. Useful for self-documenting files, as well as storing parameters inline that may be used later.
SETENV:
You have to define SID (the Database System Identifier) somewhere: either in the .profile or in the UserID or
here in the SETENV. Only one place is necessary, though if you define it here it overrrides any previous definitions
in the .profile.
ExtTrail:
Not really "external" if you are using a data pump.
aa:
A sequence number is appendeded to this alphabetic prefix. For example, the trail files are named aa000000,
aa000001, aa000002, and so on, rolling over as the file grows beyond the specified size (default 100 MB).
TranLogOptions :
Used later by bidirectional replication to prevent loops.
Table:
You can have multiple Table statements, each with one table name (with optional wildcards) resolving to zero,
one, or more tables. You cannot use a wildcard in the schema name.
It is possible to encrypt the passwords in the file, but that is beyond the scope of this exercise.
You can check your work by entering View Param esalesaa any time.
Create the Extract group and the local Extract trail file.
Host01 - Linux
GGSCI (host01) > Add Extract esalesaa, TranLog, Begin Now
EXTRACT added.
GGSCI (host01) > Add ExtTrail ./dirdat/aa, Extract esalesaa,
Megabytes 5
EXTTRAIL added.
GGSCI (host01)
>
The primary Extract has been created and configured, but not started. Leave GGSCI running for the next
step.
Using the naming conventions discussed in the Overview, the path/filename.ext will
be dirprm/psalesab.prm. The path and extension will be added automatically.
Host01 - Linux
GGSCI (host01) > Edit Param psalesab
-- Data pump (secondary Extract) from host01 to host02
-- Created by Joe Admin on 10/11/2012
Extract psalesab
RmtHost host02, MgrPort 15002, Compress
RmtTrail ./dirdat/ab
Passthru
Table ogguser1.tcust*;
GGSCI (host01)
>
You can check your work by entering View Param psalesab any time.
Create the data pump group and the remote Extract trail file.
Host01 - Linux
GGSCI (host01) > Add Extract psalesab, ExtTrailSource
./dirdat/aa
EXTRACT added.
GGSCI (host01)
>
The data pump reads from the local trail file aa and writes to the remote trail file ab. The remote trail file
that will be created will be named dirdat/ab000000, then when that one fills up the next will
be dirdat/ab000001, then dirdat/ab000002, and so on. Since the two sets of trail files are on
different hosts (even though they are in directories with the same names), the files could be named the
same thing (for example ab). The different file name is chosen just to illustrate that the
parameter RmtTrail is creating a different trail file.
The secondary Extract has been created and configured, but not started. Leave GGSCI running for the
next step.
Make sure the Extract processes were created and registered correctly.
Host01 - Linux
GGSCI (host01) > Info All
MANAGER RUNNING
EXTRACT STOPPED ESALESAA 00:00:00 00:03:24
EXTRACT STOPPED PSALESAB 00:00:00 00:01:22
GGSCI (host01)
>
Since nothing other than the Manager is started yet, the Extract Status should say STOPPED.
Make sure the trail files were created and registered correctly.
Host01 - Linux
GGSCI (host01) > Info ExtTrail *
GGSCI (host01)
>
Since nothing has started yet, the sequence numbers (Seqno) and relative byte addresses (RBA) should
say 0.
Data delivery, also known as Replicat (the "e" is left off intentionally), is done at the target side. To configure
data delivery, perform the following steps:
Host02 - Linux
[oggadm2@host02 ogg02]$ ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
... many lines omitted for clarity ...
... many lines omitted for clarity ... but make sure everything
started.
The Map statement can be simple (as shown here), or very complex, transforming columns and fields.
For example, you could combine three source columns first_name, middle_init,
last_name into a single target column full_name.
Host02 - Linux
GGSCI (host02) > Add Replicat rsalesab, ExtTrail ./dirdat/ab
REPLICAT added.
GGSCI (host02)
>
You can check your work by entering View Param rsalesab any time.
Make sure the Replicat process was created and registered correctly.
Host02 - Linux
GGSCI (host02) > Info All
MANAGER RUNNING
REPLICAT STOPPED RSALESAB 00:00:00 00:00:33
GGSCI (host02)
>
Since nothing other than the Manager is started yet, the Replicat Status should say STOPPED.
Host01 - Linux
GGSCI (host01) > Start Extract *
Sending START request to MANAGER ...
EXTRACT ESALESAA starting
GGSCI (host01)
>
Alternatively, you could have entered, Start *, or Start e* and Start p*.
Host02 - Linux
GGSCI (host02) > Start Replicat *
GGSCI (host02)
>
Host02 - Linux
GGSCI (host02) > Info All
MANAGER RUNNING
REPLICAT RUNNING RSALESAB 00:00:00 00:00:03
GGSCI (host02)
>
Host02 - Linux
GGSCI (host02) > Info rsalesab
REPLICAT RSALESAB Last Started 2012-09-19 19:13 Status
RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:04 ago)
Log Read Checkpoint File ./dirdat/bc000001
First Record RBA 0
GGSCI (host02)
>
Host02 - Linux
GGSCI (host02) > Info rsalesab, Detail
./dirdat/ab000000 * Initialized *
First Record
./dirdat/ab000000 * Initialized *
First Record
GGSCI (host02)
>
In all cases, the Status should be RUNNING, and the time since the last update or checkpoint should be
under 10 seconds.
Host01 - Linux
GGSCI (host01) > Info All
MANAGER RUNNING
EXTRACT RUNNING ESALESAA 00:00:00 00:00:04
EXTRACT RUNNING PSALESAB 00:00:00 00:00:05
GGSCI (host01)
>
Host01 - Linux
GGSCI (host01) > Info Extract *
Similar to the Replicat, the Status should be RUNNING, and the time since the last update or checkpoint
should be under 10 seconds.
Everything should show a status of RUNNING. The source tables are still empty. No data has flowed yet,
nothing has replicated yet.
5. Generating Data
The Oracle GoldenGate software comes with SQL scripts to generate sample data traffic. There is a
difference in how you replicate an existing table (more complicated) versus starting with a new empty table
(simpler). To generate sample data against an empty set of tables, perform the following steps:
5.1 Generating INSERTs (Initial Load)
Host01 - Linux
[oggadm1@host01 ogg01] sqlplus ogguser1@orcl01/pswd1u
@demo_ora_insert.sql
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 -
64bit Production
With the Partitioning, OLAP, Data Mining and Real Application
Testing options
1 row created.
1 row created.
1 row created.
1 row created.
Commit complete.
SQL>
There should not be any errors. Leave SQL*Plus running for the next step.
Verify that the rows were inserted into the source tables.
Host01 - Linux
SQL> SELECT * FROM tcustmer;
SQL> exit
[oggadm1@host01
ogg01]
Verify that the source GGSCI Extract processes are still running.
Host01 - Linux
[oggadm1@host01 ogg01] ./ggsci
GGSCI (host01) 1> Info All
MANAGER RUNNING
EXTRACT RUNNING ESALESAA 00:00:00 00:00:00
EXTRACT RUNNING PSALESAB 00:00:00 00:00:06
If the Status says ABENDED, then check the process reports (covered as a later topic) to see what the
error was.
Verify that the target GGSCI Replicat processes are still running.
On target host02, GGSCI should still be running. Enter the following command:
Host02 - Linux
GGSCI (host02) > Info All
MANAGER RUNNING
REPLICAT RUNNING RSALESAB 00:00:00 00:00:05
If the Status says ABENDED, then check the process reports (covered as a later topic) to see what the
error was.
Verify that rows have been inserted into the target tables.
Host02 - Linux
[oggadm2@host02 ogg02] sqlplus ogguser2@orcl02/pswd2u
SQL> SELECT * FROM tcustmer;
SQL> exit
[oggadm2@host02
ogg02]
There are alternative ways of doing the initial load on the target if the source already has rows in it, but
this is the simplest way when both tables are initially empty.
Host01 - Linux
GGSCI (host01) 2> Send Extract esalesaa, Report
Description:
****************************************************************
*******
** Running with the following parameters
**
****************************************************************
*******
ESALESAA.rpt
(25%)
You can press [Enter] to move one line at a time, or press [Space] to move a page at a time. Go to the
bottom of the report.
Host01 - Linux
****************************************************************
*******
* ** Run Time Statistics **
*
****************************************************************
*******
Output to ./dirdat/aa:
****************************************************************
*******
** Run Time Warnings
**
****************************************************************
*******
GGSCI (host01)
4>
You can do the same thing to view the Data Pump psalesab report.
On the target host02, view the process reports for the Replicat. (For something as trivial as this, you do
not need to run Obey startup.oby, though it couldn't hurt.)
Host02 - Linux
[oggadm2@host02 ogg02]$ ./ggsci
GGSCI (host02) > Send Replicat rsalesab, Report
Description:
****************************************************************
*******
** Running with the following parameters
**
****************************************************************
*******
--More--
(25%)
You can press [Enter] to move one line at a time, or press [Space] to move a page at a time. Go to the
bottom of the report.
Host02 - Linux
****************************************************************
*******
* ** Run Time Statistics **
*
****************************************************************
*******
****************************************************************
*******
** Run Time Warnings
**
****************************************************************
*******
GGSCI (host02)
>
The count of inserts/updates/deletes for the Replicat should match the number for the Extract. If there
were any discards, they should be examined for the reason why they were discarded.
Reports are generated when you ask for a report to be sent (as you just did), or when a process stops.
Reports are named/numbered processname.rpt for the most current one, and
then processname0.rpt, processname1.rpt, processname2.rpt for the most recent, up
to processname9.rpt for the oldest. As each new report is created, all the old reports "move down
one" getting renamed/renumbered until the oldest is discarded. No more than 11 (the most recent with no
number and the previous 0-9) are kept at a time.
Host01 - Linux
GGSCI (host01) > Send Extract esalesaa, Stats
Output to ./dirdat/aa:
End of Statistics.
GGSCI (host01)
>
The command Stats esalesaa does the same thing. If the process stops for any reason, all statistics are
lost.
Host02 - Linux
GGSCI (host02) > Send Replicat rsalesab, Stats
End of Statistics.
GGSCI (host02)
>
Notice that previously the statistics for the primary Extract were from
schema OGGUSER1 to OGGUSER1 since a Data Pump was involved (stayed local to the source host).
Here in the Replicat it is clearer that it is from schema OGGUSER1 to OGGUSER2.
Do not do this yet, but if you ever needed to stop an individual process, you simply enter Stop Extract
esalesaa, or Stop * to stop all of them on a host. Obviously you would replace esalesaa with the process
name you wish to stop.
Do not do this yet, but if you ever needed to delete an individual process, you must first make sure you
are connected to the database (DBLogin) and you enter Delete Extract esalesaa, or Delete ER * to delete
all of them on a host. GGSCI will prompt you, "Are you sure?" and you say, y. You can eliminate the
question by appending an exclamation point to the end of the command. For example, Delete ER *
! assumes the answer is "yes."
You should have unidirectional replication working already. At the simplest implementation, bidirectional
replication is just two unrelated unidirectional replications. So, adopting the naming/numbering convention
from the Overview, one direction will be the "sales" set of files from "a" to "b" (esalesaa, psalesab,
dsalesab, rsalesab), and the other direction will be the "sales" set of files from "b" to "a" (esalesbb,
psalesba, dsalesba, rsalesba). To configure bidirectional replication support, perform the following
steps:
On source host02, create the primary Extract parameter file. This is almost an exact repeat of Topic
3.1.1. See that section for additional notes.
Host02 - Linux
[oggadm2@host02 ogg02] ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
... many lines omitted for clarity ...
GGSCI (host02)
>
The difference between this Extract parameter file and the one on host01 (other than the obvious name
changes) is that TranLogOptions is now active (uncommented).
Create the Extract group and the local Extract trail file.
Host02 - Linux
GGSCI (host02) > Add Extract esalesbb, TranLog, Begin Now
EXTRACT added.
GGSCI (host02)
>
Create the secondary Extract (data pump) parameter file. This is almost an exact repeat of Topic 3.2.1.
See that section for additional notes.
Host02 - Linux
GGSCI (host02) > Edit Param psalesba
-- Data pump (secondary Extract) from host02 to Host01
-- Created by Joe Admin on 10/11/2012
Extract psalesba
RmtHost host01, MgrPort 15001, Compress
RmtTrail ./dirdat/ba
Passthru
Table ogguser2.tcust*;
GGSCI (host02)
>
Create the data pump group and the remote Extract trail file.
Host02 - Linux
GGSCI (host02) > Add Extract psalesba, ExtTrailSource
./dirdat/bb
EXTRACT added.
GGSCI (host02)
>
Make sure the Extract processes were created and registered correctly. This is almost an exact repeat of
Topic 3.3.1. See that section for additional notes.
Host02 - Linux
GGSCI (host02) > Info All
MANAGER RUNNING
EXTRACT STOPPED ESALESBB 00:00:00 00:03:35
EXTRACT STOPPED PSALESBA 00:00:00 00:00:15
REPLICAT RUNNING RSALESAB 00:00:00 00:00:05
GGSCI (host02)
>
You have successfully configured the Extract from host02 to host01 (the return path of the bidirectional
solution).
On target host01, create the Replicat parameter file. This is almost an exact repeat of Topic 4.1.1.
Host01 - Linux
[oggadm1@host01 ogg01]$ ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
... many lines omitted for clarity ...
... many lines omitted for clarity ... but make sure everything
started.
GGSCI (host01)
>
You could define and copy the SourceDefs again from host02 to host01, but since they happen to be
the same table structures, you can use AssumeTargetDefs. In fact, you could have
used AssumeTragetDefs in rsalesab as well.
Host01 - Linux
GGSCI (host01) > Add Replicat rsalesba, ExtTrail ./dirdat/ba
REPLICAT added.
GGSCI (host01)
>
Fix the existing Extract process to acocmodate bidirectional replication. Prevent loopbacks with
the ExcludeUser feature.
Uncomment the line that enables this feature. This matches the same thing host02.
Host01 - Linux
GGSCI (host01) > Stop esalesaa
GGSCI (host01)
>
Make sure the Replicat process was created and registered correctly.
Host01 - Linux
GGSCI (host01) > Info All
MANAGER RUNNING
EXTRACT STOPPED ESALESAA 00:00:00 00:04:22
EXTRACT RUNNING PSALESAB 00:00:00 00:00:02
REPLICAT STOPPED RSALESBA 00:00:00 00:06:57
GGSCI (host01)
>
It is okay for the Time Since Chkpt to exceed 10 seconds if the Status is STOPPED, but if
the Status is RUNNING then the time should be less than 10 seconds.
Host01 - Linux
GGSCI (host01) > Start *
MANAGER RUNNING
EXTRACT RUNNING ESALESAA 00:00:00 00:00:00
EXTRACT RUNNING PSALESAB 00:00:00 00:00:02
REPLICAT RUNNING RSALESBA 00:00:00 00:00:01
Host02 - Linux
GGSCI (host02) > Start *
MANAGER RUNNING
EXTRACT RUNNING ESALESBB 00:00:00 00:00:01
EXTRACT RUNNING PSALESBA 00:00:00 00:00:02
REPLICAT RUNNING RSALESAB 00:00:00 00:00:04
GGSCI (host02)
>
All Extract and Replicat processes are configured and started from host02 to host01. The earlier Extract
and replicat from host01 to host02 are still running.
Host01 - Linux
[oggadm1@host01 ogg01] sqlplus ogguser1@orcl01/pswd1u
SQL> INSERT INTO tcustmer VALUES ('WHIZ','WHIZBANG
CORP','HOSTA','AA');
1 row created.
6 rows selected.
SQL> commit;
Commit complete.
SQL> exit
[oggadm1@host01
ogg01]
Host02 - Linux
GGSCI (host02) > Info All
MANAGER RUNNING
EXTRACT RUNNING ESALESBB 00:00:00 00:00:05
EXTRACT RUNNING PSALESBA 00:00:00 00:00:05
REPLICAT RUNNING RSALESAB 00:00:00 00:00:06
GGSCI (host02)
>
Host02 - Linux
GGSCI (host02) > Exit
[oggadm2@host02 ogg02] sqlplus ogguser2@orcl02/pswd2u
SQL> SELECT * FROM tcustmer;
6 rows selected.
SQL>
Do not worry if the row order is different. Leave SQL*Plus running for the next step.
Host02 - Linux
SQL> INSERT INTO tcustmer VALUES ('FOO','FOOBAR
INC','HOSTB','CC');
1 row created.
7 rows selected.
SQL> commit;
Commit complete.
SQL> exit
[oggadm2@host02
ogg02]
Host02 - Linux
[oggadm2@host02 ogg02] ./ggsci
GGSCI (host02) > Info All
MANAGER RUNNING
EXTRACT RUNNING ESALESBB 00:00:00 00:00:06
EXTRACT RUNNING PSALESBA 00:00:00 00:00:03
REPLICAT RUNNING RSALESAB 00:00:00 00:00:04
GGSCI (host02)
>
Host01 - Linux
[oggadm1@host01 ogg01] sqlplus ogguser1@orcl01/pswd1u
SQL> SELECT * FROM tcustmer;
7 rows selected.
SQL> exit
[oggadm1@host01
ogg01]
Both host01 and host02 should have the same rows. (If you are curious, the reason the row order is
different is because the two rows you inserted went into the "holes" left by earlier deletes and rollbacks
that never got replicated.)
This does not take into account the possibility of collision detection and resolution (CDR), which is
beyond the scope of this OBE.
Summary
Oracle GoldenGate can do far more than was demonstrated in this simple exercise.
Resources
o Oracle GoldenGate Product Documentation version 11.2.1 (E35209-01) and other older versions
o Courses from Oracle University
o External Web sites for related information
o To learn more about Oracle GoldenGate, refer to additional OBEs in the Oracle Learning Library
Credits