Professional Documents
Culture Documents
Kevin Lidh
13 August 2010
Table of Contents
Things of note before we start that I learned along the way......................................................................3
Before we begin.........................................................................................................................................4
Install GoldenGate software.......................................................................................................................5
Create GoldenGate directories...................................................................................................................5
Create GoldenGate administrator account on source and target................................................................6
Configure and start the manager................................................................................................................7
The trials of my “initial load”....................................................................................................................8
Create extract group on the source side (Solaris).......................................................................................9
Create checkpoint table and replicat group on target side (RHEL5).........................................................9
Verify everything is working....................................................................................................................10
And the final test......................................................................................................................................10
In conclusion............................................................................................................................................12
Things of note before we start that I learned along the way
• The directories you create with the “create subdirs” command will be created in your present
working directory so be sure you are where you want them to go.
• Even though some documents will tell you to add the install directory (where you untar the
software) to your path, everything you run looks for files or directories from your present
working directory so you pretty much have to be sitting in the install directory to run anything
GoldenGate related.
• Ensure your ORACLE_SID is set before you do anything in GoldenGate.
• Your extract and replicat group names can only be up to 8 characters.
Before we begin
My goal was to migrate a schema from one platform and Oracle version to a completely different
platform and version of Oracle. I already had a Solaris x86-64 virtual machine and a CentOS 5 virtual
machine (think RHEL5) from earlier tests so I decided those would be my platforms. GoldenGate has
a 10g version for my Solaris environment so I installed Oracle 10gR2 (10.2.0.1.0) and upgraded it to
10.2.0.4.0. I created a database called ggtest and created a simple schema called appuser with a
mycustomer, oldcustomer, and custorder table as well as a foreign key constraint and a sequence.
[/u02/GoldenGate]
$ uname -a
SunOS soleil 5.10 Generic_142901-03 i86pc i386 i86pc
[/u02/GoldenGate]
$ sqlplus appuser/appuser
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
appuser@GGTEST>
From here, before I could really test GoldenGate, I needed to create a transaction generator. So I wrote
a quick-and-dirty transaction generator in Java using jdbc. This only creates one connection and
performs a random number of customer adds, customer removals, and customer orders. I also
populated the oldcustomer and mycustomer tables with 169 customers, all with unique names. So now
I'm ready to install and test GoldenGate.
Copyright (C) 1995, 2009, Oracle and/or its affiliates. All rights reserved.
Then I created the directories on the target side. Note the version of GoldenGate is different as the
versions of my databases are different.
[/u02/GoldenGate]
$ ggsci
Tablespace created.
User created.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
sys@GGREP>
The missing steps were to turn the recyclebin off and bouncing the databases and then the following
scripts and command:
SQL> @$GGATE/marker_setup.sql
SQL> @$GGATE/ddl_setup.sql
SQL> @$GGATE/role_setup.sql
SQL> grant GGS_GGSUSER_ROLE to ggate;
SQL> @$GGATE/ddl_enable.sql
At this point, in both databases (although I'm sure its only necessary on the source), I turned on
supplemental logging.
sys@GGTEST> alter database add supplemental log data (all) columns;
Database altered.
Database altered.
Copyright (C) 1995, 2009, Oracle and/or its affiliates. All rights reserved.
Manager started.
GGSCI (soleil) 3> info manager
Copyright (C) 1995, 2009, Oracle and/or its affiliates. All rights reserved.
port 7809
userid ggs_owner, password ggs_owner
purgeoldextracts /u02/GoldenGate/dirdat/ex, usecheckpoints
Manager started.
So at this point, the managers are running and the communication port is 7809 on both nodes.
MANAGER RUNNING
-- extract group --
extract ext1
-- connection to database --
userid ggs_owner, password ggs_owner
-- hostname and port for trail
rmthost centora, mgrport 7809
-- path and name for trail --
rmttrail /u02/GoldenGate/dirdat/lt
-- DDL support
ddl include mapped objname appuser.*;
-- DML
table appuser.*;
ggschema ggs_owner
checkpointtable ggs_owner.checkpoint
-- replicat group --
replicat rep1
-- source and target definitions --
assumetargetdefs
-- target database login --
userid ggs_owner, password ggs_owner
-- file for discarded transaction --
discardfile /u02/GoldenGate/discard/rep1_discard.txt, append,megabytes 10 --NOTE: Have
to create the directory first. Now it's running!
-- DDL support --
DDL
-- specify table mapping --
map appuser.*, target appuser.*;
MANAGER RUNNING
EXTRACT RUNNING EXT1 00:00:00 00:00:00
MANAGER RUNNING
REPLICAT RUNNING REP1 00:00:00 00:00:02
So before the transaction loop ended, the customer Perry ordered 10 widgets. First, lets ensure that this
customer order is actually in the source database.
appuser@GGTEST> select * from custorder where custid = (select id from mycustomer where
name = 'Perry');
appuser@GGTEST>
So the record is there. Now let's see if the record has made it to the target database.
appuser@GGREP> select * from custorder where custid = (select id from mycustomer where name
= 'Perry');
appuser@GGREP>
And it is. So my first test implementation of GoldenGate has been a success. I can run my transaction
generator for hours and the data will move to a different Oracle version on a different platform. If you
didn't notice, when I configured GoldenGate, I also told it to migrate DDL. So let's run a quick little
test to see if DDL makes it over.
appuser@GGTEST> create table newtable (col1 varchar2(20));
Table created.
1 row created.
appuser@GGTEST> commit;
Commit complete.
COL1
--------------------
Hello new table
appuser@GGTEST>
COL1
--------------------
Hello new table
appuser@GGREP>
So I was able to create a brand new table on the source side and add a record and it was all replicated to
the target side. Another success.
In conclusion
So for now I've proved that I can configure GoldenGate and do simple table migration. On my “to do”
list for future GoldenGate testing:
1. Expand this test to include different data types including longs and LOBs. Longs are every
migration's enemy.
2. Get a successful GoldenGate initial load done
3. Do a migration of a database that is in use the entire time. This would be more realistic of
environments I could come across.
4. Do a test in other operating systems like Solaris SPARC, HP-UX, AIX and even VMS.