{"id":2326,"date":"2012-06-27T19:34:53","date_gmt":"2012-06-28T00:34:53","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=2326"},"modified":"2012-06-27T19:34:53","modified_gmt":"2012-06-28T00:34:53","slug":"logdump-the-goldengate-swiss-army-knife","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2012\/06\/27\/logdump-the-goldengate-swiss-army-knife\/","title":{"rendered":"Logdump, the GoldenGate swiss army knife"},"content":{"rendered":"<p>Logdump is the Swiss army knife of troubleshooting GoldenGate.  With it, you can identify things like:<\/p>\n<p>* Identify the transaction for a given SCN in Oracle<br \/>\n* Identify the transaction at an RBA in the trail file about which the replicat may be complaining<br \/>\n* Identify the before images of a row that GoldenGate uses for conflict detection<br \/>\n* Count the number of changes for a given table in the trail file<br \/>\n* Quickly skip to a specific time in the trail file<br \/>\n*  Extract a subset of records to be applied<\/p>\n<p>This is only a small list, so test with it on a test system and reply if you find something useful!<\/p>\n<p>Below is a simple example of getting the total count of records in a trail file:<\/p>\n<pre lang=\"text\">\r\nLogdump 3538 >open dirdat\/c1000001\r\nCurrent LogTrail is \/u01\/app\/oracle\/acfsmounts\/ggate\/oracle\/dirdat\/c1000001\r\nLogdump 3539 >ghdr on\r\nLogdump 3540 >count\r\nLogTrail \/u01\/app\/oracle\/acfsmounts\/ggate\/oracle\/dirdat\/c1000001 has 75625 records\r\nTotal Data Bytes           5254891\r\n  Avg Bytes\/Record              69\r\nDelete                        1949\r\nInsert                        3390\r\nFieldComp                    70094\r\nGGSPKUpdate                    188\r\nLargeObject                      2\r\nRestartOK                        1\r\nOthers                           1\r\nBefore Images                37089\r\nAfter Images                 38535\r\n\r\nAverage of 8198 Transactions\r\n    Bytes\/Trans .....       1083\r\n    Records\/Trans ...          9\r\n    Files\/Trans .....          1\r\n\r\nLogdump 3541 >\r\n<\/pre>\n<p>The \u201cghdr on\u201d 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.<\/p>\n<p>An example of this is shown below, as we arbitrarily skip to the 75,620th record in the trail file.<\/p>\n<pre lang=\"text\">\r\nLogdump 3546 >n\r\n___________________________________________________________________\r\nHdr-Ind    :     E  (x45)     Partition  :     .  (x04)\r\nUndoFlag   :     .  (x00)     BeforeAfter:     B  (x42)\r\nRecLength  :    63  (x003f)   IO Time    : 2012\/06\/27 13:29:13.000.000\r\nIOType     :    15  (x0f)     OrigNode   :   255  (xff)\r\nTransInd   :     .  (x01)     FormatType :     R  (x52)\r\nSyskeyLen  :     0  (x00)     Incomplete :     .  (x00)\r\nAuditRBA   :        649       AuditPos   : 32242596\r\nContinued  :     N  (x00)     RecCount   :     1  (x01)\r\n\r\n2012\/06\/27 13:29:13.000.000 FieldComp            Len    63 RBA 14108721\r\nName: ATGDB_EXPRESS_CORE.DCSPP_ORDER\r\nBefore Image:                                             Partition 4   G  m\r\n 0000 000d 0000 0009 4558 5038 3030 3130 3900 0200 | ........EXP800109...\r\n 0700 0000 0338 3531 000c 001f 0000 3230 3132 2d30 | .....851......2012-0\r\n 362d 3237 3a31 323a 3539 3a30 332e 3836 3030 3030 | 6-27:12:59:03.860000\r\n 3030 30                                           | 000\r\n<\/pre>\n<p>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 \u201cdetail data\u201d command.<\/p>\n<pre lang=\"text\">\r\nLogdump 3547 >detail data\r\n\r\nLogdump 3549 >sfh prev\r\n___________________________________________________________________\r\nHdr-Ind    :     E  (x45)     Partition  :     .  (x04)\r\nUndoFlag   :     .  (x00)     BeforeAfter:     B  (x42)\r\nRecLength  :    63  (x003f)   IO Time    : 2012\/06\/27 13:29:13.000.000\r\nIOType     :    15  (x0f)     OrigNode   :   255  (xff)\r\nTransInd   :     .  (x01)     FormatType :     R  (x52)\r\nSyskeyLen  :     0  (x00)     Incomplete :     .  (x00)\r\nAuditRBA   :        649       AuditPos   : 32242596\r\nContinued  :     N  (x00)     RecCount   :     1  (x01)\r\n\r\n2012\/06\/27 13:29:13.000.000 FieldComp            Len    63 RBA 14108721\r\nName: ATGDB_EXPRESS_CORE.DCSPP_ORDER\r\nBefore Image:                                             Partition 4   G  m\r\n 0000 000d 0000 0009 4558 5038 3030 3130 3900 0200 | ........EXP800109...\r\n 0700 0000 0338 3531 000c 001f 0000 3230 3132 2d30 | .....851......2012-0\r\n 362d 3237 3a31 323a 3539 3a30 332e 3836 3030 3030 | 6-27:12:59:03.860000\r\n 3030 30                                           | 000\r\nColumn     0 (x0000), Len    13 (x000d)\r\n 0000 0009 4558 5038 3030 3130 39                  | ....EXP800109\r\nColumn     2 (x0002), Len     7 (x0007)\r\n 0000 0003 3835 31                                 | ....851\r\nColumn    12 (x000c), Len    31 (x001f)\r\n 0000 3230 3132 2d30 362d 3237 3a31 323a 3539 3a30 | ..2012-06-27:12:59:0\r\n 332e 3836 3030 3030 3030 30                       | 3.860000000\r\n\r\nLogdump 3550 >\r\n<\/pre>\n<p>Notice that we can now see the data broken out by column.<\/p>\n<p>Let\u2019s say we want to quickly skip to a particular time to see changes that were made.  We can use the sfts (\u201cscan for timestamp\u201d) command, as shown below.<\/p>\n<pre lang=\"text\">\r\nLogdump 3556 >sfts 2012-06-27 11:15:00\r\nScan for timestamp >= 2012\/06\/27 15:15:00.000.000 GMT\r\n\r\n2012\/06\/27 11:15:01.000.000 Insert               Len   254 RBA 7203416\r\nName: ATGDB_EXPRESS_CORE.DCSPP_SHIP_GROUP\r\nAfter  Image:                                             Partition 4   G  b\r\n 0000 000d 0000 0009 7367 3234 3030 3136 3700 0100 | ........sg2400167...\r\n 0500 0000 0131 0002 0005 0000 0001 3100 0300 1900 | .....1........1.....\r\n 0000 1568 6172 6467 6f6f 6453 6869 7070 696e 6747 | ...hardgoodShippingG\r\n 726f 7570 0004 0019 0000 0015 6861 7264 676f 6f64 | roup........hardgood\r\n 5368 6970 7069 6e67 4772 6f75 7000 0500 0d00 0000 | ShippingGroup.......\r\n 0973 6732 3430 3031 3637 0006 001f ffff 3139 3030 | .sg2400167......1900\r\n 2d30 312d 3031 3a30 303a 3030 3a30 302e 3030 3030 | -01-01:00:00:00.0000\r\n\r\nLogdump 3557 >\r\n<\/pre>\n<p>You can also use logdump to finding the SCN associated with a change.  In general, SCN\u2019s are only shown for the start of a transaction.  Golden only writes commited changes to the trail file, so this makes sense.<\/p>\n<p>Below shows an example.  Please notice that we first enable viewing token detail (which include SCN\u2019s) by issuing \u201cggstoken detail\u201d.  We then issue a \u201csfnt\u201d (\u201cscan for next transaction\u201d) call.<\/p>\n<pre lang=\"text\">\r\nLogdump 3630 >ggstoken detail\r\nLogdump 3631 >sfnt\r\nNext Transaction found at RBA 13121954\r\n___________________________________________________________________\r\nHdr-Ind    :     E  (x45)     Partition  :     .  (x04)\r\nUndoFlag   :     .  (x00)     BeforeAfter:     A  (x41)\r\nRecLength  :    63  (x003f)   IO Time    : 2012\/06\/27 13:22:26.000.000\r\nIOType     :    15  (x0f)     OrigNode   :   255  (xff)\r\nTransInd   :     .  (x03)     FormatType :     R  (x52)\r\nSyskeyLen  :     0  (x00)     Incomplete :     .  (x00)\r\nAuditRBA   :        649       AuditPos   : 196584\r\nContinued  :     N  (x00)     RecCount   :     1  (x01)\r\n\r\n2012\/06\/27 13:22:26.000.000 FieldComp            Len    63 RBA 13121954\r\nName: ATGDB_EXPRESS_CORE.DCSPP_ORDER\r\nAfter  Image:                                             Partition 4   G  s\r\n 0000 000e 0000 000a 4558 5032 3433 3031 3432 0002 | ........EXP2430142..\r\n 0006 0000 0002 3732 000c 001f 0000 3230 3132 2d30 | ......72......2012-0\r\n 362d 3237 3a31 333a 3232 3a32 392e 3337 3930 3030 | 6-27:13:22:29.379000\r\n 3030 30                                           | 000\r\n\r\nGGS tokens:\r\nTokenID x52 'R' ORAROWID         Info x00  Length   20\r\n 4141 4147 3658 4141 4141 4141 3545 6a41 412b 0001 | AAAG6XAAAAAA5EjAA+..\r\nTokenID x4c 'L' LOGCSN           Info x00  Length    8\r\n 3637 3733 3835 3234                               | 67738524\r\nTokenID x36 '6' TRANID           Info x00  Length   17\r\n 3030 3038 2e30 3138 2e30 3030 3032 3633 38        | 0008.018.00002638\r\n<\/pre>\n<p>Notice that if we knew the SCN (from Oracle LogMiner, for example), we could simply filter for that SCN, as shown below.<\/p>\n<pre lang=\"text\">\r\nLogdump 3632 >pos 0\r\nReading forward from RBA 0\r\nLogdump 3633 >filter csn 67738524\r\nLogdump 3634 >n\r\nScanned     10000 records, RBA    1909467, 2012\/06\/27 09:28:58.000.000\r\nScanned     20000 records, RBA    3766622, 2012\/06\/27 09:59:07.000.000\r\nScanned     30000 records, RBA    5699929, 2012\/06\/27 10:50:42.000.000\r\nScanned     40000 records, RBA    7589007, 2012\/06\/27 11:28:59.000.000\r\nScanned     50000 records, RBA    9460310, 2012\/06\/27 11:59:02.000.000\r\nScanned     60000 records, RBA   11261431, 2012\/06\/27 12:29:09.000.000\r\nScanned     70000 records, RBA   13092536, 2012\/06\/27 13:21:52.000.000\r\n___________________________________________________________________\r\nHdr-Ind    :     E  (x45)     Partition  :     .  (x04)\r\nUndoFlag   :     .  (x00)     BeforeAfter:     B  (x42)\r\nRecLength  :    28  (x001c)   IO Time    : 2012\/06\/27 13:22:26.000.000\r\nIOType     :    15  (x0f)     OrigNode   :   255  (xff)\r\nTransInd   :     .  (x00)     FormatType :     R  (x52)\r\nSyskeyLen  :     0  (x00)     Incomplete :     .  (x00)\r\nAuditRBA   :        649       AuditPos   : 161144\r\nContinued  :     N  (x00)     RecCount   :     1  (x01)\r\n\r\n2012\/06\/27 13:22:26.000.000 FieldComp            Len    28 RBA 13110820\r\nName: ATGDB_EXPRESS_CORE.DCSPP_ORDER\r\nBefore Image:                                             Partition 4   G  b\r\n 0000 000e 0000 000a 4558 5032 3433 3031 3432 0002 | ........EXP2430142..\r\n 0006 0000 0002 3634                               | ......64\r\n\r\nGGS tokens:\r\nTokenID x52 'R' ORAROWID         Info x00  Length   20\r\n 4141 4147 3658 4141 4141 4141 3545 6a41 412b 0001 | AAAG6XAAAAAA5EjAA+..\r\nTokenID x4c 'L' LOGCSN           Info x00  Length    8\r\n 3637 3733 3835 3234                               | 67738524\r\nTokenID x36 '6' TRANID           Info x00  Length   17\r\n 3030 3038 2e30 3138 2e30 3030 3032 3633 38        | 0008.018.00002638\r\n\r\n\r\nFiltering suppressed  70093 records\r\nLogdump 3635 >\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2012\/06\/27\/logdump-the-goldengate-swiss-army-knife\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[19,35],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/2326"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=2326"}],"version-history":[{"count":4,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/2326\/revisions"}],"predecessor-version":[{"id":2330,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/2326\/revisions\/2330"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=2326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=2326"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=2326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}