Logdump, the GoldenGate swiss army knife

Logdump is the Swiss army knife of troubleshooting GoldenGate. With it, you can identify things like:

* Identify the transaction for a given SCN in Oracle
* Identify the transaction at an RBA in the trail file about which the replicat may be complaining
* Identify the before images of a row that GoldenGate uses for conflict detection
* Count the number of changes for a given table in the trail file
* Quickly skip to a specific time in the trail file
* Extract a subset of records to be applied

This is only a small list, so test with it on a test system and reply if you find something useful!

Below is a simple example of getting the total count of records in a trail file:

Logdump 3538 >open dirdat/c1000001
Current LogTrail is /u01/app/oracle/acfsmounts/ggate/oracle/dirdat/c1000001
Logdump 3539 >ghdr on
Logdump 3540 >count
LogTrail /u01/app/oracle/acfsmounts/ggate/oracle/dirdat/c1000001 has 75625 records
Total Data Bytes           5254891
  Avg Bytes/Record              69
Delete                        1949
Insert                        3390
FieldComp                    70094
GGSPKUpdate                    188
LargeObject                      2
RestartOK                        1
Others                           1
Before Images                37089
After Images                 38535

Average of 8198 Transactions
    Bytes/Trans .....       1083
    Records/Trans ...          9
    Files/Trans .....          1

Logdump 3541 >

The “ghdr on” line will simply print out header information for each record. This is useful for showing things such as the time the change was made on the source database.

An example of this is shown below, as we arbitrarily skip to the 75,620th record in the trail file.

Logdump 3546 >n
___________________________________________________________________
Hdr-Ind    :     E  (x45)     Partition  :     .  (x04)
UndoFlag   :     .  (x00)     BeforeAfter:     B  (x42)
RecLength  :    63  (x003f)   IO Time    : 2012/06/27 13:29:13.000.000
IOType     :    15  (x0f)     OrigNode   :   255  (xff)
TransInd   :     .  (x01)     FormatType :     R  (x52)
SyskeyLen  :     0  (x00)     Incomplete :     .  (x00)
AuditRBA   :        649       AuditPos   : 32242596
Continued  :     N  (x00)     RecCount   :     1  (x01)

2012/06/27 13:29:13.000.000 FieldComp            Len    63 RBA 14108721
Name: ATGDB_EXPRESS_CORE.DCSPP_ORDER
Before Image:                                             Partition 4   G  m
 0000 000d 0000 0009 4558 5038 3030 3130 3900 0200 | ........EXP800109...
 0700 0000 0338 3531 000c 001f 0000 3230 3132 2d30 | .....851......2012-0
 362d 3237 3a31 323a 3539 3a30 332e 3836 3030 3030 | 6-27:12:59:03.860000
 3030 30                                           | 000

By default, the data will be shown in the format above. If you want to see it broken out by column, you can add the “detail data” command.

Logdump 3547 >detail data

Logdump 3549 >sfh prev
___________________________________________________________________
Hdr-Ind    :     E  (x45)     Partition  :     .  (x04)
UndoFlag   :     .  (x00)     BeforeAfter:     B  (x42)
RecLength  :    63  (x003f)   IO Time    : 2012/06/27 13:29:13.000.000
IOType     :    15  (x0f)     OrigNode   :   255  (xff)
TransInd   :     .  (x01)     FormatType :     R  (x52)
SyskeyLen  :     0  (x00)     Incomplete :     .  (x00)
AuditRBA   :        649       AuditPos   : 32242596
Continued  :     N  (x00)     RecCount   :     1  (x01)

2012/06/27 13:29:13.000.000 FieldComp            Len    63 RBA 14108721
Name: ATGDB_EXPRESS_CORE.DCSPP_ORDER
Before Image:                                             Partition 4   G  m
 0000 000d 0000 0009 4558 5038 3030 3130 3900 0200 | ........EXP800109...
 0700 0000 0338 3531 000c 001f 0000 3230 3132 2d30 | .....851......2012-0
 362d 3237 3a31 323a 3539 3a30 332e 3836 3030 3030 | 6-27:12:59:03.860000
 3030 30                                           | 000
Column     0 (x0000), Len    13 (x000d)
 0000 0009 4558 5038 3030 3130 39                  | ....EXP800109
Column     2 (x0002), Len     7 (x0007)
 0000 0003 3835 31                                 | ....851
Column    12 (x000c), Len    31 (x001f)
 0000 3230 3132 2d30 362d 3237 3a31 323a 3539 3a30 | ..2012-06-27:12:59:0
 332e 3836 3030 3030 3030 30                       | 3.860000000

Logdump 3550 >

Notice that we can now see the data broken out by column.

Let’s say we want to quickly skip to a particular time to see changes that were made. We can use the sfts (“scan for timestamp”) command, as shown below.

Logdump 3556 >sfts 2012-06-27 11:15:00
Scan for timestamp >= 2012/06/27 15:15:00.000.000 GMT

2012/06/27 11:15:01.000.000 Insert               Len   254 RBA 7203416
Name: ATGDB_EXPRESS_CORE.DCSPP_SHIP_GROUP
After  Image:                                             Partition 4   G  b
 0000 000d 0000 0009 7367 3234 3030 3136 3700 0100 | ........sg2400167...
 0500 0000 0131 0002 0005 0000 0001 3100 0300 1900 | .....1........1.....
 0000 1568 6172 6467 6f6f 6453 6869 7070 696e 6747 | ...hardgoodShippingG
 726f 7570 0004 0019 0000 0015 6861 7264 676f 6f64 | roup........hardgood
 5368 6970 7069 6e67 4772 6f75 7000 0500 0d00 0000 | ShippingGroup.......
 0973 6732 3430 3031 3637 0006 001f ffff 3139 3030 | .sg2400167......1900
 2d30 312d 3031 3a30 303a 3030 3a30 302e 3030 3030 | -01-01:00:00:00.0000

Logdump 3557 >

You can also use logdump to finding the SCN associated with a change. In general, SCN’s are only shown for the start of a transaction. Golden only writes commited changes to the trail file, so this makes sense.

Below shows an example. Please notice that we first enable viewing token detail (which include SCN’s) by issuing “ggstoken detail”. We then issue a “sfnt” (“scan for next transaction”) call.

Logdump 3630 >ggstoken detail
Logdump 3631 >sfnt
Next Transaction found at RBA 13121954
___________________________________________________________________
Hdr-Ind    :     E  (x45)     Partition  :     .  (x04)
UndoFlag   :     .  (x00)     BeforeAfter:     A  (x41)
RecLength  :    63  (x003f)   IO Time    : 2012/06/27 13:22:26.000.000
IOType     :    15  (x0f)     OrigNode   :   255  (xff)
TransInd   :     .  (x03)     FormatType :     R  (x52)
SyskeyLen  :     0  (x00)     Incomplete :     .  (x00)
AuditRBA   :        649       AuditPos   : 196584
Continued  :     N  (x00)     RecCount   :     1  (x01)

2012/06/27 13:22:26.000.000 FieldComp            Len    63 RBA 13121954
Name: ATGDB_EXPRESS_CORE.DCSPP_ORDER
After  Image:                                             Partition 4   G  s
 0000 000e 0000 000a 4558 5032 3433 3031 3432 0002 | ........EXP2430142..
 0006 0000 0002 3732 000c 001f 0000 3230 3132 2d30 | ......72......2012-0
 362d 3237 3a31 333a 3232 3a32 392e 3337 3930 3030 | 6-27:13:22:29.379000
 3030 30                                           | 000

GGS tokens:
TokenID x52 'R' ORAROWID         Info x00  Length   20
 4141 4147 3658 4141 4141 4141 3545 6a41 412b 0001 | AAAG6XAAAAAA5EjAA+..
TokenID x4c 'L' LOGCSN           Info x00  Length    8
 3637 3733 3835 3234                               | 67738524
TokenID x36 '6' TRANID           Info x00  Length   17
 3030 3038 2e30 3138 2e30 3030 3032 3633 38        | 0008.018.00002638

Notice that if we knew the SCN (from Oracle LogMiner, for example), we could simply filter for that SCN, as shown below.

Logdump 3632 >pos 0
Reading forward from RBA 0
Logdump 3633 >filter csn 67738524
Logdump 3634 >n
Scanned     10000 records, RBA    1909467, 2012/06/27 09:28:58.000.000
Scanned     20000 records, RBA    3766622, 2012/06/27 09:59:07.000.000
Scanned     30000 records, RBA    5699929, 2012/06/27 10:50:42.000.000
Scanned     40000 records, RBA    7589007, 2012/06/27 11:28:59.000.000
Scanned     50000 records, RBA    9460310, 2012/06/27 11:59:02.000.000
Scanned     60000 records, RBA   11261431, 2012/06/27 12:29:09.000.000
Scanned     70000 records, RBA   13092536, 2012/06/27 13:21:52.000.000
___________________________________________________________________
Hdr-Ind    :     E  (x45)     Partition  :     .  (x04)
UndoFlag   :     .  (x00)     BeforeAfter:     B  (x42)
RecLength  :    28  (x001c)   IO Time    : 2012/06/27 13:22:26.000.000
IOType     :    15  (x0f)     OrigNode   :   255  (xff)
TransInd   :     .  (x00)     FormatType :     R  (x52)
SyskeyLen  :     0  (x00)     Incomplete :     .  (x00)
AuditRBA   :        649       AuditPos   : 161144
Continued  :     N  (x00)     RecCount   :     1  (x01)

2012/06/27 13:22:26.000.000 FieldComp            Len    28 RBA 13110820
Name: ATGDB_EXPRESS_CORE.DCSPP_ORDER
Before Image:                                             Partition 4   G  b
 0000 000e 0000 000a 4558 5032 3433 3031 3432 0002 | ........EXP2430142..
 0006 0000 0002 3634                               | ......64

GGS tokens:
TokenID x52 'R' ORAROWID         Info x00  Length   20
 4141 4147 3658 4141 4141 4141 3545 6a41 412b 0001 | AAAG6XAAAAAA5EjAA+..
TokenID x4c 'L' LOGCSN           Info x00  Length    8
 3637 3733 3835 3234                               | 67738524
TokenID x36 '6' TRANID           Info x00  Length   17
 3030 3038 2e30 3138 2e30 3030 3032 3633 38        | 0008.018.00002638


Filtering suppressed  70093 records
Logdump 3635 >

4 comments for “Logdump, the GoldenGate swiss army knife

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.