ogg之replicat进程跳过事务的方法
本文主要讲述:
1.ogg 如何跳过事务
2.logdump 在事务寻找中的关键作用
复制进程 abended
GGSCI (ORALTDB.eastmoney.com.sh) 12> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING REPLICAT ABENDED REP_MI01 00:00:00 00:00:25 |
如果要使用 logdump 的话,需要知道进程正在处理的文件,如何获取这个文件呢?
对于抽取进程来说:
1. 操作系统上最后一个 trail 文件一定是 abended 时正在处理的文件
2. 通过命令查看 info < 进程名 >,detail
对于复制进程来说,操作系统最后一个文件不一定是 replicat 进程正在处理的文件了:
1.info < 进程名 >
2.info < 进程名 >,detail
查看复制进程当前处理的文件和处理到的 RBA 地址
GGSCI (ORALTDB.eastmoney.com.sh) 13> info REP_MI01 REPLICAT REP_MI01 Last Started 2018-12-13 15:07 Status ABENDED Checkpoint Lag 00:00:00 (updated 00:00:35 ago) Log Read Checkpoint File /u01/app/oracle/products/ogg/dirdat/pump_mi01/ p1000000012 2018-12-13 15:04:13.394312 RBA 18728239 |
logdump 工具
[ogg@ORALTDB ogg]$ ./logdump Oracle GoldenGate Log File Dump Utility for Oracle Version 12.2.0.1.170221 OGGCORE_12.2.0.1.0OGGBP_PLATFORMS_170123.1033 Copyright (C) 1995, 2017, Oracle and/or its affiliates. All rights reserved. 2018-12-13 15:10:33 WARNING OGG-10173 (GLOBALS) line 1: Parsing error, [NOUSEANSISQLQUOTES] is deprecated. 2018-12-13 15:10:33 INFO OGG-06323 NOUSEANSISQLQUOTES is specified. Non ANSI SQL string syntax is used for parameter. Logdump 1 > open /u01/app/oracle/products/ogg/dirdat/pump_mi01/p1000000012 Current LogTrail is /u01/app/oracle/products/ogg/dirdat/pump_mi01/p1000000012 Logdump 2 > pos 18728239 --info 命令查出的 rba 地址 Reading forward from RBA 18728239 Logdump 3 >detail data Logdump 4 >ggstoken detail Logdump 5 >ghdr on Logdump 6 >n ___________________________________________________________________ Hdr-Ind : E (x45) Partition : . (x00) UndoFlag : . (x00) BeforeAfter: A (x41) RecLength : 82 (x0052) IO Time : 2018/12/13 15:07:30.282.502 IOType : 170 (xaa) OrigNode : 1 (x01) TransInd : . (x03) FormatType : R (x52) SyskeyLen : 0 (x00) Incomplete : . (x00) DDR/TDR Idx: (002, 000) AuditPos : 34596880 Continued : N (x00) RecCount : 1 (x01) 2018/12/13 15:07:30.282.502 Metadata Len 82 RBA 18728239 Name: * DDR Version: 1 Database type: ORACLE Character set ID: zhs16gbk National character set ID: UTF-16 Locale: neutral Case sensitivity: 14 14 14 14 14 14 14 14 14 14 14 14 11 14 14 14 TimeZone: GMT Global name: QUALITY * |
注意 TransInd :
(x00) 事务开始
(x01) 事务中
(x02) 事务最后
(x03) 单条事务
直接跳到当前事务的最后一条
Logdump 9 > sfet End of Transaction found at RBA 49635302 ___________________________________________________________________ Hdr-Ind : E (x45) Partition : . (x0c) UndoFlag : . (x00) BeforeAfter: B (x42) RecLength : 259 (x0103) IO Time : 2018/12/13 15:07:26.016.944 IOType : 3 (x03) OrigNode : 255 (xff) TransInd : . (x02) FormatType : R (x52) SyskeyLen : 0 (x00) Incomplete : . (x00) AuditRBA : 942 AuditPos : 98381560 Continued : N (x00) RecCount : 1 (x01) 2018/12/13 15:07:26.016.944 Delete Len 259 RBA 49635302 Name: MING.T4 (TDR Index: 2) Before Image: Partition 12 G e 0000 0007 0000 0003 5359 5300 0100 2200 0000 1e2f | ........SYS..."..../ 3837 3638 6634 3335 5f54 6578 7446 6965 6c64 4163 | 8768f435_TextFieldAc 6365 7373 6962 6c65 4100 0200 04ff ff00 0000 0300 | cessibleA........... 0900 0000 0533 3732 3932 0004 0004 ffff 0000 0005 | .....37292.......... 000e 0000 000a 4a41 5641 2043 4c41 5353 0006 0015 | ......JAVA CLASS.... 0000 3230 3134 2d30 372d 3037 3a30 363a 3036 3a34 | ..2014-07-07:06:06:4 3200 0700 1500 0032 3031 372d 3131 2d30 373a 3136 | 2......2017-11-07:16 Column 0 (x0000), Len 7 (x0007) 0000 0003 5359 53 | ....SYS Column 1 (x0001), Len 34 (x0022) 0000 001e 2f38 3736 3866 3433 355f 5465 7874 4669 | ..../8768f435_TextFi 656c 6441 6363 6573 7369 626c 6541 | eldAccessibleA Column 2 (x0002), Len 4 (x0004) ffff 0000 | .... Column 3 (x0003), Len 9 (x0009) 0000 0005 3337 3239 32 | ....37292 Column 4 (x0004), Len 4 (x0004) ffff 0000 | .... Column 5 (x0005), Len 14 (x000e) 0000 000a 4a41 5641 2043 4c41 5353 | ....JAVA CLASS Column 6 (x0006), Len 21 (x0015) 0000 3230 3134 2d30 372d 3037 3a30 363a 3036 3a34 | ..2014-07-07:06:06:4 32 | 2 Column 7 (x0007), Len 21 (x0015) 0000 3230 3137 2d31 312d 3037 3a31 363a 3433 3a32 | ..2017-11-07:16:43:2 32 | 2 Column 8 (x0008), Len 23 (x0017) 0000 0013 3230 3134 2d30 372d 3037 3a30 363a 3036 | ....2014-07-07:06:06 3a34 32 | :42 Column 9 (x0009), Len 9 (x0009) 0000 0005 5641 4c49 44 | ....VALID Column 10 (x000a), Len 5 (x0005) 0000 0001 4e | ....N Column 11 (x000b), Len 5 (x0005) 0000 0001 4e | ....N Column 12 (x000c), Len 5 (x0005) 0000 0001 4e | ....N Column 13 (x000d), Len 5 (x0005) 0000 0001 31 | ....1 Column 14 (x000e), Len 4 (x0004) ffff 0000 | .... Column 15 (x000f), Len 8 (x0008) 0000 0004 4e4f 4e45 | ....NONE Column 16 (x0010), Len 4 (x0004) ffff 0000 | .... Column 17 (x0011), Len 5 (x0005) 0000 0001 59 | ....Y GGS tokens: TokenID x52 'R' ORAROWID Info x00 Length 20 4141 4169 3049 4141 4a41 4141 4833 2f41 4139 0001 | AAAi0IAAJAAAH3/AA9.. |
看到 TransInd : . (x02)
说明这是该事务的最后一条
下一个事务或者 DDL :
Logdump 18 >n ___________________________________________________________________ Hdr-Ind : E (x45) Partition : . (x00) UndoFlag : . (x00) BeforeAfter: A (x41) RecLength : 260 (x0104) IO Time : 2018/12/13 15:24:48.500.917 IOType : 170 (xaa) OrigNode : 2 (x02) TransInd : . (x03) FormatType : R (x52) SyskeyLen : 0 (x00) Incomplete : . (x00) DDR/TDR Idx: (002, 003) AuditPos : 564872 Continued : N (x00) RecCount : 1 (x01) 2018/12/13 15:24:48.500.917 Metadata Len 260 RBA 49635641 Name: MING.TEST1 * 1)Name 2)Data Type 3)External Length 4)Fetch Offset 5)Scale 6)Level 7)Null 8)Bump if Odd 9)Internal Length 10)Binary Length 11)Table Length 12)Most Sig DT 13)Least Sig DT 14)High Precision 15)Low Precision 16)Elementary Item 17)Occurs 18)Key Column 19)Sub DataType 20)Native DataType 21)Character Set 22)Character Length 23)LOB Type 24)Partial Type * TDR version: 1 Definition for table MING.TEST1 Record Length: 134 Columns: 3 A 64 50 0 0 0 1 0 50 50 50 0 0 0 0 1 0 1 2 2 -1 0 0 0 EUTIME 192 19 56 0 0 1 0 19 19 19 0 5 0 0 1 0 0 0 12 -1 0 0 0 B 64 50 78 0 0 1 0 50 50 50 0 0 0 0 1 0 0 2 2 -1 0 0 0 End of definition |
可以看到当前 TransInd 是 (x03) ,说明上个事务结束后,新事务是一个单条事务,这个事务的 RBA 就是我们在寻找的 extrba 的值
当前打开的是 /u01/app/oracle/products/ogg/dirdat/pump_mi01/p1000000012 ,所以 extseqno 是 12
GGSCI (ORALTDB.eastmoney.com.sh) 2> alter replicat rep_mi01,extseqno 12,extrba 49635641 2018-12-13 15:31:45 INFO OGG-06594 Replicat REP_MI01 has been altered through GGSCI. Even the start up position might be updated, duplicate suppression remains active in next startup. To override duplicate suppression, start REP_MI01 with NOFILTERDUPTRANSACTIONS option. REPLICAT altered. GGSCI (ORALTDB.eastmoney.com.sh) 3> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING REPLICAT STOPPED REP_MI01 00:00:00 00:00:10 GGSCI (ORALTDB.eastmoney.com.sh) 4> start REP_MI01 Sending START request to MANAGER ... REPLICAT REP_MI01 starting GGSCI (ORALTDB.eastmoney.com.sh) 5> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING REPLICAT RUNNING REP_MI01 00:00:00 00:00:18 |
这样就跳过了上一个有问题的事务。