Home

Architecture Install Configure Test

 

Troubleshooting GoldenGate Bidirectional (Active-Active) Replication 2 - Configuration of Macros and Exceptions Handling Routines

  For Part 1 click here: Troubleshooting GoldenGate Bidirectional (Active-Active) Replication 1 - Conflict Resolution by Using Odd and Even Sequences

 

 

Table of Contents

 

Document Control    
Introduction
1. Overview of Default Exceptions Handling in GoldenGate
    1.1 Description of Current Setup
    1.2 Current GoldenGate Parameter Files
    1.3 Current Status of Goldengate Processes
2. Creating a Collision
    2.1 Breaking Current GoldenGate Setup - Inserting Unique Row on SOURCE and TARGET in Oracle
    2.2 Checking GoldenGate Processes State
3. Resolution - Building Macro and Exceptions
    3.1. Explanation of MACRO Parameters
    3.2 Creating EXCEPTIONS table in GoldenGate Admin Schema
    3.3 Starting Replication with New MACRO Parameters and Logging Exceptions
4. Testing the Macro and Exceptions Handling

 

 

 

Document Control

 

Change Record

                                                    

Date

Author

Version

Change Reference

 

 

 

 

 

 

November 27, 2011

Vladimir Grigorian

1.0

First Draft

 

 

Reviewers

Name

Position

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Distribution

Copy No.

Name

Location

 

 

 

 

 

1          

 

 

 

2          

 

 

 

3

 

 

 

 

This publication may not be reproduced, stored in a retrieval system, or transmitted in whole or in part, in any form, or by any means, electronic, mechanical, photocopying, recording or otherwise, without the prior written permission of Vladimir Grigorian.

 

 

 

Introduction

 

Purpose

The purpose of this document is document installation, configuration, testing and monitoring setup of Oracle GoldenGate

In this document details are provided on various parameters, their location and in some cases recommended settings. 

 

Audience

This document is intended for:

·         DBAs and Architects

 

 

 

Assumptions

Following assumptions have been verified prior to installing and configuring Oracle GoldenGate.

1.       All specified Hardware Requirements for customer’s platform have been met.

2.       All specified Operating System Requirements for source and destination have been satisfied.

3.       All Oracle recommended settings have been set on database level.

 

 

 

 

 

1.     Overview of Default Exceptions Handling in GoldenGate

Conflicts take place in a bidirectional environment when the same row in a given table is updated or inserted around the same time on both source and target sites.  

GoldenGate (unlike Oracle Streams) doesn't have a default conflict resolution routine other than using HANDLECOLLISONS. This option, however, is only recommended to be used during initial load and is beside the point in this document.

If an error is encountered, replicat usually abends (rolls back a transaction and then quits while extract and datapump continue piling up the trail files). If this happens in a large production environment trail files will quickly fill the dirdat directory and most importantly, replication stalls until errors are resolved. In some environments, GoldenGate alert log is periodically truncated which leaves no residual information to troubleshoot with.

To enable detailed exceptions logging and allow continuing replication we will configure exceptions handling with Goldengate macros and GGATE.EXCEPTIONS table.

 

1.1 Description of Current Setup

 

Lets first test default replication error handling.

In previous document we configured bidirectional replication with the following processes and parameters. GoldenGate does not replicate Oracle database sequences values in an active-active environment. We used odd and even sequences to take care of an issue. The sequences must insert values on the target database from its own sequences. Therefore, to ensure that the source and destination sequences are unique, it is recommended to generate odd and even values to each system. We have done it in previous document. This time will will use the same sequence because we want to intentionally create a collision, but have Goldengate automatically handle it for us and keep records of them in a special EXCEPTIONS table.

We have two servers:

Hostname: source target
Instance (11gR2): source target
Schema: source source

In bidirectional GoldenGate configuration changes made to either database replicate to the other database in real time. The process works like this:

esource1 (extract on source) -> psource1 (datapump on source) -> rsource1 (replicat on target)
etarget1 (extract on target) -> ptarget1 (datapump on target) -> rtarget1 (replicat on source)

 

Oracle goldengate bidirectional active-active replication

 

1.2 Current GoldenGate Parameter Files

 

Lets document current replication parameter files (please keep in mind we will have to change some of the parameters later on).

SOURCE TARGET
--./GLOBALS on source and target--
GGSCHEMA GGATE
CHECKPOINTTABLE GGATE.CHKPTAB
 
--./GLOBALS on source and target--
GGSCHEMA GGATE
CHECKPOINTTABLE GGATE.CHKPTAB
 
------------------------------------------------------------------
-- GoldenGate Manager on source and targget--
-- Last updated on 20111015 by VG --
> --------------------------------------------------------------------
PORT 7809
USERID ggate, PASSWORD oracle
AUTOSTART EXTRACT *
AUTOSTART REPLICAT *
AUTORESTART EXTRACT *, RETRIES 3, WAITMINUTES 1, RESETMINUTES 60
AUTORESTART REPLICAT *, RETRIES 3, WAITMINUTES 1, RESETMINUTES 60
PURGEOLDEXTRACTS /opt/oracle/gg/dirdat/*, USECHECKPOINTS, MINKEEPDAYS 2
--Specifies to log the lag time as a warning in the event log
LAGCRITICALMINUTES 5
--Specifies how often to report lag info to the event log
LAGREPORTMINUTES 60
LAGINFOMINUTES 0
--Manages trail files to conserve space--
PURGEOLDEXTRACTS /opt/oracle/gg/dirdat/*, USECHECKPOINTS, MINKEEPDAYS
 
------------------------------------------------------------------
-- GoldenGate Manager on source and targget--
-- Last updated on 20111015 by VG --
> --------------------------------------------------------------------
PORT 7809
USERID ggate, PASSWORD oracle
AUTOSTART EXTRACT *
AUTOSTART REPLICAT *
AUTORESTART EXTRACT *, RETRIES 3, WAITMINUTES 1, RESETMINUTES 60
AUTORESTART REPLICAT *, RETRIES 3, WAITMINUTES 1, RESETMINUTES 60
PURGEOLDEXTRACTS /opt/oracle/gg/dirdat/*, USECHECKPOINTS, MINKEEPDAYS 2
--Specifies to log the lag time as a warning in the event log
LAGCRITICALMINUTES 5
--Specifies how often to report lag info to the event log
LAGREPORTMINUTES 60
LAGINFOMINUTES 0
--Manages trail files to conserve space--
PURGEOLDEXTRACTS /opt/oracle/gg/dirdat/*, USECHECKPOINTS, MINKEEPDAYS
 
 
----------------------------------------------------------------------
-- Local extract ESOURCE1 for Source schhema on SOURCE server--
-- Updated on 2011 Nov 18 by VG --
---------------------------------------------------------------------
--extract group--
extract ESOURCE1
--export sid
setenv (ORACLE_SID=source)
--connection to database--
userid ggate, password oracle
--reporting--
ReportCount Every 30 Minutes, Rate
Report at 01:00
ReportRollover at 01:15
--discard--
DiscardFile dirrpt/DRPROD1.dis, Append
DiscardRollover at 02:00 ON SUNDAY
--Bidirectional params--
--GETAPPLOPS--
--IGNOREREPLICATES--
--Redo log options--
TRANLOGOPTIONS EXCLUDEUSER ggate COMPLETEARCHIVEDLOGTIMEOUT 600
--bound recovery--
BR BROFF
--path and name for local destination trrail--
exttrail /opt/oracle/gg/dirdat/c1
--DDL support--
ddl include mapped objname source.*
--DML support--
table source.*;
-------------------------------------------------------------------
-- Local extract etarget1 for SOURCE on TARGET db --
-- Updated on 2011 Nov 18 by VG --
---------------------------------------------------------------------
--extract group--
extract ETARGET1
--export sid
setenv (ORACLE_SID=target)
--connection to database--
userid ggate, password oracle
--reporting--
ReportCount Every 30 Minutes, Rate
Report at 01:00
ReportRollover at 01:15
--discard--
DiscardFile dirrpt/DRPROD1.dis, Append
DiscardRollover at 02:00 ON SUNDAY
--Redo log options--
TRANLOGOPTIONS EXCLUDEUSER ggate COMPLETEARCHIVEDLOGTIMEOUT 600
--bidirectional parameters--
--GETAPPLOPS--
--IGNOREREPLICATES--
--bound recovery--
BR BROFF
--path and name for local destination trrail--
exttrail /opt/oracle/gg/dirdat/t1
--DDL support--
ddl include mapped objname source.*
--DML support--
table source.*;
 
 
--------------------------------------------------------------------
-- DataPump PSOURCE1 for SOURCE schema ---
-- Updated on 2011 Nov 18 by VG --
---------------------------------------------------------------------
--dataPump group--
extract PSOURCE1
PassThru
--hostname and port for trail--
rmthost target, mgrport 7809
--path and name for remote destination ttrail--
rmttrail /opt/oracle/gg/dirdat/c2
table source.* ;
--------------------------------------------------------------------
-- DataPump PTARGET1 for SOURCE on TARGEET --
-- Updated on 2011 Nov 18 by VG --
---------------------------------------------------------------------
--dataPump group--
extract ptarget1
PassThru
--hostname and port for trail--
rmthost source, mgrport 7809
--path and name for remote destination ttrail--
rmttrail /opt/oracle/gg/dirdat/t2
Table SOURCE.* ;
-------------------------------------------------------------------
-- Replicat for SOURCE Schema on SOURCE server --
-- Last updated by VG --
--------------------------------------------------------------------
--Replicat group --
replicat RTARGET1
--export sid
setenv (ORACLE_SID=source)
--source and target definitions--
AssumeTargetDefs
--target database login --
userid ggate, password oracle
--PERFORMANCE PARMETERS--
--Double SQL transaction in 1 operation---
GROUPTRANSOPS 2000
--group similar transactions--
--BATCHSQL--
--error handling--
DDLERROR DEFAULT IGNORE RETRYOP
--file for dicarded transaction --
discardfile /opt/oracle/gg/discard/RTARGET1_discard.txt, purge, megabytes 50
--Reporting--
ReportCount Every 30 Minutes, Rate
Report at 01:00
ReportRollover at 01:15
DiscardRollover at 02:00 ON SUNDAY
--ddl support--
--HANDLECOLLISIONS--
--Supress constraints, SUPRESSTRIGGERS iis not available in this version--
DBOPTIONS DEFERREFCONST
DDL INCLUDE ALL
DDLOPTIONS REPORT
DDLERROR 942 DISCARD INCLUDE OPTYPE DROP
REPERROR (1403, DISCARD)
--Enable tracing--
--TRACE2--
--Specify table mapping ---
map source.*, target source.* ;
-------------------------------------------------------------------
-- Replicat for SOURCE Schema on TARGET---
-- Last updated on Nov 18 2011 by VG --<
--------------------------------------------------------------------
--Replicat group --
replicat RSOURCE1
--export sid
setenv (ORACLE_SID=target)
--source and target definitions--
AssumeTargetDefs
--target database login --
userid ggate, password oracle
--PERFORMANCE PARMETERS--
--Double SQL transaction in 1 operation---
GROUPTRANSOPS 2000
--group similar transactions--
BATCHSQL
--error handling--
DDLERROR DEFAULT IGNORE RETRYOP
--file for dicarded transaction --
discardfile /opt/oracle/gg/discard/PSOURCE1_discard.txt, purge, megabytes 50
--Reporting--
ReportCount Every 30 Minutes, Rate
Report at 01:00
ReportRollover at 01:15
DiscardRollover at 02:00 ON SUNDAY
--ddl support--
DDL INCLUDE ALL
DDLOPTIONS REPORT
DDLERROR 942 DISCARD INCLUDE OPTYPE DROP
REPERROR (1403, DISCARD)
HANDLECOLLISIONS
--Specify table mapping ---
map source.*, target source.* ;

 

 

 

1.3 Current Status of GoldenGate Processes

 

Lets check status of GoldenGate processes before we started break things:

 

SOURCE:

GGSCI (source) 36> info all

Program         Status     Group        Lag Time    Since Chkpt

MANAGER        RUNNING
EXTRACT        RUNNING     ESOURCE1     00:00:00     00:00:08
EXTRACT        RUNNING     PSOURCE1     00:00:00     00:00:03
REPLICAT       RUNNING     RTARGET1     00:00:00     00:00:02


GGSCI (source) 37>

 

TARGET:

 

GGSCI (target) 8> info all

Program         Status     Group         Lag Time     Since Chkpt

MANAGER        RUNNING
EXTRACT        RUNNING     ETARGET1      00:00:00     00:00:03
EXTRACT        RUNNING     PTARGET1      00:00:00     00:00:02
REPLICAT       RUNNING     RSOURCE1      00:00:00     00:00:02


GGSCI (target) 9>

 

2. Creating a Collision

 

2.1 Breaking Current GoldenGate Setup - Inserting Unique Row on SOURCE and TARGET in Oracle

 

Now lets insert identical record into source, target and then see what happens when target tries to insert this record back into source, which already has it.

 

SOURCE> insert into customers values (20000000, 'Olympia', '20-NOV-2011', '20-NOV-2011');
1 row created.

SOURCE>  commit;
Commit complete.
TARGET> insert into customers values (20000000, 'Olympia', '20-NOV-2011', '20-NOV-2011');
1 row created.

TARGET>  commit;
Commit complete.

 

Both statements complete on source on target, but replicat RTARGET1 running on SOURCE server abends, while all other processes on both servers continue running.

 

2.2 Checking GoldenGate Processes State

 

GGSCI (source) 36> info all

Program     Status      Group         Lag Time     Since Chkpt

MANAGER     RUNNING
EXTRACT     RUNNING     ESOURCE1     00:00:28     00:00:25
EXTRACT     RUNNING     PSOURCE1     00:00:28     00:00:24
REPLICAT    ABENDED     RTARGET1     00:00:05     00:00:02


GGSCI (source) 37>
As you can see replicat abended.

Lets check what GoldenGate error log tells us on SOURCE (since replicat runs on this machine)

 

2011-11-25 23:10:01 INFO OGG-00995 Oracle GoldenGate Delivery for Oracle, rtarget1.prm: REPLICAT RTARGET1 starting.
2011-11-25 23:10:01 INFO OGG-00996 Oracle GoldenGate Delivery for Oracle, rtarget1.prm: REPLICAT RTARGET1 started.
2011-11-25 23:10:01 WARNING OGG-00869 Oracle GoldenGate Delivery for Oracle, rtarget1.prm: OCI Error ORA-00001: unique constraint (SOURCE.CONS
T_CUSTOMERS_UNQ) violated (status = 1), SQL <INSERT /*+ RESTRICT_ALL_REF_CONS */ INTO "SOURCE"."CUSTOMERS" ("CUSTOMER_ID","CUSTOMER_NAME","CUSTOM
ER_REGISTRATION","CURRDATE") VALUES (:a0,:a1,:a2,:a3)>.

2011-11-25 23:10:01 WARNING OGG-01004 Oracle GoldenGate Delivery for Oracle, rtarget1.prm: Aborted grouped transaction on 'SOURCE.CUSTOMERS',
Database error 1 (OCI Error ORA-00001: unique constraint (SOURCE.CONST_CUSTOMERS_UNQ) violated (status = 1), SQL <INSERT /*+ RESTRICT_ALL_REF_CON
S */ INTO "SOURCE"."CUSTOMERS" ("CUSTOMER_ID","CUSTOMER_NAME","CUSTOMER_REGISTRATION","CURRDATE") VALUES (:a0,:a1,:a2,:a3)>).
2011-11-25 23:10:01 WARNING OGG-01003 Oracle GoldenGate Delivery for Oracle, rtarget1.prm: Repositioning to rba 1263734 in seqno 11.
2011-11-25 23:10:01 WARNING OGG-01154 Oracle GoldenGate Delivery for Oracle, rtarget1.prm: SQL error 1 mapping SOURCE.CUSTOMERS to SOURCE.CUST
OMERS OCI Error ORA-00001: unique constraint (SOURCE.CONST_CUSTOMERS_UNQ) violated (status = 1), SQL <INSERT /*+ RESTRICT_ALL_REF_CONS */ INTO "S
OURCE"."CUSTOMERS" ("CUSTOMER_ID","CUSTOMER_NAME","CUSTOMER_REGISTRATION","CURRDATE") VALUES (:a0,:a1,:a2,:a3)>.

2011-11-25 23:10:01 WARNING OGG-01003 Oracle GoldenGate Delivery for Oracle, rtarget1.prm: Repositioning to rba 1263734 in seqno 11.
2011-11-25 23:10:01 ERROR OGG-01296 Oracle GoldenGate Delivery for Oracle, rtarget1.prm: Error mapping from SOURCE.CUSTOMERS to SOURCE.CUSTO
MERS.
2011-11-25 23:10:01 ERROR OGG-01668 Oracle GoldenGate Delivery for Oracle, rtarget1.prm: PROCESS ABENDING.

 

Now lets check report for RTARGET1:

 

GGSCI (source) 38> view report rtarget1


***********************************************************************
Oracle GoldenGate Delivery for Oracle
Version 11.1.1.1 OGGCORE_11.1.1_PLATFORMS_110421.2040
Linux, x86, 32bit (optimized), Oracle 11g on Apr 30 2011 22:40:44

Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.


Starting at 2011-11-25 23:10:01
***********************************************************************

Operating System Version:
Linux
Version #1 SMP Wed May 25 17:28:36 EDT 2011, Release 2.6.32-100.34.1.el6uek.i686
Node: source
Machine: i686
soft limit hard limit
Address Space Size : unlimited unlimited
Heap Size : unlimited unlimited
File Size : unlimited unlimited
CPU Time : unlimited unlimited

Process id: 22567

Description:

***********************************************************************
** Running with the following parameters **
***********************************************************************
--------------------------------------------------------------------
-- Replicat for SOURCE Schema on SOURCE server --
-- Last updated by VG --
--------------------------------------------------------------------
--Replicat group --
replicat RTARGET1
--export sid
setenv (ORACLE_SID=source)
Set environment variable (ORACLE_SID=source)
--source and target definitions--
AssumeTargetDefs
--target database login --
userid ggate, password ******
--PERFORMANCE PARMETERS--
--Double SQL transaction in 1 operation---
GROUPTRANSOPS 2000
--group similar transactions--
--BATCHSQL--
--error handling--
DDLERROR DEFAULT IGNORE RETRYOP
--file for dicarded transaction --
discardfile /opt/oracle/gg/discard/RTARGET1_discard.txt, purge, megabytes 50
--Reporting--
ReportCount Every 30 Minutes, Rate
Report at 01:00
ReportRollover at 01:15
DiscardRollover at 02:00 ON SUNDAY
--ddl support--
--HANDLECOLLISIONS--
--Supress constraints, SUPRESSTRIGGERS iis not available in this version--
DBOPTIONS DEFERREFCONST
DDL INCLUDE ALL
DDLOPTIONS REPORT
DDLERROR 942 DISCARD INCLUDE OPTYPE DROP
REPERROR (1403, DISCARD)
--Enable tracing--
--TRACE2--
--Specify table mapping ---
map source.*, target source.* ;

CACHEMGR virtual memory values (may have been adjusted)
CACHEBUFFERSIZE: 64K
CACHESIZE: 512M
CACHEBUFFERSIZE (soft max): 4M
CACHEPAGEOUTSIZE (normal): 4M
PROCESS VM AVAIL FROM OS (min): 1G
CACHESIZEMAX (strict force to disk): 881M

Database Version:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production

Database Language and Character Set:
NLS_LANG environment variable specified has invalid format, default value will be used.
NLS_LANG environment variable not set, using default value AMERICAN_AMERICA.US7ASCII.
NLS_LANGUAGE = "AMERICAN"
NLS_TERRITORY = "AMERICA"
NLS_CHARACTERSET = "WE8MSWIN1252"

Warning: your NLS_LANG setting does not match database server language setting.
Please refer to user manual for more information.

***********************************************************************
** Run Time Messages **
***********************************************************************

Opened trail file /opt/oracle/gg/dirdat/t2000011 at 2011-11-25 23:10:01

Wildcard MAP resolved (entry SOURCE.*):
map SOURCE.CUSTOMERS, target source.CUSTOMERS ;
Using following columns in default map by name:
CUSTOMER_ID, CUSTOMER_NAME, CUSTOMER_REGISTRATION, CURRDATE

Using the following key columns for target table SOURCE.CUSTOMERS: CUSTOMER_ID.


2011-11-25 23:10:01 WARNING OGG-00869 OCI Error ORA-00001: unique constraint (SOURCE.CONST_CUSTOMERS_UNQ) violated (status = 1), SQL <INSERT /*
+ RESTRICT_ALL_REF_CONS */ INTO "SOURCE"."CUSTOMERS" ("CUSTOMER_ID","CUSTOMER_NAME","CUSTOMER_REGISTRATION","CURRDATE") VALUES (:a0,:a1,:a2,:a3)>
.

2011-11-25 23:10:01 WARNING OGG-01004 Aborted grouped transaction on 'SOURCE.CUSTOMERS', Database error 1 (OCI Error ORA-00001: unique constrai
nt (SOURCE.CONST_CUSTOMERS_UNQ) violated (status = 1), SQL <INSERT /*+ RESTRICT_ALL_REF_CONS */ INTO "SOURCE"."CUSTOMERS" ("CUSTOMER_ID","CUSTOME
R_NAME","CUSTOMER_REGISTRATION","CURRDATE") VALUES (:a0,:a1,:a2,:a3)>).

2011-11-25 23:10:01 WARNING OGG-01003 Repositioning to rba 1263734 in seqno 11.

2011-11-25 23:10:01 WARNING OGG-01154 SQL error 1 mapping SOURCE.CUSTOMERS to SOURCE.CUSTOMERS OCI Error ORA-00001: unique constraint (SOURCE.C
ONST_CUSTOMERS_UNQ) violated (status = 1), SQL <INSERT /*+ RESTRICT_ALL_REF_CONS */ INTO "SOURCE"."CUSTOMERS" ("CUSTOMER_ID","CUSTOMER_NAME","CUS
TOMER_REGISTRATION","CURRDATE") VALUES (:a0,:a1,:a2,:a3)>.

2011-11-25 23:10:01 WARNING OGG-01003 Repositioning to rba 1263734 in seqno 11.

Source Context :
SourceModule : [er.main]
SourceID : [/scratch/sganti/view_storage/sganti_core_lin32/oggcore/OpenSys/src/app/er/rep.c]
SourceFunction : [take_rep_err_action]
SourceLine : [16064]
ThreadBacktrace : [8] elements
: [/opt/oracle/gg/replicat(CMessageContext::AddThreadContext()+0x26) [0x820fa26]]
: [/opt/oracle/gg/replicat(CMessageFactory::CreateMessage(CSourceContext*, unsigned int, ...)+0x817) [0x82061a7]]
: [/opt/oracle/gg/replicat(_MSG_ERR_MAP_TO_TANDEM_FAILED(CSourceContext*, DBString<777> const&, DBString<777> const&, C
MessageFactory::MessageDisposition)+0x88) [0x81e8d38]]
: [/opt/oracle/gg/replicat() [0x8414e35]]
: [/opt/oracle/gg/replicat() [0x84f0b7e]]
: [/opt/oracle/gg/replicat(main+0x6f6) [0x8136106]]
: [/lib/libc.so.6(__libc_start_main+0xe6) [0x49e67cc6]]
: [/opt/oracle/gg/replicat(__gxx_personality_v0+0x1b5) [0x8112991]]

2011-11-25 23:10:01 ERROR OGG-01296 Error mapping from SOURCE.CUSTOMERS to SOURCE.CUSTOMERS.

***********************************************************************
* ** Run Time Statistics ** *
***********************************************************************

Last record for the last committed transaction is the following:
___________________________________________________________________
Trail name : /opt/oracle/gg/dirdat/t2000011
Hdr-Ind : E (x45) Partition : . (x04)
UndoFlag : . (x00) BeforeAfter: A (x41)
RecLength : 82 (x0052) IO Time : 2011-11-25 23:03:44.768001
IOType : 5 (x05) OrigNode : 255 (xff)
TransInd : . (x03) FormatType : R (x52)
SyskeyLen : 0 (x00) Incomplete : . (x00)
AuditRBA : 35 AuditPos : 27283472
Continued : N (x00) RecCount : 1 (x01)

2011-11-25 23:03:44.768001 Insert Len 82 RBA 1263734
Name: SOURCE.CUSTOMERS
___________________________________________________________________

Reading /opt/oracle/gg/dirdat/t2000011, current RBA 1263734, 0 records

Report at 2011-11-25 23:10:01 (activity since 2011-11-25 23:10:01)

From Table SOURCE.CUSTOMERS to SOURCE.CUSTOMERS:
# inserts: 0
# updates: 0
# deletes: 0
# discards: 1


DDL replication statistics:

Operations: 0
Mapped operations: 0
Unmapped operations: 0
Other operations: 0
Excluded operations: 0
Errors: 0
Retried errors: 0
Discarded errors: 0
Ignored errors: 0




Last log location read:
FILE: /opt/oracle/gg/dirdat/t2000011
SEQNO: 11
RBA: 1263734
TIMESTAMP: 2011-11-25 23:03:44.768001
EOF: NO
READERR: 0


2011-11-25 23:10:01 ERROR OGG-01668 PROCESS ABENDING.

CACHE OBJECT MANAGER statistics

CACHE MANAGER VM USAGE
vm current = 0 vm anon queues = 0
vm anon in use = 0 vm file = 0
vm used max = 0 ==> CACHE BALANCED

CACHE CONFIGURATION
cache size = 512M cache force paging = 881M
buffer min = 64K buffer highwater = 4M
pageout eligible size = 4M

================================================================================
RUNTIME STATS FOR SUPERPOOL

CACHE Transaction Stats
trans active = 0 max concurrent = 0
non-zero total = 0 trans total = 0

CACHE File Caching
disk current = 0 disk total = 0
disk caching = 0 file cached = 0
file retrieves = 0

CACHE MANAGEMENT
buffer links = 0 anon gets = 0
forced unmaps = 0 cnnbl try = 0
cached out = 0 force out = 0

Allocation Request Distribution
< 128B: 0
128B: 0 0 | 512B: 0 0
2K: 0 0 | 8K: 0 0
32K: 0 0 | 128K: 0 0
512K: 0 0 | 2M: 0 0
8M: 0 0 | 32M: 0 0
128M: 0 0 | 512M: 0 0
2G: 0 0 | 8G: 0

Cached Transaction Size Distribution
0: 0
< 4K: 0
4K: 0 0 | 16K: 0 0
64K: 0 0 | 256K: 0 0
1M: 0 0 | 4M: 0 0
16M: 0 0 | 64M: 0 0
256M: 0 0 | 1G: 0 0
4G: 0 0 | 16G: 0 0
64G: 0 0 | 256G: 0 0
1T: 0 0 | 4T: 0 0
16T: 0 0 | 64T: 0 0
256T: 0 0 |1024T: 0 0

================================================================================
CUMULATIVE STATS FOR SUPERPOOL

CACHE Transaction Stats
trans active = 0 max concurrent = 0
non-zero total = 0 trans total = 0

CACHE File Caching
disk current = 0 disk total = 0
disk caching = 0 file cached = 0
file retrieves = 0

CACHE MANAGEMENT
buffer links = 0 anon gets = 0
forced unmaps = 0 cnnbl try = 0
cached out = 0 force out = 0

Allocation Request Distribution
< 128B: 0
128B: 0 0 | 512B: 0 0
2K: 0 0 | 8K: 0 0
32K: 0 0 | 128K: 0 0
512K: 0 0 | 2M: 0 0
8M: 0 0 | 32M: 0 0
128M: 0 0 | 512M: 0 0
2G: 0 0 | 8G: 0

Cached Transaction Size Distribution
0: 0
< 4K: 0
4K: 0 0 | 16K: 0 0
64K: 0 0 | 256K: 0 0
1M: 0 0 | 4M: 0 0
16M: 0 0 | 64M: 0 0
256M: 0 0 | 1G: 0 0
4G: 0 0 | 16G: 0 0
64G: 0 0 | 256G: 0 0
1T: 0 0 | 4T: 0 0
16T: 0 0 | 64T: 0 0
256T: 0 0 |1024T: 0 0


QUEUE Statistics:
num queues = 15 default index = 0
cur len = 0 max len = 0
q vm current = 0 vm max = 0
q hits = 0 q misses = 0

queue size q hits curlen maxlen cannibalized
0 64K 0 0 0 0
1 128K 0 0 0 0
2 256K 0 0 0 0
3 512K 0 0 0 0
4 1M 0 0 0 0
5 2M 0 0 0 0
6 4M 0 0 0 0
7 8M 0 0 0 0
8 16M 0 0 0 0
9 32M 0 0 0 0
10 64M 0 0 0 0
11 128M 0 0 0 0
12 256M 0 0 0 0
13 512M 0 0 0 0
14 1G 0 0 0 0

================================================================================
RUNTIME STATS FOR CACHE POOL #0
POOL INFO group: rtarget1 id: p22567_BLOB
trans active = 0 trans concurrent (max) = 0
trans total = 0 (0 )
flag = 0x00000030
last error = (0=<none>)

Allocation Request Distribution
< 128B: 0
128B: 0 0 | 512B: 0 0
2K: 0 0 | 8K: 0 0
32K: 0 0 | 128K: 0 0
512K: 0 0 | 2M: 0 0
8M: 0 0 | 32M: 0 0
128M: 0 0 | 512M: 0 0
2G: 0 0 | 8G: 0

================================================================================
CUMULATIVE STATS FOR CACHE POOL #0
POOL INFO group: rtarget1 id: p22567_BLOB
trans active = 0 trans concurrent (max) = 0
trans total = 0 (0 )
flag = 0x00000030
last error = (0=<none>)

Allocation Request Distribution
< 128B: 0
128B: 0 0 | 512B: 0 0
2K: 0 0 | 8K: 0 0
32K: 0 0 | 128K: 0 0
512K: 0 0 | 2M: 0 0
8M: 0 0 | 32M: 0 0
128M: 0 0 | 512M: 0 0
2G: 0 0 | 8G: 0


QUEUE Statistics:
num queues = 15 default index = 0
cur len = 0 max len = 0
q vm current = 0 vm max = 0
q hits = 0 q misses = 0

queue size q hits curlen maxlen cannibalized
0 64K 0 0 0 0
1 128K 0 0 0 0
2 256K 0 0 0 0
3 512K 0 0 0 0
4 1M 0 0 0 0
5 2M 0 0 0 0
6 4M 0 0 0 0
7 8M 0 0 0 0
8 16M 0 0 0 0
9 32M 0 0 0 0
10 64M 0 0 0 0
11 128M 0 0 0 0
12 256M 0 0 0 0
13 512M 0 0 0 0
14 1G 0 0 0 0

================================================================================
RUNTIME STATS FOR CACHE POOL #0
POOL INFO group: rtarget1 id: p22567_BLOB
trans active = 0 trans concurrent (max) = 0
trans total = 0 (0 )
flag = 0x00000030
last error = (0=<none>)

Allocation Request Distribution
< 128B: 0
128B: 0 0 | 512B: 0 0
2K: 0 0 | 8K: 0 0
32K: 0 0 | 128K: 0 0
512K: 0 0 | 2M: 0 0
8M: 0 0 | 32M: 0 0
128M: 0 0 | 512M: 0 0
2G: 0 0 | 8G: 0

================================================================================
CUMULATIVE STATS FOR CACHE POOL #0
POOL INFO group: rtarget1 id: p22567_BLOB
trans active = 0 trans concurrent (max) = 0
trans total = 0 (0 )
flag = 0x00000030
last error = (0=<none>)

Allocation Request Distribution
< 128B: 0
128B: 0 0 | 512B: 0 0
2K: 0 0 | 8K: 0 0
32K: 0 0 | 128K: 0 0
512K: 0 0 | 2M: 0 0
8M: 0 0 | 32M: 0 0
128M: 0 0 | 512M: 0 0
2G: 0 0 | 8G: 0



GGSCI (source) 39>

As you can see this bidirectional replicat abended because of "ORA-00001: unique constraint (SOURCE.CONST_CUSTOMERS_UNQ) violated." after we successfully inserted the same row on source and then target, which then tried to replicate the same row back to source. This error (along with

the ORA-01403 error) is the most common GoldenGate bidirectional error.

Report and GoldenGate error log provided some useful information, but how do we ensure that:

1) Replicat does not abend but continues processing transactions if this sort of error is encountered?

2) GoldenGate stores indefinitely and provides more details on the error  - before/after image, a more detailed error message, timestamp to the milliseconds precision, as opposed to just seconds.

 

 

 

3. Resolution - Building Macro and Exceptions

 

 

3.1. Explanation of MACRO Parameters

In an effort to configure exceptions handling with GoldenGate parameters and  macros and logging this information in a custom table we will have to perform the following steps:

Alter extract and replicat parameters.

These are new parameter files (new parameter mark in red):

 

SOURCE TARGET
--./GLOBALS on source and target--
GGSCHEMA GGATE
CHECKPOINTTABLE GGATE.CHKPTAB
 
--./GLOBALS on source and target--
GGSCHEMA GGATE
CHECKPOINTTABLE GGATE.CHKPTAB
 
------------------------------------------------------------------
-- GoldenGate Manager on source and target--
-- Last updated on 20111015 by VG --
-------------------------------------------------------------------
PORT 7809
USERID ggate, PASSWORD oracle
AUTOSTART EXTRACT *
AUTOSTART REPLICAT *
AUTORESTART EXTRACT *, RETRIES 3, WAITMINUTES 1, RESETMINUTES 60
AUTORESTART REPLICAT *, RETRIES 3, WAITMINUTES 1, RESETMINUTES 60
PURGEOLDEXTRACTS /opt/oracle/gg/dirdat/*, USECHECKPOINTS, MINKEEPDAYS 2
--Specifies to log the lag time as a warning in the event log
LAGCRITICALMINUTES 5
--Specifies how often to report lag info to the event log
LAGREPORTMINUTES 60
LAGINFOMINUTES 0
--Manages trail files to conserve space--
PURGEOLDEXTRACTS /opt/oracle/gg/dirdat/*, USECHECKPOINTS, MINKEEPDAYS 2
 
------------------------------------------------------------------
-- GoldenGate Manager on source and target--
-- Last updated on 20111015 by VG --
-------------------------------------------------------------------
PORT 7809
USERID ggate, PASSWORD oracle
AUTOSTART EXTRACT *
AUTOSTART REPLICAT *
AUTORESTART EXTRACT *, RETRIES 3, WAITMINUTES 1, RESETMINUTES 60
AUTORESTART REPLICAT *, RETRIES 3, WAITMINUTES 1, RESETMINUTES 60
PURGEOLDEXTRACTS /opt/oracle/gg/dirdat/*, USECHECKPOINTS, MINKEEPDAYS 2
--Specifies to log the lag time as a warning in the event log
LAGCRITICALMINUTES 5
--Specifies how often to report lag info to the event log
LAGREPORTMINUTES 60
LAGINFOMINUTES 0
--Manages trail files to conserve space--
PURGEOLDEXTRACTS /opt/oracle/gg/dirdat/*, USECHECKPOINTS, MINKEEPDAYS 2
 
--------------------------------------------------------------------
-- Local extract ESOURCE1 for Source schema --
-- Updated on 2011 Nov 18 by VG --
--------------------------------------------------------------------
--extract group--
extract ESOURCE1
--export sid
setenv (ORACLE_SID=source)
--connection to database--
userid ggate, password oracle
--reporting--
ReportCount Every 30 Minutes, Rate
Report at 01:00
ReportRollover at 01:15
--discard--
DiscardFile dirrpt/DRPROD1.dis, Append
DiscardRollover at 02:00 ON SUNDAY
--Bidirectional params--
GETAPPLOPS
IGNOREREPLICATES
--Get data before images--
GETUPDATEBEFORES
--Redo log options--
TRANLOGOPTIONS COMPLETEARCHIVEDLOGTIMEOUT 600
--bound recovery--
BR BROFF
--path and name for local destination trail--
exttrail /opt/oracle/gg/dirdat/c1
--DDL support--
ddl include mapped objname source.*
--DML support--
table source.*;
 
--------------------------------------------------------------------
-- Local extract etarget1 for SOURCE on TARGET db --
-- Updated on 2011 Nov 18 by VG --
--------------------------------------------------------------------
--extract group--
extract ETARGET1
--export sid
setenv (ORACLE_SID=target)
--connection to database--
userid ggate, password oracle
--reporting--
ReportCount Every 30 Minutes, Rate
Report at 01:00
ReportRollover at 01:15
--discard--
DiscardFile /opt/oracle/gg/dirrpt/ETARGET1_discard.dis, Append
DiscardRollover at 02:00 ON SUNDAY
--Redo log options--
TRANLOGOPTIONS EXCLUDEUSER ggate COMPLETEARCHIVEDLOGTIMEOUT 600
--bidirectional parameters--
GETAPPLOPS
IGNOREREPLICATES
--Get data before images--
GETUPDATEBEFORES
--bound recovery--
BR BROFF
--path and name for local destination trail--
exttrail /opt/oracle/gg/dirdat/t1
--DDL support--
ddl include mapped objname source.*
--DML support--
table source.*;

 

 

 

--------------------------------------------------------------------
-- DataPump PSOURCE1 for SOURCE schema ---
-- Updated on 2011 Nov 18 by VG --
---------------------------------------------------------------------
--dataPump group--
extract PSOURCE1
PassThru
--hostname and port for trail--
rmthost target, mgrport 7809
--path and name for remote destination ttrail--
rmttrail /opt/oracle/gg/dirdat/c2
table source.* ;
--------------------------------------------------------------------
-- DataPump PTARGET1 for SOURCE on TARGEET --
-- Updated on 2011 Nov 18 by VG --
---------------------------------------------------------------------
--dataPump group--
extract ptarget1
PassThru
--hostname and port for trail--
rmthost source, mgrport 7809
--path and name for remote destination ttrail--
rmttrail /opt/oracle/gg/dirdat/t2
table SOURCE.* ;
-- Replicat for SOURCE Schema on SOURCE server --
-- Last updated by VG --
-------------------------------------------------------------------
-- CHECKPARAMS
-- This starts the macro
--
MACRO #exception_handler
BEGIN
, TARGET ggate.exceptions
, COLMAP ( rep_name = "RTARGET1"
, table_name = @GETENV ("GGHEADER", "TABLENAME")
, errno = @GETENV ("LASTERR", "DBERRNUM")
, dberrmsg = @GETENV ("LASTERR", "DBERRMSG")
, optype = @GETENV ("LASTERR", "OPTYPE")
, errtype = @GETENV ("LASTERR", "ERRTYPE")
, logrba = @GETENV ("GGHEADER", "LOGRBA")
, logposition = @GETENV ("GGHEADER", "LOGPOSITION")
, committimestamp = @GETENV ("GGHEADER", "COMMITTIMESTAMP")
, beforeafter = @GETENV ("GGHEADER", "BEFOREAFTERINDICATOR"))
, INSERTALLRECORDS
, EXCEPTIONSONLY;
END;
-- END OF THE MACRO
--
--Replicat group --
replicat RTARGET1
--export sid
setenv (ORACLE_SID=source)
--source and target definitions--
AssumeTargetDefs
--target database login --
userid ggate, password oracle
--PERFORMANCE PARMETERS--
--Double SQL transaction in 1 operation--
GROUPTRANSOPS 2000
--group similar transactions--
--BATCHSQL--
--error handling--
DDLERROR DEFAULT IGNORE RETRYOP
--file for dicarded transaction --
discardfile /opt/oracle/gg/discard/RTARGET1_discard.txt, purge, megabytes 500
--Reporting--
ReportCount Every 30 Minutes, Rate
Report at 01:00
ReportRollover at 01:15
DiscardRollover at 02:00 ON SUNDAY
--ddl support--
--HANDLECOLLISIONS--
--Supress constraints, SUPRESSTRIGGERS is not available in this version--
DBOPTIONS DEFERREFCONST
DDL INCLUDE ALL
DDLOPTIONS REPORT
DDLERROR 942 DISCARD INCLUDE OPTYPE DROP
REPERROR (1403, DISCARD)
REPERROR (DEFAULT, EXCEPTION)
--REPERROR (DEFAULT2, ABEND)
REPERROR (DEFAULT2, EXCEPTION)
REPERROR (-1, EXCEPTION)
--Enable tracing--
--TRACE2--
--Specify table mapping ---
map source.*, target source.* ;
map source.* #exception_handler();
 
-------------------------------------------------------------------
-- Replicat for SOURCE Schema on TARGET---
-- Last updated on Nov 18 2011 by VG --<
--------------------------------------------------------------------
--Replicat group --
replicat RSOURCE1
--export sid
setenv (ORACLE_SID=target)
--source and target definitions--
AssumeTargetDefs
--target database login --
userid ggate, password oracle
--PERFORMANCE PARMETERS--
--Double SQL transaction in 1 operation---
GROUPTRANSOPS 2000
--group similar transactions--
BATCHSQL
--error handling--
DDLERROR DEFAULT IGNORE RETRYOP
--file for dicarded transaction --
discardfile /opt/oracle/gg/discard/PSOURCE1_discard.txt, purge, megabytes 50
--Reporting--
ReportCount Every 30 Minutes, Rate
Report at 01:00
ReportRollover at 01:15
DiscardRollover at 02:00 ON SUNDAY
--ddl support--
DDL INCLUDE ALL
DDLOPTIONS REPORT
DDLERROR 942 DISCARD INCLUDE OPTYPE DROP
REPERROR (1403, DISCARD)
HANDLECOLLISIONS
--Specify table mapping ---
map source.*, target source.* ;

 

Lets consider what this new parameters are for.

GETUPDATEBEFORES | IGNOREUPDATEBEFORES
Valid for Extract and Replicat
Use the GETUPDATEBEFORES and IGNOREUPDATEBEFORES parameters to control whether or not the before images of updated columns are included in the records that are processed by Oracle GoldenGate. Before images contain column details that existed before a record was updated. Use the GETUPDATEBEFORES parameter in the Extract parameter file to extract before images or in the Replicat parameter file to replicate before images. You can compare before images with after images to identify the net results of a transaction or perform other delta calculations. For example, if a BALANCE field is $100 before an update and $120 afterward, a comparison would show the difference of $20. You can use the column-conversion functions of Oracle GoldenGate to perform the comparisons and calculations.
You also can use GETUPDATEBEFORES to maintain a transaction-history table. For more information about performing delta calculations and using transaction history, see the Oracle GoldenGate Windows and UNIX Administrator’s Guide.
The GETUPDATEBEFORES and IGNOREUPDATEBEFORES parameters are table-specific. One parameter remains in effect for all subsequent TABLE or MAP statements, until the other parameter is encountered.

 

The macro and REPERROR above tell GoldenGate what information should be logged in EXCEPTIONS table and how to handle it establishing a new default . For exmple:

REPERROR (DEFAULT, EXCEPTION)
REPERROR (DEFAULT2, ABEND)
 

will abend replicat, while

 
REPERROR (DEFAULT, EXCEPTION)
--REPERROR (DEFAULT2, ABEND)
REPERROR (DEFAULT2, EXCEPTION)
 

will make it continue running after logging a transaction.

 

Now lets put these new parameters to work by stopping extract and replicat, adding the parameters and starting them up but only after we had created exceptions table below:

 

3.2 Creating EXCEPTIONS table in GoldenGate Admin Schema

 

SOURCE>  connect ggate/oracle
 
SOURCE>  CREATE TABLE GGATE.EXCEPTIONS
(
REP_NAME VARCHAR2(8 BYTE),
TABLE_NAME VARCHAR2(61 BYTE),
ERRNO NUMBER,
DBERRMSG VARCHAR2(4000 BYTE),
OPTYPE VARCHAR2(20 BYTE),
ERRTYPE VARCHAR2(20 BYTE),
LOGRBA NUMBER,
LOGPOSITION NUMBER,
COMMITTIMESTAMP TIMESTAMP(6),
BEFOREAFTER CHAR(1 BYTE)
)
TABLESPACE GGATE
RESULT_CACHE (MODE DEFAULT)
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
NEXT 1M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
FLASH_CACHE DEFAULT
CELL_FLASH_CACHE DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;
 
Table created
 
 
CREATE UNIQUE INDEX GGATE.PK_CTS ON GGATE.EXCEPTIONS
(LOGRBA, LOGPOSITION, COMMITTIMESTAMP)
LOGGING
TABLESPACE GGATE
PCTFREE 0
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
NEXT 1M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
FLASH_CACHE DEFAULT
CELL_FLASH_CACHE DEFAULT
)
NOPARALLEL;

 

Table created

SOURCE>  ALTER TABLE GGATE.EXCEPTIONS ADD (
CONSTRAINT PK_CTS
PRIMARY KEY
(LOGRBA, LOGPOSITION, COMMITTIMESTAMP)
USING INDEX GGATE.PK_CTS
ENABLE VALIDATE);
 
Constraint Added

 

 

3.3 Starting Replication with New MACRO Parameters and Logging Exceptions

 

Now lets start extract and replicat with the option "ALTER <> BEGIN NOW" with new macro and exceptions handling and make sure replicat is running.

 

GGSCI (source) 4> info all

Program     Status      Group         Lag Time     Since Chkpt

MANAGER     RUNNING
EXTRACT     RUNNING     ESOURCE1     00:00:00     00:00:03
EXTRACT     RUNNING     PSOURCE1     00:00:00     00:00:09
REPLICAT    RUNNING     RTARGET1     00:06:55     00:42:53


GGSCI (source) 5>

 

 

4. Testing the Macro and Exceptions Handling

 

 

Lets run another statement (also identical, but different from the previous one because it will fail, the row already exists):

 

SOURCE> insert into customers values (20000009, 'Olympia', '20-NOV-2011', '20-NOV-2011');
1 row created.

SOURCE>  commit;
Commit complete.
TARGET> insert into customers values (20000009, 'Olympia', '20-NOV-2011', '20-NOV-2011');
1 row created.

TARGET>  commit;
Commit complete.

 

Lets check if GGATE table has captured the error:

 

SOURCE> SELECT * FROM GGATE.EXCEPTIONS;

 

ROW#
REP_NAME
TABLE_NAME
ERRNO
DBERRMSG
OPTYPE
ERRTYPE
LOGRBA
LOGPOSITION
COMMITTIMESTAMP
BEFOREAFTER
1
RTARGET1
SOURCE.CUSTOMERS
1
OCI Error ORA-00001: unique constraint (SOURCE.CONST_CUSTOMERS_UNQ) violated (status = 1), SQL <INSERT /*+ RESTRICT_ALL_REF_CONS */ INTO "SOURCE"."CUSTOMERS" ("
CUSTOMER_ID","CUSTOMER_NAME","CUSTOMER_REGISTRATION","CURRDATE") VALUES (:a0,:a1
,:a2,:a3)>
INSERT
DB
34
25134096
25-NOV-11 12.08.27.180964 PM
 A

 

 1 row selected

The contents of the table can tell a DBA enough information about the error.

Also, unlike before replicat continues running despite the error.

At this point we have configured a replicat macro with exceptions handling.

 

 

 Back to Top


 

Copyright © 2012 Vladimir Grigorian. All Rights Reserved