You are on page 1of 25

BI-DIRECTIONAL REPLICATION 

WITH CONFLICT DETECTION AND


RESOLUTION (CDR) USING ORACLE GOLDENGATE 12C
 
 
Oracle GoldenGate is an asynchronous solution, in a dual active environment systems,
conflicts can occur when modifications are made to identical sets of data on separate
systems at the same time. Conflicts occur when the timing of simultaneous changes
results in one of these out-of-sync conditions:
 
 

 
• A replicated insert attempts to add a row that already exists in the target system.
• The before image of a replicated update does not match the current row in the target
system.
• A replicated delete attempts to remove a row that does not exist in the target system.
 
Scenario: Scott user of Oracle 11g database in ORCL database updates a row, and
Scott user of Oracle 12c database in ORCLDB database updates the same row. If Scott
user’s in ORCLDB transaction occurs before Scott User’s in ORCL transaction is
synchronized to ORCLDB, there will be a conflict on the replicated transaction.
 
Because conflict-resolution routines must be customized to specific applications and
business rules, GoldenGate does not provide default procedures for handling conflicts.
 
This article explains to configure Oracle GoldenGate (OGG) software to perform bi-
directional replication with Conflict, Detection and Resolution (CDR), between Oracle
11g Database (orcl) and Oracle 12c database (orcldb)
For this exercise, the details given below:
 

 
ORACLE GOLDENGATE 12C PROCESSES IN SOURCE
DATABASE AND TARGET DATABASE
 

 
ORACLE GOLDENGATE PROCESSES @SOURCE DATABASE
(ORCL):
 
   Extract Process (ESCOTT): This process will capture transactions from the Oracle
transactions logs.
   Extract Process (PSCOTT): This process reads from a trail file and not from
database’s transaction log.
   Replicat Process (RSCOTT): This process also known as Coordinated Replicat
Process, and tells this process from which trail file to read.
 
 
ORACLE GOLDENGATE PROCESSES @TARGET DATABASE
(ORCLDB):
 
   Extract Process (ES01): This process will capture transactions from the Oracle
logmining server.
   Extract Process (PS01): This process reads from a trail file and not from database’s
transaction log.
   Replicat Process (RS01): This process also known as Integrated Replicat Process,
and tells this process from which trail file to read.
 
 
SERIES OF STEPS @SOURCE DATABASE (ORCL):
 
 Installed Oracle 11g R2 database software as a ‘oracle’ user in the following directory
 ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
 Installing Oracle GoldenGate 12c software as a ‘oracle’ user in the following directory
GOLDENGATE_HOME=/u01/app/ogg/12g
 Configuring, creating subdirs for Oracle GoldenGate 12c in source database (orcl)
 Create and configure Manger, Extract processes, Replicat process for bi-directional
between Oracle 11g database (orcl) and Oracle 12c database (orcldb)
  

INSTALLING ORACLE GOLDENGATE 12C AS ‘ORACLE’ USER IN


SOURCE DATABASE
 
Select the option “Oracle GoldenGate for Oracle Database 11g (477.0 MB)”
 
 
Define the path for Oracle GoldenGate: /u01/app/ogg/12g
 
 

 
Successfully installed Oracle GoldenGate 12c software binaries for Oracle 11g
database in source database (ORCL).
 
 
CONFIGURING ORACLE GOLDENGATE 12C IN SOURCE
DATABASE (ORCL)
 
Run ggsci command to log into the GoldenGate command line interface (GGSCI)
[oracle@ggnode1 12g]$ ./ggsci
 
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 11g on Sep 25 2013 00:31:13
Operating system character set identified as UTF-8.
Copyright (C) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
 
The following command will logs into the database as a ‘ogguser’
GGSCI (ggnode1.oracle.com) 1> dblogin userid ogguser, password oracle
 
Successfully logged into database.
 
The following command will create subdirectories required for Oracle GoldenGate
environment
GGSCI (ggnode1.oracle.com) 2> CREATE SUBDIRS
 
Creating subdirectories under current directory /u01/app/ogg/12g
 
Parameter files                  /u01/app/ogg/12g/dirprm: created
Report files                     /u01/app/ogg/12g/dirrpt: created
Checkpoint files                /u01/app/ogg/12g/dirchk: created
Process status files            /u01/app/ogg/12g/dirpcs: created
SQL script files                 /u01/app/ogg/12g/dirsql: created
Database definitions files      /u01/app/ogg/12g/dirdef: created
Extract data files               /u01/app/ogg/12g/dirdat: created
Temporary files                 /u01/app/ogg/12g/dirtmp: created
Credential store files          /u01/app/ogg/12g/dircrd: created
Masterkey wallet files          /u01/app/ogg/12g/dirwlt: created
Dump files                       /u01/app/ogg/12g/dirdmp: created
GGSCI (ggnode1.oracle.com) 2> exit
 
Run these commands from the command line in the $GG directory.
 
Check to make sure the Oracle GoldenGate libraries are linked with the Oracle Libraries
for Manager, Extract Process, Replicat Process and Oracle GoldenGate Software
Command Interface (GGSCI).
 
[oracle@ggnode1 12g]$ ldd mgr
[oracle@ggnode1 12g]$ ldd extract
[oracle@ggnode1 12g]$ ldd replicat
[oracle@ggnode1 12g]$ ldd ggsci
 
LOG INTO SOURCE DATABASE AS A ‘SYSDBA’
 
 Logs into source database (orcl) as a ‘sysdba’
 Check the database archive log mode.
 Creates GoldenGate tablespace
 Creates GoldenGate user ‘ogguser’
 Assign privileges for ‘ogguser’ user
 Adds database level supplemental logging
 
[oracle@ggnode1 admin]$ sqlplus / as sysdba
SQL> connect sys/oracle@orcl as sysdba
SQL> archive log list;
SQL> CREATE TABLESPACE GOLDENGATE
          DATAFILE '/u01/app/oracle/oradata/orcl/goldengate01.dbf' SIZE 100M
AUTOEXTEND ON;
SQL> CREATE USER ogguser IDENTIFIED BY oracle
          DEFAULT TABLESPACE GOLDENGATE TEMPORARY TABLESPACE TEMP
ACCOUNT UNLOCK;
SQL> GRANT CONNECT TO ogguser;
SQL> GRANT DBA TO ogguser;
SQL> GRANT UNLIMITED TABLESPACE TO ogguser;
SQL> GRANT SELECT ANY DICTIONARY TO ogguser;
SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
SQL> ALTER SYSTEM SWITCH LOGFILE;
SQL> SELECT SUPPLEMENTAL_LOG_DATA_MIN FROM V$DATABASE;
SQL> exit
 
INSTALLING ORACLE GOLDENGATE 12C AS ‘ORACLE’ USER IN
TARGET DATABASE
 
Series of Steps @Target Database (orcldb):
 
 Installed Oracle 12c R1 database software as a ‘oracle’ user in the following directory
ORACLE_HOME=/u01/app/oracle/product/12.1.0/db_1
 Installing Oracle GoldenGate 12c software as a ‘oracle’ user in the following directory
GOLDENGATE_HOME=/u01/app/ogg/12c
 Configuring, creating subdirs for Oracle GoldenGate 12c in source database (orcldb)
 Create and configure Manger, Extract processes, Replicat process for bi-directional
between 
Oracle 11g database (orcl) and Oracle 12c database (orcldb)
 
Select the option “Oracle GoldenGate for Oracle Database 12c”
 
 

 
Select Software Location: /u01/app/ogg/12c
 
 
 

 
Successfully installed Oracle GoldenGate 12c software binaries for Oracle 12c
database in target database (ORCLDB).
 
Run ggsci command to log into the GoldenGate command line interface (GGSCI)
[oracle@ggnode2 12c]$ ./ggsci
 
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.
 
The following command will create subdirectories required for Oracle GoldenGate
environment
GGSCI (ggnode2.oracle.com) 1> create subdirs
Creating subdirectories under current directory /u01/app/ogg/12c
 
Parameter files                  /u01/app/ogg/12c/dirprm: already exists
Report files                     /u01/app/ogg/12c/dirrpt: created
Checkpoint files                /u01/app/ogg/12c/dirchk: created
Process status files            /u01/app/ogg/12c/dirpcs: created
SQL script files                 /u01/app/ogg/12c/dirsql: created
Database definitions files      /u01/app/ogg/12c/dirdef: created
Extract data files               /u01/app/ogg/12c/dirdat: created
Temporary files                 /u01/app/ogg/12c/dirtmp: created
Credential store files          /u01/app/ogg/12c/dircrd: created
Masterkey wallet files          /u01/app/ogg/12c/dirwlt: created
Dump files                       /u01/app/ogg/12c/dirdmp: created
GGSCI (ggnode2.oracle.com) 2> exit
 
LOG INTO TARGET DATABASE, CHECK ARCHIVE LOG MODE
AND CREATE USER ‘OGGUSER’ WITH REQUIRED PRIVILEGES
AS ‘SYSDBA’
 
 Logs into target database (orcldb) as a ‘sysdba’
 Check the database archive log mode.
 Creates GoldenGate tablespace
 Creates GoldenGate user ‘ogguser’
 Assign privileges for ‘ogguser’ user
 Adds database level supplemental logging
 
SQL> connect sys/oracle@orcldb as sysdba
SQL> archive log list
SQL> CREATE TABLESPACE GOLDENGATE DATAFILE
'/u01/app/oracle/oradata/orcldb/goldengate01.dbf' SIZE 100M AUTOEXTEND ON;
SQL> CREATE USER ogguser IDENTIFIED BY oracle DEFAULT TABLESPACE
GOLDENGATE TEMPORARY TABLESPACE TEMP ACCOUNT UNLOCK;
SQL> GRANT CONNECT TO ogguser;
SQL> GRANT DBA TO ogguser;
SQL> GRANT UNLIMITED TABLESPACE TO ogguser;
SQL> GRANT SELECT ANY DICTIONARY TO ogguser;
SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
SQL> ALTER SYSTEM SWITCH LOGFILE;
SQL> SELECT SUPPLEMENTAL_LOG_DATA_MIN FROM V$DATABASE;
SQL> exit
 
 
LOGIN INTO ORACLE GOLDENGATE 12C IN SOURCE
DATABASE SERVER
 
Run ggsci command to log into the GoldenGate command line interface (GGSCI)
[oracle@ggnode1 12g]$ ./ggsci
 
The following command will logs into the database as a ‘ogguser’
GGSCI (ggnode1.oracle.com) 1> dblogin userid ogguser, password oracle
Successfully logged into database.
 
1. A Credential Store and User Alias to store the database login information that
GoldenGate will use to connect to the database.
2. An Extract that will be configured to capture transactions against the Oracle 11g
database, using the USERIDALIAS connection parameter.
3. An Extract that will serve as a Pump process to send data to the OGG 12c side.
4. A Coordinated Replicat that will deliver captured transactions from the OGG 12c
trail files to the Oracle 11g database, assigning 4 Threads based on table names.
 
The following commands will incorporate the new Oracle GoldenGate 12c feature
known as a Credential Store. Credential Store is a User ID and password storage
mechanism that utilizes the auto login wallet within the Credential Store at source
database (orcl)
 
GGSCI (ggnode1.oracle.com) 3> add credentialstore
Credential store created in ./dircrd/.
 
GGSCI (ggnode1.oracle.com) 3> alter credentialstore add user ogguser password
oracle alias oggalias
Credential store in ./dircrd/ altered.
 
GGSCI (ggnode1.oracle.com) 4> info credentialstore
 
Reading from ./dircrd/:
Domain: OracleGoldenGate
  Alias: oggalias
  Userid: ogguser
 
This following Extract Process (ESCOTT) process will capture transactions from the
Oracle transactions logs.
 
GGSCI (ggnode1.oracle.com) 3> add extract escott, tranlog, begin now
EXTRACT added.
 
The following command adds a trail file in /dirdat directory and prefix with “ee” that will
be written to the local machine and associates it to an Extract Process (ESCOTT)
 
GGSCI (ggnode1.oracle.com) 4> add exttrail ./dirdat/ee, extract escott, megabytes 10
EXTTRAIL added.
 
The following Extract Process (PSCOTT) will reads from a trail file and not from
database’s transaction log.
 
GGSCI (ggnode1.oracle.com) 5> add extract pscott, exttrailsource ./dirdat/ee
EXTRACT added.
 
The following command adds a trail file in /dirdat directory and prefix with “pe” that will
be written to the remote machine and associates it to an Extract Process (PSCOTT)
 
GGSCI (ggnode1.oracle.com) 6> add rmttrail ./dirdat/pe, extract pscott, megabytes 10
RMTTRAIL added.
 
The files shows important parameter PORT. This is the TCP/IP communication port
used between Manager Process and Oracle GoldenGate Processes. The
PURGEOLDEXTRACTS parameter instructs the Manager Process to purge local trail
files already used by Extract Processes.
 
GGSCI (ggnode1.oracle.com) 7> edit param mgr
 
PORT 15500
DYNAMICPORTLIST 15510-15520
PURGEOLDEXTRACTS ./dirdat/*, USECHECKPOINTS
 
The GGSCI command VIEW PARAM lets view a text file stored in the operating system
(OS)
GGSCI (ggnode1.oracle.com) 8> view param mgr
 
The GLOBALS file is in the Oracle GoldenGate (OGG) directory. This allows the
checkpoint table to be created under the user ‘OGGUSER’. The parameter GLOBALS
must be in upper case.
 
GGSCI (ggnode1.oracle.com) 9> edit param ./GLOBALS
GGSCI (ggnode1.oracle.com) 10> view param ./GLOBALS
 
GGSCHEMA OGGUSER
ENABLEMONITORING
CHECKPOINTTABLE GGS_CHECKPOINT
 
This command creates a checkpoint table used in the Replicat Recovery.
 
GGSCI (ggnode1.oracle.com) 2> add checkpointtable
No checkpoint table specified. Using GLOBALS specification (GGS_CHECKPOINT)...
Successfully created checkpoint table GGS_CHECKPOINT.
 
The following Replicat Process (RSCOTT) also known as Coordinated Replicat
Process, and tells this process from which trail file to read.
 
GGSCI (ggnode1.oracle.com) 5> add replicat rscot, coordinated, exttrail ./dirdat/pa
REPLICAT (Coordinated) added.
 
The parameter ADD SCHEMATRANDATA command adds supplemental logging to all
tables, both current and future of the SCOTT schema, and is the best method to enable
supplemental logging when both DML and DDL are concurrent.
 
GGSCI (ggnode1.oracle.com) 6> add schematrandata scott
 
2015-04-23 19:43:09  INFO    OGG-01788  SCHEMATRANDATA has been added on
schema scott.
2015-04-23 19:43:09  INFO    OGG-01976  SCHEMATRANDATA for scheduling
columns has been added on schema scott.
 
The ADD SCHEMATRANDATA command adds supplemental logging to all tables,
both current and future, of the scott schema. Supplemental logging ensures that
all of the relevant information about update and delete operations.
 
The following command will show status of Manager, Extract Processes (ESCOTT,
PSCOTT) and Replicat Process (RSCOT).
 
GGSCI (ggnode1.oracle.com) 7> info all
 
Program      Status            Group          Lag at Chkpt     Time Since Chkpt
 
MANAGER    STOPPED
EXTRACT      STOPPED      ESCOTT       00:00:00              00:08:03
EXTRACT      STOPPED      PSCOTT       00:00:00              00:06:08
REPLICAT     STOPPED      RSCOT         00:00:00              00:00:36
 
This file shows how to connect to database, the trail fie and which tables to capture from
the source database. The new parameter USERIDALIAS, which replaces the old
method of storing USERID and PASSWORD information in the parameter file.
 
The parameter “GETBEFORECOLS” indicates columns for which the before image is
captured and written to the trail file on an update or a delete operation. To use this
parameter supplemental logging must be enabled.
 
GGSCI (ggnode1.oracle.com) 9> edit param escott
GGSCI (ggnode1.oracle.com) 10> view param escott
extract escott
useridalias oggalias
tranlogoptions dblogreader
tranlogoptions excludeuser ogguser
exttrail ./dirdat/ee
logallsupcols
table scott.BONUS;
table scott.DEPT;
table scott.EMP;
table scott.SALGRADE;
table scott.CUSTOMERS;
table scott.title, getbeforecols (on update keyincluding (price, last_change_ts, source));
 
Oracle GoldenGate 12c is the LOGALLSUPCOLS parameter. LOGALLSUPCOLS
supports Integrated Replicat and the Oracle GoldenGate Conflict Detection and
Resolution feature (CDR). This Extract to automatically include in the trail record the
before image for UPDATE and DELETE operations of all the supplementally logged
columns.
 
This file shows information about the remote machine (Target Database). Trail file
shows where to send the remote trail file and port shows where exactly the Manager
process is running.
 
GGSCI (ggnode1.oracle.com) 11> edit param pscott
GGSCI (ggnode1.oracle.com) 12> view param pscott
extract pscott
rmthost ggnode2, mgrport 15000, compress
rmttrail ./dirdat/pe
passthru
table scott.*;
 
The parameter “RESOLVECONFLICT” how replicate handles conflicts on operations
made to the tables in the MAP statement in a bi-directional replication.
 
The parameter “COMPARECOLS” columns that are included in Replicat’s where clause
with their before image values.
 
GGSCI (ggnode1.oracle.com) 13> edit param rscot
GGSCI (ggnode1.oracle.com) 14> view param rscot
 
replicat rscot
useridalias oggalias
assumetargetdefs
map scott.BONUS, target scott.BONUS, thread (2);
map scott.DEPT, target scott.DEPT, thread (3);
map scott.EMP, target scott.EMP, thread (4);
map scott.SALGRADE, target scott.SALGRADE, thread (5);
map scott.CUSTOMERS, target scott.CUSTOMERS, thread (6);
map scott.title, target scott.title, thread (7),
comparecols (on update keyincluding (price,last_change_ts,source)),
resolveconflict (updaterowexists, (max_resolution_method,usemax(last_change_ts),cols
(price,last_change_ts,source)), (default,overwrite));
map scott.title, target scott.title_exceptions, thread(8),
exceptionsonly,
insertallrecords,
colmap(usedefaults, notes='Rows in Conflict',conflict_reason='target (scott) New');
map scott.*, target scott.*;
 
The COMPARECOLS parameter specifies the columns that will be compared for
our update operation.
The RESOLVECONFLICT parameter is performing the logic for how we want to
handle the conflicts between source database and target database.
 
GGSCI (ggnode1.oracle.com) 15> start mgr
Manager started.
 
GGSCI (ggnode1.oracle.com) 16> info all
 
Program         Status           Group           Lag at Chkpt   Time Since Chkpt
MANAGER      RUNNING
EXTRACT         STOPPED      ESCOTT       00:00:00           00:24:22.
EXTRACT         STOPPED      PSCOTT       00:00:00           00:22:26
REPLICAT        STOPPED      RSCOT         00:00:00           00:16:55
 
The following command will start all Extract Processes (ESCOTT, PSCOTT) and
Replicat Process (RSCOT) in source database (orcl).
 
GGSCI (ggnode1.oracle.com) 18> start er *
Sending START request to MANAGER ...
EXTRACT ESCOTT starting
 
Sending START request to MANAGER ...
EXTRACT PSCOTT starting
 
Sending START request to MANAGER ...
REPLICAT RSCOT starting
 
GGSCI (ggnode1.oracle.com) 19> info all
 
Program           Status            Group           Lag at Chkpt    Time Since Chkpt
MANAGER        RUNNING
EXTRACT          RUNNING      ESCOTT         00:41:08          00:00:00
EXTRACT          RUNNING      PSCOTT         00:00:00          00:39:13
REPLICAT         STARTING      RSCOT          00:00:00           00:33:41
 
Note: Extract Process (RSCOT) is running in Integrated Replicat mode it requires extra
startup time. So, the status shows “STARTING”.
 
 
LOGIN INTO ORACLE GOLDENGATE 12C IN TARGET
DATABASE
 
Run ggsci command to log into the GoldenGate command line interface (GGSCI)
[oracle@ggnode2 12c]$ ./ggsci
 
The following command will logs into the database as a ‘ogguser’
GGSCI (ggnode2.oracle.com) 1> dblogin userid ogguser, password oracle
Successfully logged into database.
 
The following commands will incorporate the new Oracle GoldenGate 12c feature
known as a Credential Store. Credential Store is a User ID and password storage
mechanism that utilizes the auto login wallet within the Credential Store at target
database (orcldb)
 
GGSCI (ggnode2.oracle.com) 2> add credentialstore
Credential store created in ./dircrd/.
 
GGSCI (ggnode2.oracle.com) 3> alter credentialstore add user ogguser password
oracle alias oggalias
Credential store in ./dircrd/ altered.
 
GGSCI (ggnode2.oracle.com) 4> info credentialstore
 
Reading from ./dircrd/:
Domain: OracleGoldenGate
  Alias: oggalias
  Userid: ogguser
 
The following command registers the Extract Process (ES01) with the database. This
process is called Integrated Capture Mode. In this mode Extract process directly with
the database logmining server to receive the data changes.
 
GGSCI (ggnode2.oracle.com) 5> register extract es01 database
Extract ES01 successfully registered with database at SCN 1803609.
 
GGSCI (ggnode2.oracle.com) 6> add extract es01, integrated tranlog, begin now
EXTRACT added.
 
GGSCI (ggnode2.oracle.com) 7> add exttrail ./dirdat/ea, extract es01, megabytes 10
EXTTRAIL added.
 
GGSCI (ggnode2.oracle.com) 8> add extract ps01, exttrailsource ./dirdat/ea
EXTRACT added.
 
GGSCI (ggnode2.oracle.com) 9> add rmttrail ./dirdat/pa, extract ps01, megabytes 10
RMTTRAIL added.
 
GGSCI (ggnode2.oracle.com) 10> add replicat rs01, integrated, exttrail ./dirdat/pe,
nodbcheckpoint
REPLICAT (Integrated) added.
 
The parameter ADD SCHEMATRANDATA command adds supplemental logging to all
tables, both current and future of the SCOTT schema, and is the best method to enable
supplemental logging when both DML and DDL are concurrent.
 
GGSCI (ggnode2.oracle.com) 11> add schematrandata scott
 
2015-05-16 15:53:34  INFO    OGG-01788  SCHEMATRANDATA has been added on
schema scott.
2015-05-16 15:53:34  INFO    OGG-01976  SCHEMATRANDATA for scheduling
columns has been added on schema scott.
 
GGSCI (ggnode2.oracle.com) 12> edit param mgr
GGSCI (ggnode2.oracle.com) 13> view param mgr
 
PORT 15000
DYNAMICPORTLIST 15510-15520
PURGEOLDEXTRACTS ./dirdat/*, USECHECKPOINTS
 
GGSCI (ggnode2.oracle.com) 14> info all
 
Program      Status              Group        Lag at Chkpt      Time Since Chkpt
 
MANAGER     STOPPED
EXTRACT        STOPPED      ES01           00:00:00             00:01:00
EXTRACT        STOPPED      PS01           00:00:00             00:00:47
REPLICAT       STOPPED      RS01           00:00:00             00:00:35
 
GGSCI (ggnode2.oracle.com) 16> edit param es01
GGSCI (ggnode2.oracle.com) 17> view param es01
 
extract es01
useridalias oggalias
tranlogoptions excludetag 123
exttrail ./dirdat/ea
table scott.BONUS;
table scott.DEPT;
table scott.EMP;
table scott.SALGRADE;
table scott.CUSTOMERS;
table scott.title, getbeforecols(on update keyincluding (price,last_change_ts,source));
 
TRANLOGOPTIONS EXCLUDEUSER and EXCLUDETAG to keep transactions
from looping back and forth. The parameter EXCLUDETAG is similar to
EXCLUDEUSER but it can be used instead when the replicat for which
transactions are being filtered against is an Integrated Replicat.
 
This file shows information about the remote machine (Source Database). Trail file
shows where to send the remote trail file and port shows where exactly the Manager
process is running.
 
GGSCI (ggnode2.oracle.com) 18> edit param ps01
GGSCI (ggnode2.oracle.com) 19> view param ps01
 
extract ps01
rmthost ggnode1, mgrport 15500, compress
rmttrail ./dirdat/pa
passthru
table scott.*;
 
GGSCI (ggnode2.oracle.com) 20> info all
 
Program         Status            Group        Lag at Chkpt      Time Since Chkpt
 
MANAGER      STOPPED
EXTRACT         STOPPED      ES01           00:00:00             00:23:51
EXTRACT         STOPPED      PS01           00:00:00             00:23:38
REPLICAT        STOPPED      RS01           00:00:00             00:23:26
 
The parameter “RESOLVECONFLICT” how replicate handles conflicts on operations
made to the tables in the MAP statement in a bi-directional replication.
 
The parameter “COMPARECOLS” columns that are included in Replicat’s where clause
with their before image values.
 
The parameter (max_parallelism 6) there will be 6 apply servers for this replicat.
 
The parameter DBOPTIONS SETTAG to set a transaction tag with the hex value of
123.
 
GGSCI (ggnode2.oracle.com) 21> edit param rs01
GGSCI (ggnode2.oracle.com) 22> view param rs01
 
replicat rs01
useridalias oggalias
assumetargetdefs
dboptions integratedparams (max_parallelism 6)
dboptions settag 123
map scott.title, target scott.title,
comparecols (on update keyincluding (price,last_change_ts,source)),
resolveconflict (updaterowexists, (max_resolution_method,usemax(last_change_ts),cols
(price,last_change_ts,source)), (default,overwrite));
map scott.title, target scott.title_exceptions,
exceptionsonly,
insertallrecords,
colmap(usedefaults, notes='Rows in Conflict',conflict_reason='target (scott) New');
map scott.*, target scott.*;
 
GGSCI (ggnode2.oracle.com) 23> start mgr
Manager started.
 
GGSCI (ggnode2.oracle.com) 24> info all
 
Program          Status           Group        Lag at Chkpt      Time Since Chkpt
 
MANAGER      RUNNING
EXTRACT         STOPPED      ES01           00:00:00             00:24:27
EXTRACT         STOPPED      PS01           00:00:00             00:24:15
REPLICAT        STOPPED      RS01           00:00:00             00:24:02
 
The following command will start all Extract Processes (ES01, PS01) and Replicat
Process (RS01) in target database (orcl).
 
GGSCI (ggnode2.oracle.com) 25> start er *
 
Sending START request to MANAGER ...
EXTRACT ES01 starting
 
Sending START request to MANAGER ...
EXTRACT PS01 starting
 
Sending START request to MANAGER ...
REPLICAT RS01 starting
 
GGSCI (ggnode2.oracle.com) 26> info all
 
Program         Status              Group        Lag at Chkpt    Time Since Chkpt
 
MANAGER      RUNNING
EXTRACT         STARTING      ES01            00:00:00           00:24:33
EXTRACT         RUNNING      PS01            00:00:00           00:24:20
REPLICAT        STARTING      RS01            00:00:00           00:24:08
 
Note: Extract Process (ES01) is running in Integrated Capture mode it requires extra
startup time. So, the status shows “STARTING”.
 
GGSCI (ggnode2.oracle.com) 27> info all
Program      Status                Group        Lag at Chkpt      Time Since Chkpt
 
MANAGER       RUNNING
EXTRACT         RUNNING      ES01           00:24:48             00:00:03
EXTRACT         RUNNING      PS01           00:00:00             00:00:03
REPLICAT        RUNNING      RS01           00:00:00             00:00:01
 
TESTING THE TRANSACTIONS BETWEEN SOURCE DATABASE
AND TARGET DATABASE
 
Inserting the transactions at source database as well as target database and checking
whether record count is matched between source database and target database
 
Note: update tnsnames.ora with orcl and orcldb in source database and target database
 
ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ggnode1)
(PORT = 1521))
              (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
 
ORCLDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ggnode2)
(PORT = 1522))
                   (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME =
orcldb)))
 
SQL> connect scott/oracle@orcl
Connected.
 
SQL> insert into title values(102, 'Guide to Oracle', 'Oracle',9,32.12,12,'All about
backpacking','01-JAN-2015','15-JAN-2015','ORACLE');
1 row created.
 
SQL> commit;
Commit complete.
 
SQL> connect scott/oracle@orcldb
Connected.
 
SQL> select id,title from title where id=102;
ID  TITLE
--------------------------------------------------------------------------------
102  Guide to Oracle
 
SQL> insert into title values(103, 'Guide to MYSQL', 'MYSQL',9,32.12,12,'All about
backpacking','01-JAN-2015','15-JAN-2015','ORACLE');
 
1 row created.
 
SQL> commit;
Commit complete.
 
SQL> connect scott/oracle@orcl
Connected.
 
SQL> select id,title from title where id=103;
ID  TITLE
--------------------------------------------------------------------------------
103  Guide to MYSQL
 
 
SUMMARY
Oracle GoldenGate 12c can interact with custom conflict-resolution routines that
customers write to satisfy their business rules. Conflicts can be minimized between
source database and target database using LOW Latency and at the application level
by assuring transactions are always updated on only one system
 

You might also like