index为数据槽号,state 为10代表的是活动事务
转储前镜像信息
DBA,这个DBA指向的就是包含这个事务的前镜像的数据块地址0x00c00d13,前10位代表文件号,后22位代表数据块。
00000000110000000000110100010011,文件号为3数据块为3347。这从事务表中查询得到的数据完全一致。
SYS@ orcl> select xidusn, xidslot, xidsqn, ubafil, ubablk, ubarec from v$transaction;
XIDUSN XIDSLOT XIDSQN UBAFIL UBABLK UBAREC
---------- ---------- ---------- ---------- ---------- ----------
1 8 668 3 3347 47
SYS@ orcl> alter system dump datafile 3 block 3347;
System altered.
-======================
/u01/app/Oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_5109.trc
-======================
Start dump data blocks tsn: 2 file#:3 minblk 3347 maxblk 3347
Block dump from cache:
Dump of buffer cache at level 4 for tsn=2, rdba=12586259
BH (0x423e81c4) file#: 3 rdba: 0x00c00d13 (3/3347) class: 18 ba: 0x420ee000
set: 3 pool 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 484,28
dbwrid: 0 obj: -1 objn: 0 tsn: 2 afn: 3 hint: f
hash: [0x515b96d0,0x515b96d0] lru: [0x423e8344,0x423e819c]
ckptq: [NULL] fileq: [NULL] objq: [0x3f3f1798,0x3f3f16c4]
st: XCURRENT md: NULL tch: 9
flags: block_written_once redo_since_read
LRBA: [0x0.0.0] LSCN: [0x0.0] HSCN: [0xffff.ffffffff] HSUB: [1]
cr pin refcnt: 0 sh pin refcnt: 0
Block dump from disk:
buffer tsn: 2 rdba: 0x00c00d13 (3/3347)
scn: 0x0000.001aa1c5 seq: 0x01 flg: 0x04 tail: 0xa1c50201
frmt: 0x02 chkval: 0x6573 type: 0x02=KTU UNDO BLOCK
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x00792600 to 0x00794600
792600 0000A202 00C00D13 001AA1C5 04010000 [................]
......
********************************************************************************
UNDO BLK:
xid: 0x0001.008.0000029c seq: 0x1ea cnt: 0x32 irb: 0x32 icl: 0x0 flg: 0x0000
Rec Offset Rec Offset Rec Offset Rec Offset Rec Offset
---------------------------------------------------------------------------
0x01 0x1f70 0x02 0x1f18 0x03 0x1ec4 0x04 0x1e3c 0x05 0x1dd0
0x06 0x1d64 0x07 0x1bdc 0x08 0x1ab4 0x09 0x19b8 0x0a 0x1930
0x0b 0x18c8 0x0c 0x185c 0x0d 0x1764 0x0e 0x16c4 0x0f 0x1654
0x10 0x15f4 0x11 0x156c 0x12 0x1500 0x13 0x1494 0x14 0x130c
0x15 0x11e4 0x16 0x10e8 0x17 0x1060 0x18 0x0ff4 0x19 0x0f88
0x1a 0x0e90 0x1b 0x0df0 0x1c 0x0d80 0x1d 0x0d20 0x1e 0x0c98
0x1f 0x0c2c 0x20 0x0bc0 0x21 0x0a38 0x22 0x0910 0x23 0x0814
0x24 0x078c 0x25 0x0720 0x26 0x06b4 0x27 0x05bc 0x28 0x051c
0x29 0x04ac 0x2a 0x044c 0x2b 0x03fc 0x2c 0x035c 0x2d 0x02ec
0x2e 0x028c 0x2f 0x01f0 0x30 0x0198 0x31 0x013c 0x32 0x00e0
注意这里的irb: 0x32,irb指的是回滚段中记录的最近未提交变更开始之处,如果开始回滚,这是起始的搜索点。
## 从接下来的信息中找到0x32
*-----------------------------
* Rec #0x32 slt: 0x08 objn: 73181(0x00011ddd) objd: 73181 tblspc: 4(0x00000004)
* Layer: 11 (Row) opc: 1 rci 0x31
Undo type: Regular undo Last buffer split: No
Temp Object: No
Tablespace Undo: No
rdba: 0x00000000
*-----------------------------
KDO undo record:
KTB Redo
op: 0x02 ver: 0x01
compat bit: 4 (post-11) padding: 1
op: C uba: 0x00c00d13.01ea.31
KDO Op code: URP row dependencies Disabled
xtype: XA flags: 0x00000000 bdba: 0x01000097 hdba: 0x01000092
itli: 2 ispac: 0 maxfr: 4858
tabn: 0 slot: 5(0x5) flag: 0x2c lock: 0 ckix: 191
ncol: 8 nnew: 1 size: 1
col 5: [ 3] c2 1d 33
c2 1d 33转换为十进制就是2850。这正好对应了最后更新记录的前镜像。
update emp set sal = 4000 where empno = 7698;
rci 0x31代表的就是UNDO Chain(同一事务中的多次修改,根据Chain链接关联)的下一个偏移量,此处为Ox31。
*-----------------------------
* Rec #0x31 slt: 0x08 objn: 73181(0x00011ddd) objd: 73181 tblspc: 4(0x00000004)
* Layer: 11 (Row) opc: 1 rci 0x30
Undo type: Regular undo Last buffer split: No
Temp Object: No
Tablespace Undo: No
rdba: 0x00000000
*-----------------------------
KDO undo record:
KTB Redo
op: 0x02 ver: 0x01
compat bit: 4 (post-11) padding: 1
op: C uba: 0x00c00d13.01ea.30
KDO Op code: URP row dependencies Disabled
xtype: XA flags: 0x00000000 bdba: 0x01000097 hdba: 0x01000092
itli: 2 ispac: 0 maxfr: 4858
tabn: 0 slot: 6(0x6) flag: 0x2c lock: 0 ckix: 191
ncol: 8 nnew: 1 size: 1
col 5: [ 3] c2 19 33
