GoldenGate 12.2 setup Uni-Directional Sync of some DB schemas with RMAN Active Duplicate Initial Load

This blog demonstrates an Oracle GoldenGate 12.2 setup Uni-Directional Sync of a subset of schemas Oracle 12.2 DB with / using RMAN Active Duplicate for the “Initial Load” (initial GoldenGate load of the target).  The entire DB will be duplicated so we can replicate whatever schemas we choose – for now I’m picking HR – which was installed with when I selected “install sample schemas” on the original source DB installation.
Assumptions:

  • you already have an open in achivelog mode Oracle Enterprise database on a Oracle Linux 6.X you can use as the source – in my case this is a 12c / 12.2.0.1 DB but, it does not have to be that version or dialect of Linux.  And you have a GoldenGate binaries (only) target server setup, that is at the same or higher version of Oracle DB and or Linux.  Refer to Oracle GoldenGate Documentation for a compatibility matrx – as this same process will likely work for many different Oracle DB and OS versions.
  • We will use Oracle RMAN Active Duplication to create the target database so, on the target server, only the Oracle DB binaries need to exist (Software Only install not shown – use the same directory structure as the source if possible).
  • The easiest way to confirm compatibility is use the same OS and DB versions.  Then you are good with RHEL / Oracle Linux 5, and 6 and Oracle 10g forward thru 12c.
  • I used VirtualBox on a Win 10 Host to create two Oracle Linux VM clients each with bridged adapter networking and added both hosts to C:\WINDOWS\system32\drivers\etc\hosts – so that the two VMs could talk to each other

Basically, the steps are at a very high level as follows:

  • Install GoldenGate 12.2 on both servers – download GG 12.2 from otn.oracle.com or edelivery.oracle.com
  • Configure the source side for GoldenGate use
  • Configure Active Duplicate using RMAN – requires steps on both sides
  • Start the GoldenGate “extract” to capture changes on the source side while the “dup” is running – record the SCN
  • Start and complete the RMAN Active Duplicate – until SCN recorded
  • Configure the target side of the GoldenGate replicat/apply
  • Start the target side GoldenGate replicat/apply
  • Verify / test

Install GoldenGate 12.2 on both servers 
Start by downloading GG 12.2 from otn.oracle.com or edelivery.oracle.com if you have not already
Unzip the download on both your Linux servers – I did this here:
unzip fbo_ggs_Linux_x64_shiphome.zip -d /u01/app/oracle/product/12.2.0/gg123

./runInstaller

Accept the defaults – the install should go to the same directory you unzipped to – it’s a very quick and simple installation.
Add the install path – /u01/app/oracle/product/12.2.0/gg123 to your LD_LIBRARY_PATH
Here is mine:

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/u01/app/oracle/product/12.2.0/gg123
export GG_HOME=/u01/app/oracle/product/12.2.0/gg123 #–(optional)

On the source database side set up force and supplemental logging properly with a tool like sqlplus / as sysdba:

ALTER DATABASE FORCE LOGGING;
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
ALTER SYSTEM SWITCH LOGFILE;
alter system set enable_goldengate_replication=TRUE scope=both;

Now on the source side create the Oracle Users / Schema required for GoldenGate

sqlplus / as sysdba
CREATE USER ggadmin IDENTIFIED BY ggadmin;
GRANT CONNECT, RESOURCE, DBA TO ggadmin;
begin
DBMS_GOLDENGATE_AUTH.GRANT_ADMIN_PRIVILEGE(‘GGADMIN’);
end;
/
grant flashback any table to ggadmin;
alter system set undo_retention=86400 scope=both;
exit

# still on the source server
cd $GG_HOME
./ggsci
create wallet
add credentialstore
Alter CredentialStore Add User ggadmin@gold Password ggadmin Alias aggadmin
info credentialstore
DBLOGIN USERIDALIAS aggadmin
Syntax
ALTER CREDENTIALSTORE {
ADD USER userid |
REPLACE USER userid #changes password |
DELETE USER userid }
[PASSWORD password]
[ALIAS alias]
[DOMAIN domain] – optional
# create roles, and setup GG objects for the ggadmin user and grant role
# the steps below were required with GG 11 – verify accuracy for 12.2
cd $GG_HOME
sqlplus / as sysdba
@role_setup.sql
GRANT GGS_GGSUSER_ROLE TO ggadmin;
 [oracle@o68-122db gg122]$ ./ggsci

# the edit command below will open vi… paste in “GGSCHEMA ggadmin” and save the file

# you will be returned to the ggsci prompt
EDIT PARAMS ./GLOBALS
# paste in
GGSCHEMA ggadmin
# save the file
EDIT PARAMS extract1
# paste in
EXTRACT extract1
USERID ggadmin PASSWORD ggadmin
LOGALLSUPCOLS
UPDATERECORDFORMAT COMPACT
DDL INCLUDE MAPPED
EXTTRAIL /u01/app/oracle/product/12.2.0/gg123/lt
SEQUENCE hr.*;
TABLE hr.*;
# save the file
# now login as the admin/extractor and tell the DB and goldengate what schema you are interested in
DBLOGIN USERID ggadmin, PASSWORD ggadmin
#or now that you have a useridalias use this syntax
DBLOGIN USERIDALIAS aggadmin
add schematrandata hr
# if you just want to do one table – it’s “add trandata schema.table”
GGSCI (oel66-noDB.localdomain as ggadmin@gold) 13>
dblogin useridalias aggadmin
Successfully logged into database.GGSCI (oel66-noDB.localdomain as ggadmin@gold) 14>
add checkpointtable ggadmin
# two tables were created in ggadmin as a result of the command above
add extract extract1, integrated tranlog, begin now
ADD EXTTRAIL /u01/app/oracle/product/12.2.0/gg123/dirdat/in, EXTRACT EXTRACT1
register extract extract1 database
2018-01-05 13:48:09 INFO OGG-02003 Extract EXTRACT1 successfully registered with database at SCN 1578733.
NOTE: the SCN 1578733 is important – as that is what we will duplicate up to – with duplicate database until scn=1578733
info all
start manager
Manager started.GGSCI (oel66-noDB.localdomain as ggadmin@gold) 22>
start extract1
EXTRACT EXTRACT1 starting
#Well if you wanted to see what is going on cat $GG_HOME/ggserr.log, or check the logs in $GG_HOME/dirrpt (in another ssh session – cd $GG_HOME/dirrpt)
[oracle@oel66-noDB dirrpt]$ tail EXTRACT1.rpt

or
./ggsci
VIEW GGSEVT
# if you wanted to drop and recreate an extract
#First stop the extract, then delete the old
stop extract extract1
DELETE EXTRACT extract1
# recreate
add extract extract1, integrated tranlog, begin now
ADD EXTTRAIL /u01/app/oracle/product/12.2.0/gg123/dirdat/in, EXTRACT EXTRACT1
# may have to re-register
register extract extract1 database
EXTTRAIL added. # now start it again and check status start extract1 info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING EXTRACT RUNNING EXTRACT1 00:00:09 00:00:00 # that did the trick... at least on the extract... now on to the data pump... then the apply/replicat
# now setup a dpump process to move the trail file to the target
# so here's the process in English for the dpump process
# 1.) associate the local trail file that extract is creating with the dpump process and create the dpump process - with add extract dpump
# 2.) create the dpump parameter file in ./dirprm dir
# 3.) tell dpump more about where the remote trail is going on the target with add rmttrail
ADD EXTRACT dpump, EXTTRAILSOURCE /u01/app/oracle/product/12.2.0/gg123/dirdat/in
edit params dpump
# save the following in the .prm file (by the way – it gets save in $GG_HOME/dirprm/dpump.prm)
EXTRACT dpump
USERID ggadmin, PASSWORD ggadmin
RMTHOST ggrep1.localdomain, MGRPORT 7809
RMTTRAIL /u01/app/oracle/product/12.2.0/gg123/dirdat/rt
PASSTHRU
TABLE HR.*;
ADD RMTTRAIL /u01/app/oracle/product/12.2.0/gg123/dirdat/rt, EXTRACT DPUMP
start dpump  — yes it abends because the target is not setup properly… that is OK for now
# on the target
Here is the link to the “Active Duplicate”
Since we are starting with a clone – ggadmin will already exist – and so will the ggadmin.CHKPTAB
  • dblogin userid ggadmin password ggadmin
  • add checkpointtable ggadmin.CHKPTAB  # no need for this since we are cloning the source after CHKPTAB was added to the source – skip this one
ADD REPLICAT rep1, integrated, CHECKPOINTTABLE ggadmin.CHKPTABEXTTRAIL  /u01/app/oracle/product/12.2.0/gg123/dirdat/rt
or
ADD REPLICAT rep1, integrated, EXTTRAIL /u01/app/oracle/product/12.2.0/gg123/dirdat/rt
Create the parameter file for the Replicat group
EDIT PARAMS rep1
# paste in the following
REPLICAT rep1
ASSUMETARGETDEFS
USERID ggadmin, PASSWORD ggadmin
DISCARDFILE /u01/app/oracle/product/12.2.0/gg123/discards, PURGE
MAP HR.*, TARGET HR.*;
# again on the target
# make sure the manager is up;
info all
# if not
start mgr
#
start replicat rep1
 References:

  • http://docs.oracle.com/goldengate/c1221/gg-winux/index.html
  • Julian Dyke http://www.juliandyke.com/Research/GoldenGate/GoldenGateBasicConfiguration.php
  • http://gavinsoorma.com/2010/02/oracle-goldengate-tutorial-6-configuring-data-pump-process/
  • http://decipherllc.blogspot.com/2010/07/troubleshooting-oracle-goldengate.html
  • 1411356.1 – Database specific bundle patch for Integrated Extract 11.2.x
  • 1484313.1 – How To Upgrade From GoldenGate Classic Extract to Integrated Extract
  • 1467874.1 – What versions of Oracle Database can Integrated Extract be run on?
  • 1485620.1 – Oracle GoldenGate Best Practices: Configuring Downstream Integrated Extract
*************** note – not all vetted yet – check if required for 12.2 *************************************************
 # miscellaneous Manager param edits to purge – don’t use the stuff below yet – needs to be vetted with 12.2
DBLOGIN USERID ggadmin, PASSWORD
ggadmin
EDIT PARAMS ./GLOBALS
# add this one line to the file and save
CHECKPOINTTABLE ggadmin.CHKPTAB – errored out with invalid command
# now just issue this ggsci command
add checkpointtable ggadmin.CHKPTAB
ADD EXTRACT extract1, TRANLOG, BEGIN NOW
edit params mgr
USERID ggadmin, PASSWORD ggsadmin
PURGEOLDEXTRACTS /u01/app/oracle/product/12.2.0/gg122/dirdat/ex, USECHECKPOINTS
# now saveGGSCI (vm-ora2) 3> start mgr
 # from another blog:
RMAN & Golden Gate
Duplicate the source database to target (you can use the SCN number what you have got when you created the extract process from Golden Gate, in our case 401678)

1
2
3
4
oracle@vm-ora2:~$ rman target sys/oracle@source auxiliary /
connected to target database: SOURCE (DBID=2874333303)
connected to auxiliary database: TARGET (not mounted)
RMAN> duplicate target database to "target" until scn 401678;

 

Scroll to Top