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
cd $GG_HOME./ggscicreate wallet
add credentialstoreAlter CredentialStore Add User ggadmin@gold Password ggadmin Alias aggadmininfo credentialstoreDBLOGIN USERIDALIAS aggadminSyntax
ALTER CREDENTIALSTORE {
ADD USER userid |
REPLACE USER userid #changes password |
DELETE USER userid }
[PASSWORD password]
[ALIAS alias]
[DOMAIN domain] – optional
cd $GG_HOMEsqlplus / as sysdba@role_setup.sqlGRANT GGS_GGSUSER_ROLE TO ggadmin;
# the edit command below will open vi… paste in “GGSCHEMA ggadmin” and save the file
EDIT PARAMS ./GLOBALS
GGSCHEMA ggadmin
EDIT PARAMS extract1
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.*;
DBLOGIN USERID ggadmin, PASSWORD ggadmin
DBLOGIN USERIDALIAS aggadminadd schematrandata hr
add extract extract1, integrated tranlog, begin now ADD EXTTRAIL /u01/app/oracle/product/12.2.0/gg123/dirdat/in, EXTRACT EXTRACT1
Manager started.GGSCI (oel66-noDB.localdomain as ggadmin@gold) 22>
or
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
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
USERID ggadmin, PASSWORD ggadmin
RMTHOST ggrep1.localdomain, MGRPORT 7809
RMTTRAIL /u01/app/oracle/product/12.2.0/gg123/dirdat/rt
PASSTHRU
TABLE HR.*;
- 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
ASSUMETARGETDEFS
USERID ggadmin, PASSWORD ggadmin
- 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
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
USERID ggadmin, PASSWORD ggsadmin
PURGEOLDEXTRACTS /u01/app/oracle/product/12.2.0/gg122/dirdat/ex, USECHECKPOINTS
# now saveGGSCI (vm-ora2) 3> start mgr
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; |