Begin at the Beginning: Don’t use Begin Now with GoldenGate Replicat

Begin at the Beginning: Don’t use Begin Now with GoldenGate Replicat

Begin at the Beginning: Don’t use Begin Now with GoldenGate Replicat

In the past few weeks, I have seen a few cases where an Oracle GoldenGate replicat has been created incorrectly which has caused a few problems and required some rework.  So, I wanted to point this out in order to hopefully save some of you from making the same mistake.

The BEGIN NOW parameter for the add replicat function creates a replicat and positions the trail file at the current time, that is, the time when the replicat was created.  This is fine if that is your intent, but often the replicat is created in that manner without fully understanding the ramifications of the begin now function.

The recent cases where I have seen this involves following the replicat creation with a start replicat specifying a specific CSN.  The add replicat begin now is a positional function.  The start replicat atcsn or start replicat aftercsn are search functions.  If the begin now positions the trail file to a sequence number that has past the CSN/SCN (the CSN in GoldenGate is equivalent to an Oracle SCN) then you will never find it.

Here is an example where I have tested this.  I have chosen a transaction with SCN 135530906.  This SCN is in trail file /u02/ggtrails/soe/ra000000004 at RBA 16810102

Case 1:  Create the replicat without specifying BEGIN NOW

GGSCI (gg20b as ggadmin@gg20bdb) 8> ADD REPLICAT rsoe2, EXTTRAIL /u02/ggtrails/soe/ra, CHECKPOINTTABLE ggadmin.ggchkpt_rsoe2

 

REPLICAT added.

GGSCI (gg20b as ggadmin@gg20bdb) 21> info replicat rsoe2

 

REPLICAT   RSOE2     Initialized   2016-09-01 09:08   Status STOPPED

Checkpoint Lag       00:00:00 (updated 00:00:12 ago)

Log Read Checkpoint  File /u02/ggtrails/soe/ra000000000

2016-09-01 09:08:53.000000

Notice that the position of the trail file is SeqNo 0, RBA 0.  That is the beginning of the first trail file.

Case 2:  Create the trail file specifying BEGIN NOW.

GGSCI (gg20b as ggadmin@gg20bdb) 20> ADD REPLICAT rsoe2, EXTTRAIL /u02/ggtrails/soe/ra, BEGIN NOW, CHECKPOINTTABLE ggadmin.ggchkpt_rsoe2

 

REPLICAT added.

GGSCI (gg20b as ggadmin@gg20bdb) 21> info replicat rsoe2

 

REPLICAT   RSOE2     Initialized   2016-09-02 08:30   Status STOPPED

Checkpoint Lag       00:00:00 (updated 00:00:03 ago)

Log Read Checkpoint  File /u02/ggtrails/soe/ra000000000

2016-09-02 08:30:05.000000

Notice that the trail file is not specifying a time.  What does that mean?  Let’s take a look.

I will now allow the replicat to run a single transaction, however, I will start at CSN 135530906.  Remember, this is in trail file ending in 4.  After running a single transaction, starting the replicat with ATCSN 135530906 I get the following results.

GGSCI (gg20b as ggadmin@gg20bdb) 15> info rsoe2

 

REPLICAT   RSOE2     Last Started 2016-09-02 08:32   Status RUNNING

Checkpoint Lag       00:00:00 (updated 00:00:02 ago)

Process ID           28019

Log Read Checkpoint  File /u02/ggtrails/soe/ra000000007

2016-09-02 08:32:30.978180  RBA 25879627

The following is from the replicat report file:

2016-09-02 08:50:18  INFO    OGG-01014  Positioning with begin time: Sep 2, 2016 8:49:51 AM, starting record time: Sep 2, 2016 8:49:31 AM at extseqno 7, extrba 25894957.

 

***********************************************************************

**                     Run Time Messages                             **

***********************************************************************

 

 

2016-09-02 08:50:18  INFO    OGG-02243  Opened trail file /u02/ggtrails/soe/ra000000007 at 2016-09-02 08:50:18.475178.

 

2016-09-02 08:50:18  INFO    OGG-03506  The source database character set, as determined from the trail file, is we8mswin1252.

 

2016-09-02 08:50:36  INFO    OGG-01372  User requested start at CSN 135530906.

 

Because of the fact that the replicat started positioned well past the desired CSN, it never found it and did zero transactions.  Trail file ra000000007 is the last trail file.

So, what if I did AFTERCSN?

I did the same test with AFTERCSN and got the same result.  By positioning with BEGIN NOW you cannot specify a starting point with ATCSN or AFTERCSN unless that SCN/CSN number has occurred after you add the replicat.  Even with AFTERCSN the replicat must find the CSN in order to start processing transactions.

So, the lesson to be found here is that BEGIN NOW should only be used if you actually intend to start processing at the exact time that you add the replicat.  In general, if you are using a ATCSN or AFTERCSN qualifier to start replicat, then start at the beginning; seq 0, rba 0.

By the way.  I always use BEGIN NOW when adding an extract.

I hope this saves someone some time.  Enjoy GoldenGate.

 

About the Author:

Me.jpg

Edward Whalen

CTO- Oracle Ace Director

Edward Whalen is an Oracle ACE Director and Chief Technology Officer at Performance Tuning Corporation (PTC), a consulting company specializing in database performance, administration, virtualization, and disaster recovery solutions with over 30 years of experience. He has extensive experience in system architectural design for optimal performance. His career has consisted of hardware, OS, database, and virtualization projects for many different companies. He has written eight books on Oracle products (14 books total), the last five from Oracle Press. He has also worked on numerous benchmarks and performance tuning projects with Oracle database products. Edward is responsible for developing the PTC offerings to include the fore mentioned Health Check, designed to be a low-cost, high-impact offering and an excellent first phase to achieve greater awareness and increased DB efficiencies.

By |2017-09-20T08:03:24+00:00September 14th, 2016|Performance Wire|Comments Off on Begin at the Beginning: Don’t use Begin Now with GoldenGate Replicat