Quantcast
Channel: ATeam Chronicles
Viewing all 33 articles
Browse latest View live

Oracle GoldenGate: Understanding OGG-01161 Bad Column Index Error

$
0
0

Introduction

The “OGG-01161 Bad Column Index” error is possibly one of the most reviled and misunderstood Oracle GoldenGate (OGG) error messages ever created. In this article, we shall attempt to demystify this error message.

Main Article

Bad column index errors tend to occur in OGG heterogeneous; i.e., unlike database, environments and most frequently where change control procedures do not require an OGG sign-off for database maintenance tasks. To demonstrate, I have an environment where I replicate a table from Oracle Database 11.2.0.4 to Microsoft SQL Server 2008. The source and target tables are defined as follows:

Oracle SQL Server
create table ogg01161 (
pkey_id number(11) NOT NULL,
first_name varchar2(50),
surname    varchar2(50),
date_added timestamp,
last_modified timestamp,
PRIMARY KEY (pkey_id) using index
);
create table ogg01161 (
pkey_id decimal(11,0) not null,
first_name varchar(50),
surname varchar(50),
date_added datetime,
last_modified datetime,
primary key (pkey_id)
);

 

With these table definitions, data replication runs fine but then all of a sudden Replicat fails with an error:

2014-05-19 13:32:37  ERROR   OGG-01161  Bad column index (5) specified for table EAST.OGG01161, 
max columns = 5.

Viewing the Replicat discard file, I do not see anything that tells me there is a data issue:

Oracle GoldenGate Delivery for SQL Server process started, group R_ORA12 discard file opened: 
2014-05-19 13:20:19.816000
Process Abending : 2014-05-19 13:32:37

Ok, so lets look at the error message again. It says “max columns = 5″, which I interpret to mean there are 5 columns defined for this table. My table definition lists 5 columns for this table, so why am I getting this error?

Lets look at the error message again. The first part of the message says “Bad column index (5)”. The key word here is “index“.

Replicat creates a pre-compiled SQL statement for each table defined as a MAP statement in the parameter file. This statement is created once for each table as it processes data from the OGG Trail by executing a meta data query. When the meta data query is executed, you will see a statement in the Replicat parameter file similar to this:

  map "EAST"."OGG01161", target dbo.OGG01161;
Using following columns in default map by name:
  pkey_id, first_name, surname, date_added, last_modified

This column map statement is maintained in Replicat’s memory space as an array. For non-computer programmers, an array is a variable that holds multiple values of the same type, and is referenced by an index. The first element of an array is always at index number 0.

So in the memory space associated with this Replicat, there will be an array that contains the following data:

Array Index Data Value
0 pkey_id
1 first_name
2 surname
3 date_added
4 last_modified

 

According to this analysis, the max column index is 4, so why is Replicat telling me it is 5?

Let’s look at the data coming from the source via the Logdump utility.

When the Replicat failed, it reported its read location at RBA (relative byte address) 4584 in the trail ./dirdat/pe000001. The report file shows:

Reading ./dirdat/pe000001, current RBA 4584

So in Logdump, I open the trail for read, set “detail on” so I can see all of the columnar data, and position to the relative byte address just before the record that caused the failure. Then I can use the scanforheader command to view the failure record.

Logdump 12 >open ./dirdat/pe000001
Current LogTrail is C:\OGG12\dirdat\pe000001
Logdump 13 >ghdr on
Logdump 14 >detail data
Logdump 15 >pos 4580
Reading forward from RBA 4580
Logdump 16 >sfh
___________________________________________________________________
Hdr-Ind    :     E  (x45)     Partition  :     .  (x04)
UndoFlag   :     .  (x00)     BeforeAfter:     A  (x41)
RecLength  :   119  (x0077)   IO Time    : 2014/05/19 13:32:28.513.201
IOType     :     5  (x05)     OrigNode   :   255  (xff)
TransInd   :     .  (x03)     FormatType :     R  (x52)
SyskeyLen  :     0  (x00)     Incomplete :     .  (x00)
AuditRBA   :        110       AuditPos   : 150935568
Continued  :     N  (x00)     RecCount   :     1  (x01)

2014/05/19 13:32:28.513.201 Insert               Len   119 RBA 4584
Name: EAST.OGG01161
After  Image:                                             Partition 4   G  s
 0000 000a 0000 0000 0000 0000 0003 0001 000b 0000 | ....................
 0007 4368 6172 6c65 7300 0200 0900 0000 054a 6f6e | ..Charles........Jon
 6573 0003 001f 0000 3230 3134 2d30 352d 3139 3a31 | es......2014-05-19:1
 333a 3332 3a32 372e 3430 3532 3136 3030 3000 0400 | 3:32:27.405216000...
 1fff ff31 3930 302d 3031 2d30 313a 3030 3a30 303a | ...1900-01-01:00:00:
 3030 2e30 3030 3030 3030 3030 0005 0003 0000 4b   | 00.000000000......K
Column     0 (x0000), Len    10 (x000a)
 0000 0000 0000 0000 0003                          | ..........
Column     1 (x0001), Len    11 (x000b)
 0000 0007 4368 6172 6c65 73                       | ....Charles
Column     2 (x0002), Len     9 (x0009)
 0000 0005 4a6f 6e65 73                            | ....Jones
Column     3 (x0003), Len    31 (x001f)
 0000 3230 3134 2d30 352d 3139 3a31 333a 3332 3a32 | ..2014-05-19:13:32:2
 372e 3430 3532 3136 3030 30                       | 7.405216000
Column     4 (x0004), Len    31 (x001f)
 ffff 3139 3030 2d30 312d 3031 3a30 303a 3030 3a30 | ..1900-01-01:00:00:0
 302e 3030 3030 3030 3030 30                       | 0.000000000
Column     5 (x0005), Len     3 (x0003)
 0000 4b                                           | ..K

Logdump shows me the record, which is a source table insert operation and contains data for six table columns. So it appears my source table was altered, which can be verified via sqlplus.

SQL> describe ogg01161;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 PKEY_ID                                   NOT NULL NUMBER(11)
 FIRST_NAME                                         VARCHAR2(50)
 SURNAME                                            VARCHAR2(50)
 DATE_ADDED                                         TIMESTAMP(6)
 LAST_MODIFIED                                      TIMESTAMP(6)
 MIDDLE_INITIAL                                     CHAR(1)

Reviewing the definition for my tables, I see a column “MIDDLE_INITIAL” was added to the source that does not exist in the target. Now that we know the source of our Replicat failure, we can fix the problem.

The first thing we need to do is to generate a new set of defines for the source. Execute the OGG DEFGEN utility and copy the output to the target location. You may need to update the Replicat parameter file if the defines file name is different that what is specified by the Replicat SOURCEDEFS parameter setting.

Next, we need to determine if this new column data needs to be replicated to the target. If not, we can restart Replicat and the column will be ignored. Otherwise, alter the target table and add the new column with a data type that corresponds with the source and restart Replicat.

Summary

OGG Bad Data Index errors can be very confusing for novice users. In this article we presented details about the error and provided an example for troubleshooting and correcting the error condition.


Oracle GoldenGate: Automated Recovery From TCP/IP Network Errors

$
0
0

Introduction

There is a little known Oracle GoldenGate (OGG) file, tcperrs, that comes with every release. This file contains settings that specify TCP error handling for OGG processes. In this article we shall present the default settings, present an example of usage, and demonstrate how to perform automated recovery from network related issues.

Main Article

 Here is the tcperrs file that comes standard with every release of OGG:

[lpenton@TPA OGG_East]$ cat tcperrs
# 
# TCP/IP error handling parameters
#
# Default error response is abend
#
# Error           Response    Delay (csecs)    Max Retries
ECONNABORTED      RETRY        1000               10
#ECONNREFUSED     ABORT           0                0
ECONNREFUSED      RETRY        1000               12
ECONNRESET        RETRY         500               10
ENETDOWN          RETRY        3000               50
ENETRESET         RETRY        1000               10
ENOBUFS           RETRY         100               60
ENOTCONN          RETRY         100               10
EPIPE             RETRY         500               10
ESHUTDOWN         RETRY        1000               10
ETIMEDOUT         RETRY        1000               10
NODYNPORTS        RETRY         100               10

TCP/IP errors are unique to each operating system. The tcperrs file lists errors that are common across all operating systems supported by OGG.

In the tcperrs file, the Error column lists the TCP/IP error name, Response details what action to take when the specific error is encountered (ABORT or RETRY), Max Retries denotes how many times the process should attempt to recover from the error, and Delay specifies how long the process should wait between recovery attempts. The delay specification is in centiseconds, which is 1/100th of a second.

Lines beginning with the # character are comments and are ignored when the file is read by OGG processes.

For a better understanding of what all of this means, lets look at one example:

# Error           Response    Delay (csecs)      Max Retries
ECONNREFUSED      RETRY        1000               12

ECONNREFUSED is a fairly common error for new OGG installations. This error means the connection has been refused, and is typically encountered by the OGG Extract Data Pump when it attempts to communicate with a remote OGG Manager. As shown above, the default error handling settings for Extract Data Pump is to attempt twelve times to establish a connection to the target with a ten second delay between attempts. If the connection cannot be established within the 120 second timeframe, the Extract Data Pump will enter the ABEND state and human intervention will be required.

To demonstrate, lets change the ECONNREFUSED settings and attempt to connect an Extract Data Pump to a target OGG instance where no ports are available to receive incoming requests. The tcperrs file setting is to try to establish the connection two times, with a five second delay between attempts.

# Error           Response    Delay (csecs)      Max Retries
ECONNREFUSED      RETRY        500                2

In GGSCI, start the Extract Data Pump.

GGSCI (TPA) 8> start p_abqa

Sending START request to MANAGER ...
EXTRACT P_ABQA starting

The process report file will contain the following showing the connection attempts:

2014-05-22 08:50:56  WARNING OGG-01223  TCP/IP error 111 (Connection refused), endpoint: abq:15051.
2014-05-22 08:51:31  ERROR   OGG-01224  TCP/IP error 111 (Connection refused), 
      endpoint: abq:15051; retries exceeded.
2014-05-22 08:51:31  ERROR   OGG-01668  PROCESS ABENDING.

The system error log will also show the connection attempts:

May 22 08:50:56 localhost Oracle GoldenGate Capture for Oracle[3870]: 2014-05-22 08:50:56  
      WARNING OGG-01223  Oracle GoldenGate Capture for Oracle, p_abqa.prm:  
      TCP/IP error 111 (Connection refused), endpoint: abq:15051.
May 22 08:51:31 localhost Oracle GoldenGate Capture for Oracle[3870]: 2014-05-22 08:51:31  
      ERROR   OGG-01224  Oracle GoldenGate Capture for Oracle, p_abqa.prm:  
      TCP/IP error 111 (Connection refused), endpoint: abq:15051; retries exceeded.
May 22 08:51:31 localhost Oracle GoldenGate Capture for Oracle[3870]: 2014-05-22 08:51:31  
      ERROR   OGG-01668  Oracle GoldenGate Capture for Oracle, p_abqa.prm:  PROCESS ABENDING.

From this example, we can see that the tcperrs file may be modified to allow OGG processes to perform automatic recovery from any TCP/IP communication error.

It is important to remember that the tcperrs file is overwritten during the Oracle GoldenGate upgrade process. If you modify the file, make a backup!

Now that we know how to handle TCP/IP errors, lets consider how we can use this along with the OGG Manager AUTORESTART feature to perform automatic recovery from unanticipated network outages.

The OGG Manager has a parameter option AUTORESTART. This options is used to start one, or more Extract and Replicat processes after they fail. The default setting is to not auto restart and the parameter syntax is:

AUTORESTART <process type> <group name>
[, RETRIES <max number of retries>]
[, WAITMINUTES <number of minutes>]
[, RESETMINUTES <number of minutes>]

To demonstrate this use, I have set my Manager process as follows:

autorestart extract p_abqa, retries 5, waitminutes 1, resetminutes 5

This setting will perform a restart of the P_ABQA Extract Data Pump should it go into the ABEND state. The OGG Manager will attempt to start the process five times, delaying one minute between start attempts. After the fifth start attempt, if the process enters the ABEND state, it will be left in that state. After five minutes, the restart counter will be reset to zero and Manager will attempt to start the process again.

Since my tcperrs file is set to perform automated recovery of network issues, my Extract Data Pump will not enter the ABEND state until all recovery attempts are exhausted.

With these setting, the OGG Manager report file will show the following:

2014-05-22 09:31:44  INFO    OGG-00963  Command received from GGSCI on host 127.0.0.1:37138 
     (START EXTRACT P_ABQA ).
2014-05-22 09:31:44  INFO    OGG-00975  EXTRACT P_ABQA starting.
2014-05-22 09:34:45  INFO    OGG-01971  The previous message, 'INFO OGG-00975', repeated 1 times.
2014-05-22 09:34:45  INFO    OGG-00965  EXTRACT P_ABQA restarted automatically.
2014-05-22 09:37:45  INFO    OGG-00975  EXTRACT P_ABQA starting.
2014-05-22 09:37:45  INFO    OGG-00965  EXTRACT P_ABQA restarted automatically.
2014-05-22 09:40:45  INFO    OGG-00975  EXTRACT P_ABQA starting.
2014-05-22 09:40:45  INFO    OGG-00965  EXTRACT P_ABQA restarted automatically.
2014-05-22 09:43:36  INFO    OGG-00975  EXTRACT P_ABQA starting.
2014-05-22 09:43:36  INFO    OGG-00965  EXTRACT P_ABQA restarted automatically.
2014-05-22 09:46:36  INFO    OGG-00975  EXTRACT P_ABQA starting.
2014-05-22 09:46:36  INFO    OGG-00965  EXTRACT P_ABQA restarted automatically.
2014-05-22 09:52:36  INFO    OGG-00975  EXTRACT P_ABQA starting.
2014-05-22 09:52:36  INFO    OGG-00965  EXTRACT P_ABQA restarted automatically.
2014-05-22 09:55:36  INFO    OGG-00975  EXTRACT P_ABQA starting.
2014-05-22 09:55:36  INFO    OGG-00965  EXTRACT P_ABQA restarted automatically.
2014-05-22 09:58:37  INFO    OGG-00975  EXTRACT P_ABQA starting.
2014-05-22 09:58:37  INFO    OGG-00965  EXTRACT P_ABQA restarted automatically.
2014-05-22 10:01:37  INFO    OGG-00975  EXTRACT P_ABQA starting.
2014-05-22 10:01:37  INFO    OGG-00965  EXTRACT P_ABQA restarted automatically.
2014-05-22 10:04:37  INFO    OGG-00975  EXTRACT P_ABQA starting.
2014-05-22 10:04:37  INFO    OGG-00965  EXTRACT P_ABQA restarted automatically.

The system error log will show the following:

May 22 09:31:44 localhost Oracle GoldenGate Command Interpreter for Oracle[3565]: 
     2014-05-22 09:31:44  INFO    OGG-00987  Oracle GoldenGate Command Interpreter for Oracle:  
     GGSCI command (lpenton): start p_abqa.
May 22 09:31:44 localhost Oracle GoldenGate Manager for Oracle[4349]: 2014-05-22 09:31:44  
     INFO    OGG-00963  Oracle GoldenGate Manager for Oracle, mgr.prm:  
     Command received from GGSCI on host 127.0.0.1:37138 (START EXTRACT P_ABQA ).
May 22 09:31:44 localhost Oracle GoldenGate Manager for Oracle[4349]: 2014-05-22 09:31:44  
     INFO    OGG-00975  Oracle GoldenGate Manager for Oracle, mgr.prm:  EXTRACT P_ABQA starting.
May 22 09:31:45 localhost Oracle GoldenGate Capture for Oracle[4356]: 2014-05-22 09:31:45  
     INFO    OGG-00992  Oracle GoldenGate Capture for Oracle, p_abqa.prm:  EXTRACT P_ABQA starting.
May 22 09:31:45 localhost Oracle GoldenGate Capture for Oracle[4356]: 2014-05-22 09:31:45  
     INFO    OGG-03059  Oracle GoldenGate Capture for Oracle, p_abqa.prm:  
     Operating system character set identified as UTF-8.
May 22 09:31:45 localhost Oracle GoldenGate Capture for Oracle[4356]: 2014-05-22 09:31:45  
     INFO    OGG-02695  Oracle GoldenGate Capture for Oracle, p_abqa.prm:  
     ANSI SQL parameter syntax is used for parameter parsing.
May 22 09:31:45 localhost Oracle GoldenGate Capture for Oracle[4356]: 2014-05-22 09:31:45  
     INFO    OGG-01851  Oracle GoldenGate Capture for Oracle, p_abqa.prm:  
     filecaching started: thread ID: 140368060078400.
May 22 09:31:45 localhost Oracle GoldenGate Capture for Oracle[4356]: 2014-05-22 09:31:45  
     INFO    OGG-01815  Oracle GoldenGate Capture for Oracle, p_abqa.prm:  
     Virtual Memory Facilities for: COM     anon alloc: mmap(MAP_ANON)  anon free: munmap     
     file alloc: mmap(MAP_SHARED)  file free: munmap     
     target directories:     /home/lpenton/OGG/OGG_East/dirtmp.
May 22 09:31:45 localhost Oracle GoldenGate Capture for Oracle[4356]: 2014-05-22 09:31:45  
     INFO    OGG-00993  Oracle GoldenGate Capture for Oracle, p_abqa.prm:  EXTRACT P_ABQA started.
May 22 09:32:15 localhost Oracle GoldenGate Capture for Oracle[4356]: 2014-05-22 09:32:15  
     WARNING OGG-01223  Oracle GoldenGate Capture for Oracle, p_abqa.prm:  
     TCP/IP error 111 (Connection refused), endpoint: abq:15051.
May 22 09:32:50 localhost Oracle GoldenGate Capture for Oracle[4356]: 2014-05-22 09:32:50  
     ERROR   OGG-01224  Oracle GoldenGate Capture for Oracle, p_abqa.prm:  
     TCP/IP error 111 (Connection refused), endpoint: abq:15051; retries exceeded.
May 22 09:32:50 localhost Oracle GoldenGate Capture for Oracle[4356]: 2014-05-22 09:32:50  
     ERROR   OGG-01668  Oracle GoldenGate Capture for Oracle, p_abqa.prm:  PROCESS ABENDING.
May 22 09:34:45 localhost Oracle GoldenGate Manager for Oracle[4349]: 2014-05-22 09:34:45  
     INFO    OGG-01971  Oracle GoldenGate Manager for Oracle, mgr.prm:  
     The previous message, 'INFO OGG-00975', repeated 1 times.
May 22 09:34:45 localhost Oracle GoldenGate Manager for Oracle[4349]: 2014-05-22 09:34:45  
     INFO    OGG-00965  Oracle GoldenGate Manager for Oracle, mgr.prm:  
     EXTRACT P_ABQA restarted automatically.
May 22 09:34:45 localhost Oracle GoldenGate Capture for Oracle[4393]: 2014-05-22 09:34:45  
     INFO    OGG-00992  Oracle GoldenGate Capture for Oracle, p_abqa.prm:  EXTRACT P_ABQA starting.
May 22 09:34:45 localhost Oracle GoldenGate Capture for Oracle[4393]: 2014-05-22 09:34:45  
     INFO    OGG-03059  Oracle GoldenGate Capture for Oracle, p_abqa.prm:  
     Operating system character set identified as UTF-8.
May 22 09:34:45 localhost Oracle GoldenGate Capture for Oracle[4393]: 2014-05-22 09:34:45  
     INFO    OGG-02695  Oracle GoldenGate Capture for Oracle, p_abqa.prm:  
     ANSI SQL parameter syntax is used for parameter parsing.
May 22 09:34:45 localhost Oracle GoldenGate Capture for Oracle[4393]: 2014-05-22 09:34:45  
     INFO    OGG-01851  Oracle GoldenGate Capture for Oracle, p_abqa.prm:  
     filecaching started: thread ID: 139742852102464.
May 22 09:34:45 localhost Oracle GoldenGate Capture for Oracle[4393]: 2014-05-22 09:34:45  
     INFO    OGG-01815  Oracle GoldenGate Capture for Oracle, p_abqa.prm: 
     Virtual Memory Facilities for: COM     anon alloc: mmap(MAP_ANON)  anon free: munmap     
     file alloc: mmap(MAP_SHARED)  file free: munmap     
     target directories:     /home/lpenton/OGG/OGG_East/dirtmp.
May 22 09:34:45 localhost Oracle GoldenGate Capture for Oracle[4393]: 2014-05-22 09:34:45  
     INFO    OGG-00993  Oracle GoldenGate Capture for Oracle, p_abqa.prm:  EXTRACT P_ABQA started.
May 22 09:35:15 localhost Oracle GoldenGate Capture for Oracle[4393]: 2014-05-22 09:35:15  
     WARNING OGG-01223  Oracle GoldenGate Capture for Oracle, p_abqa.prm:  
     TCP/IP error 111 (Connection refused), endpoint: abq:15051.
May 22 09:35:50 localhost Oracle GoldenGate Capture for Oracle[4393]: 2014-05-22 09:35:50  
     ERROR   OGG-01224  Oracle GoldenGate Capture for Oracle, p_abqa.prm:  
     TCP/IP error 111 (Connection refused), endpoint: abq:15051; retries exceeded.
May 22 09:35:50 localhost Oracle GoldenGate Capture for Oracle[4393]: 2014-05-22 09:35:50  
     ERROR   OGG-01668  Oracle GoldenGate Capture for Oracle, p_abqa.prm:  PROCESS ABENDING.

By using a combination of tcperrs file and Manager AUTORESTART settings, OGG Extract Data Pumps can recover from any network issue without human intervention.

Summary

In this article we presented the Oracle GoldenGate tcperrs file, demonstrated its use, and showed how Oracle GoldenGate may be customized by end users to provide automated recovery from TCP/IP communications errors.

An ODI Journalizing Knowledge Module for GoldenGate Integrated Replicat

$
0
0

One of the new features in GoldenGate 12c is the Integrated Replicat apply mode.

All out-of-the-box versions of the ODI JKM for GoldenGate to this date were designed for the Classic Replicat apply mode and they rely on the Checkpoint table maintained by GoldenGate. This table is used to figure out which changed records can reliably be processed by ODI. However, if you choose to use the Integrated Replicat apply mode of GoldenGate, there is no Checkpoint table anymore.

This post proposes a solution to modify the out-of-the-box JKM for GoldenGate to support Integrated Replicat apply mode.

Out-of-the-box JKMs for Oracle GoldenGate

In a nutshell, ODI maintains window_ids to keep track of the primary keys (PKs) of new, updated to deleted the records, and uses the GoldenGate Checkpoint table to seed these window-ids: this seeding is called the Extend Window operation. If you want more details on the inner workings of the out-of the box JKMs and how they leverage the GoldenGate checkpoint table with Classic Replicat, the post Understanding the ODI JKMs and how they work with Oracle GoldenGate will provide all the necessary background.

Understanding Oracle SCN and GoldenGate CSN

The Oracle database provides a very good description of what a SCN is: documentation: “A system change number (SCN) is a logical, internal time stamp used by Oracle Database. SCNs order events that occur within the database, which is necessary to satisfy the ACID properties of a transaction. Oracle Database uses SCNs to mark the SCN before which all changes are known to be on disk so that recovery avoids applying unnecessary redo. (…) Every transaction has an SCN.” You can find the complete description here: System Change Numbers (SCNs).

The Oracle GoldenGate documentation describes a CSN in the section About the Commit Sequence Number as follows: “A CSN is a monotonically increasing identifier generated by Oracle GoldenGate that uniquely identifies a point in time when a transaction commits to the database.“

On an Oracle database, GoldenGate will use the database SCN for its CSN.

Description of Integrated Replicat

With the Integrated Replicat mode, GoldenGate constructs logical change records (LCR) that represent source database DML transactions instead of constructing SQL statements. This approach greatly improves performance and reliability of the write process, and as such it does not require a Checkpoint Table.

The Integrated Replicat stores details of its processing in a system table: SYS.DBA_GG_INBOUND_PROGRESS.

This table stores the source SCN (System Change Number) of the last record processed by each Replicat (or GoldenGate CSN for non-Oracle sources). All records up to the APPLIED_LOW_POSITION SCN are guaranteed to be committed. Records between APPLIED_LOW_POSITION and APPLIED_HIGH_POSITION are being processed (i.e. they could be committed or not).

Figure 1 shows the complete structure of the table:

Table SYS.DBA_GG_INBOUND_PROGRESS(

SERVER_NAME                                          VARCHAR2(128)
PROCESSED_LOW_POSITION                  VARCHAR2(4000)
APPLIED_LOW_POSITION                         VARCHAR2(4000)
APPLIED_HIGH_POSITION                         VARCHAR2(4000)
SPILL_POSITION                                        VARCHAR2(4000)
OLDEST_POSITION                                   VARCHAR2(4000)
APPLIED_LOW_SCN                                  NUMBER
APPLIED_TIME                                           DATE
APPLIED_MESSAGE_CREATE_TIME         DATE
SOURCE_DATABASE                                 VARCHAR2(128)
SOURCE_ROOT_NAME                            VARCHAR2(128))

Figure 1: Structure of the SYS.DBA_GG_INBOUND_PROGRESS view.

If you want more details on Integrated Replicat for Oracle GoldenGate, the Oracle documentation provides an excellent description of the technology and its benefits here: Choosing Capture and Apply Modes.

The challenge for ODI is that there is no way to relate the source SDN with anything that can be stored in the J$ table, hence the need for a new approach.

Description of the new approach

Instead of having GoldenGate provide a WINDOW_ID when PKs are written to the J$ table, we remove the WINDOW_ID column altogether and we replace it with the Oracle database ORA_ROWSCN Pseudocolumn. The SCN is assigned by the database when the transaction completes: this provides us with a reliable value that we can use as a WINDOW_ID at no additional cost.

To have row level detail in that pseudo column, we have to create the J$ table with the option ROWDEPENDENCIES (for more details on this option, see this post from Tom Kyte: Using the Oracle ORA_ROWSCN). From then on, all we need is to retrieve the current SCN from the database when we do the ‘Extend Window’ operation: all records committed at this point in the J$ table are available for CDC processing. We can retrieve this value with the command:

select CURRENT_SCN from v$database

Note that the ODI user needs the ‘Select’ privilege on the ‘v$database’ view to be able to run this query.

Steps to modify in the JKM

A modified version of the out-of-the-box JKM is available here: JKM Oracle to Oracle Consistent (OGG Online) Integrated Replicat. In this implementation, all KM tasks that were modified from the original JKM have their name prefixed with a * sign.

Table 1 below shows the alterations to the original JKM for the modified tasks (all changes are done in the Target Command of the tasks):

Task Description of the Change Code
Create J$ Table Remove WINDOW_ID;Add the ROWDEPENDENCIES option to the table  create table <%=odiRef.getJrnInfo(“JRN_FULL_NAME”)%>(<%=odiRef.getColList(“”, “[COL_NAME]\t[DEST_WRI_DT] null”, “,\n\t”, “”, “PK”)%>) ROWDEPENDENCIES
Create JV$ view Replace the use of the JRN.WINDOW_ID column in the J$ table with the pseudo column JRN.ORA_ROWSCN. This is in the where clause of the sub-select  and        JRN.ORA_ROWSCN        >= SUB.MIN_WINDOW_IDand       JRN.ORA_ROWSCN        < SUB.MAX_WINDOW_ID_DEL
Create data view Replace the use of the JRN.WINDOW_ID column in the J$ table with the pseudo column JRN.ORA_ROWSCN. This is in the where clause of the sub-select JRN.ORA_ROWSCN >= SUB.MIN_WINDOW_ID
(note that the ORA_ROWSCN cannot be null)
Create apply oby (2) Add the ‘INTEGRATED’ keyword and remove the code for the checkpoint table:OdiOutFile (…) add replicat <%= odiRef.getOggProcessInfo(odiRef.getOggModelInfo(“REPLICAT_LSCHEMA”), “NAME”) %>#ODI_APPLY_NUMBER, INTEGRATED, exttrail <%= odiRef.getOggProcessInfo(odiRef.getOggModelInfo(“REPLICAT_LSCHEMA”), “LTRAIL_FILE_PATH”) %>stop replicat (…)start replicat (…)
Create apply prm (3) In the GoldenGate PRM file for the replicat, remove the WINDOW_ID column from the KEYCOLS and COLMAP command:  OdiOutFile (…)-APPEND COLMAP (…) map (…), KEYCOLS (<%= odiRef.getColList(“”, “[COL_NAME]“, “, “, “”, “PK”) %>), INSERTALLRECORDS, OVERRIDEDUPS,
COLMAP (<%= odiRef.getColList(“”, “[COL_NAME] = [COL_NAME],\n”, “”, “”, “PK”) %>);
Extend Window Retrieve the database current SCN instead of retrieving the ID of the last processed record from the checkpoint table: all records with a lower SCN are guaranteed to be committed:  update <%=odiRef.getJrnInfo( “CDC_SET_TABLE” )%>set          (CUR_WINDOW_ID, CUR_WINDOW_ID_DEL, CUR_WINDOW_ID_INS )=(select CURRENT_SCN, CURRENT_SCN, CURRENT_SCN from v$database)where   CDC_SET_NAME = ‘<%=odiRef.getObjectName(“L” ,odiRef.getJrnInfo( “JRN_COD_MOD” ) , “D”)%>’
Cleanup journalized table Since we have replaced the WINDOW_ID column in the J$ table with the pseudo column ORA_ROWSCN we have to update the query accordingly  delete from        <%=odiRef.getJrnInfo(“JRN_FULL_NAME”)%> <%=odiRef.getInfo(“DEST_TAB_ALIAS_WORD”)%> JRNwhere   JRN.ORA_ROWSCN <     (select  (…)         )
Adding checkpoint table online Keep the login, but remove the creation of the checkpoint table.Rename the step to ‘Online Connect to the Database’. Remove: add checkpointtable <%= odiRef.getInfo(“SRC_DEFW_SCHEMA”) %>.<%=odiRef.getOption(“CHECKPOINT_TABLE_NAME”)%>
Execute apply commands online Remove the reference to the checkpoint table  

Table 1: Code changes to the original JKM

You can also delete the KM option called CHECKPOINT_TABLE_NAME option since it is not used by the JKM anymore.

Beyond Integrated Replicat

This approach can be expanded beyond the use-case described here: SCNs can be used in the J$ tables independently of the capture mechanism and, in the case of GoldenGate, can be used whether Integrated Replicat is used or not to deliver the data.

When similar mechanisms are available for non-Oracle databases, they can be used as well. For instance Microsoft SQL server allows the creation of a column of type rowversion that can be used for the same purpose.

Conclusion

With relatively simple modifications to the original JKM, ODI can now support the Oracle GoldenGate Integrated Replicat apply mode. This will allow you to take advantage of all the benefits provided by this new mode and allows further integration with ODI.

References

The following references were used to aggregate the necessary information for this post:

For more ODI best practices, tips, tricks, and guidance that the A-Team members gain from real-world experiences working with customers and partners, visit Oracle A-Team Chronicles for ODI. For Oracle GoldenGate, visit “Oracle A-Team Chronicles for GoldenGate

Acknowledgements

Special thanks to Tim Garrod for pointing out the possible use of SCNs, Valarie Bedard, Nick Wagner and Mony Subramony for reviewing and validating the successive approaches and attempts, and Pat McElroy for sharing her expertise on Integrated Replicat.

 

OGG Extract entry in DBA_APPLY view

$
0
0

Introduction

DBAs are often reviewing what items exist in their DBA views.  I was recently asked by a DBA if they could drop the Apply Process  in the DBA_APPLY view since they had no OGG Apply processes running on this particular system.  They only had OGG Capture processes on this particular server.  The short answer to that question is ‘No’, unless you can absolutely verify that the entry you wish to remove has nothing to do with an OGG Extract process.

Main Article

If you query the DBA_CAPTURE and the DBA_APPLY views, you will see that for every entry in the DBA_CAPTURE view there is a corresponding entry in the DBA_APPLY view.   Below is an example:

SQL> select apply_name from dba_apply ;

APPLY_NAME
——————————————————————————–
OGG$EXT_CP

SQL> select capture_name from dba_capture ;

CAPTURE_NAME
——————————————————————————–
OGG$CAP_EXT_CP

If you dig a little deeper in the the DBA_APPLY view, you will see a column named ‘PURPOSE’.  This is the column you should look at to see what exactly that process is being used for.  In our case we can see it is for our capture process.

 

SQL> select apply_name, purpose from dba_apply;

APPLY_NAME      PURPOSE
————— ——————-
OGG$EXT_CP      GoldenGate Capture

 

Summary

It is a good practice to try to keep your environments as clean as possible.  But in this case, dropping the process in the DBA_APPLY view would have had serious consequences for the capture process.  While the apply process is not actually started, the configuration info (for example , queue subscriber info for the apply queue) is all necessary for Integrated Extract.  If the DBA would have dropped this apply process, they would have been forced to rebuild the replication environment.

Oracle GoldenGate: How to configure On-Premise to GoldenGate Cloud Service (GGCS) via DMZ Server

$
0
0
Introduction A DMZ (demilitarized zone) server is a public-facing computer host placed on a separate or isolated network segment. The intention of this DMZ server is to provide an additional layer of network security between servers in the trusted network and servers in the public network. In this article we shall discuss how to configure […]

Masking Sensitive Data with Oracle GoldenGate

$
0
0
Introduction At any given time, organizations are gathering, storing, and transferring millions of records about their customers across multiple enterprise environments. There are various operational settings within Oracle GoldenGate (OGG) that should be set to ensure Personally Identifiable Information (PII), or Sensitive Personal Information (SPI) is not compromised. This article will discuss OGG configuration settings […]

Oracle GoldenGate: Tables Without Keys

$
0
0
Introduction For data replication products like Oracle GoldenGate (OGG), it is typically a best practice to have a primary key or unique index defined for tables being replicated. However, in practice this may not be possible when working with poorly designed databases or legacy applications. In this article we shall detail OGG’s rules for determining […]

Oracle GoldenGate Big Data Adapter: Apache Kafka Producer

$
0
0
Introduction Apache Kafka is a distributed, partitioned, replicated commit log service that provides the functionality of a Java Messaging System. The Oracle GoldenGate for Big Data Kafka Handler acts as a Kafka Producer that writes serialized change capture data from an Oracle GoldenGate Trail to a Kafka Topic. In this article we will setup the Oracle GoldenGate Big Data […]

Oracle GoldenGate Big Data Adapter: Establishing Secure Connections to Apache Kafka

$
0
0
Introduction When publishing data to Apache Kafka via the Oracle GoldenGate Big Data Kafka Handler, it is a good practice to establish secure connections in order to protect sensitive data from un-authorized snooping. The Oracle Big Data Kafka Handler leverages encryption and authentication features built-in to Apache Kafka. In this article we shall detail the Oracle […]

Oracle GoldenGate: Apply to Apache Flume File Roll Sink

$
0
0
Introduction This is part 1 of a two part article demonstrating how to replicate data in near-real time from an on-premises database to Oracle Storage Cloud Service. In this article we shall demonstrate Oracle GoldenGate functionality to capture transactional data in near real-time from an on-premises Oracle Database and apply the records as delimited text data to an […]

Oracle GoldenGate: Working With Tokens and Environment Variables

$
0
0
Introduction Oracle GoldenGate contains advanced functionality that exposes a wealth of information users may leverage. In this article we shall discuss three of these, TOKENS; which is user defined data written to Oracle GoldenGate Trails, the Column Conversion Function @TOKEN; which is used to retrieve the token data from the Oracle GoldenGate Trail, and the […]

Oracle GoldenGate: Replicating “Soft” Deletes To Data Warehouses

$
0
0
Introduction We receive a lot of questions on how to setup Oracle GoldenGate to perform “soft” deletes in Data Warehouses. By default, Oracle GoldenGate replicates data operations exactly as they occur in the source database; however, in Data Warehouses their is typically a requirement to retain the original data record and set a flag that […]

GoldenGate Cloud Service (GGCS): Replication from On-Premises to Oracle Public Cloud (OPC)

$
0
0
Introduction This document will walk you through how to configure Oracle GoldenGate (OGG) replication between On-Premises Oracle Database to an Oracle Database Cloud Service (DBCS) on Oracle Public Cloud (OPC) via GoldenGate Cloud Service (GGCS). Installation of Oracle GoldenGate for Oracle Database on the On-Premises and the provisioning of Oracle GGCS and DBCS are not […]

GoldenGate Cloud Service (GGCS): Replication from Amazon RDS Oracle Database to Oracle DBCS

$
0
0
Introduction This document will walk you through how to configure Oracle GoldenGate (OGG) replication from Amazon Relational Database Service (RDS) Oracle Database to an Oracle Database Cloud Service (DBCS) on Oracle Public Cloud (OPC) via Amazon Web Services (AWS) Elastic Compute Cloud (EC2) and Oracle GoldenGate Cloud Service (GGCS). The following topics are not included […]

Oracle GoldenGate: SQL Server to SQL Server Instantiation

$
0
0
Introduction The target database instantiation, or initial load, process is key to a successful Oracle GoldenGate implementation. In this article we shall present best practices when instantiating a target Microsoft SQL Server database from a source SQL Server database when implementing Oracle GoldenGate. Main Article When planning a target database instantiation, there are several questions […]

Oracle GoldenGate: Microsoft SQL Server to Oracle Migrations (Part 1)

$
0
0
Introduction Cross-database replication and migrations pose a challenge to IT organizations due to the complexity involved in converting data types and with target database instantiation. In this series of articles we shall explore three options for migrating a Microsoft SQL Server Database to an Oracle Database. In Part 1, we’ll use the Microsoft Import and Export Data […]

Oracle GoldenGate: Microsoft SQL Server to Oracle Migration (Part 3)

$
0
0
Introduction In Part 1 of this article, we performed a zero-downtime migration of a live Microsoft SQL Server Database to an Oracle Pluggable Database using the Microsoft SQL Server Import and Export Wizard and Oracle GoldenGate. In Part 2, we performed the same zero-downtime migration using Oracle SQL Developer and Oracle GoldenGate. In this part, […]

Oracle GoldenGate: Microsoft SQL Server to Oracle Migration (Part 2)

$
0
0
Introduction In Part 1 of this article, we performed a zero-downtime migration of a live Microsoft SQL Server Database to an Oracle Pluggable Database using the Microsoft SQL Server Import and Export Wizard and Oracle GoldenGate. In this part, we will do the same zero-downtime migration using Oracle SQL Developer to create the target schema and […]

Oracle GoldenGate: Teradata Instantiation

$
0
0
Introduction When working with Teradata customers, we are always asked for recommendations of how to instantiate the target Teradata database. There are numerous ways to accomplish this; including various third-party applications that most customers have in-house. In this article, we will demonstrate a zero down-time data replication implementation from an Oracle 12c Pluggable Database to […]

Oracle GoldenGate: Working With Dates

$
0
0
Introduction By default Oracle GoldenGate handles data for date data types without any user intervention. However, there are times when you may need to manipulate this data based upon end use requirements. Oracle GoldenGate has numerous built-in functions that allows users to test and manipulate data. In this article we shall present the column-conversion functions used to […]
Viewing all 33 articles
Browse latest View live