SYS@ orcl> select b.segment_name, a.file#, a.dbarfil, a.dbablk, a.class, a.state,
2 decode(bitand(flag, 1), 0, 'N', 'Y') dirty
3 from x$bh a, dba_extents b where a.dbarfil = b.relative_fno
4 and b.owner = 'SCOTT' and b.segment_name = 'EMP'
5 and a.dbablk >= b.block_id and a.dbablk < b.block_id + b.blocks;
SEGMENT_NAME FILE# DBARFIL DBABLK CLASS STATE D
--------------- ---------- ---------- ---------- ---------- ---------- -
EMP 4 4 147 1 1 N
EMP 4 4 150 1 1 N
EMP 4 4 148 1 1 N
EMP 4 4 151 1 1 Y
EMP 4 4 151 1 3 N
EMP 4 4 146 4 3 N
EMP 4 4 146 4 3 N
EMP 4 4 146 4 3 N
EMP 4 4 146 4 3 N
EMP 4 4 146 4 1 N
EMP 4 4 149 1 1 N
转储数据块信息
xtype: XAxtype KDO_KDOM2 flags: 0x00000080 bdba: 0x01000097 hdba: 0x01000092
0000 0001 0000 0000 0000 0000 1001 0111
4 151
SYS@ orcl> alter system dump datafile 4 block 151;
System altered.
/u01/app/Oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_6466.trc
Block header dump: 0x01000097
Object id on Block? Y
seg/obj: 0x11ddd csc: 0x00.1aa479 itc: 2 flg: E typ: 1 - DATA
brn: 0 bdba: 0x1000090 ver: 0x01 opc: 0
inc: 0 exflg: 0
Itl Xid Uba Flag Lck Scn/Fsc
0x01 0x0008.013.00000403 0x00c008d7.01cd.27 C--- 0 scn 0x0000.0017ff06
0x02 0x0001.008.0000029c 0x00c000fb.01ea.32 --- 3 scn 0x0000.0017ef1e
bdba: 0x01000097
tab 0, row 5, @0x1ce8
tl: 41 fb: --H-FL-- lb: 0x02 cc: 8
col 0: [ 3] c2 4d 63
col 1: [ 5] 42 4c 41 4b 45
col 2: [ 7] 4d 41 4e 41 47 45 52
col 3: [ 3] c2 4f 28
col 4: [ 7] 77 b5 05 01 01 01 01
col 5: [ 3] c2 1d 33
col 6: *NULL*
col 7: [ 2] c1 1f
tab 0, row 6, @0x1cbf
tl: 41 fb: --H-FL-- lb: 0x02 cc: 8
col 0: [ 3] c2 4e 53
col 1: [ 5] 43 4c 41 52 4b
col 2: [ 7] 4d 41 4e 41 47 45 52
col 3: [ 3] c2 4f 28
col 4: [ 7] 77 b5 06 09 01 01 01
col 5: [ 3] c2 19 33
col 6: *NULL*
col 7: [ 2] c1 0b
tab 0, row 7, @0x1e4c
tl: 40 fb: --H-FL-- lb: 0x02 cc: 8
col 0: [ 3] c2 4e 59
col 1: [ 5] 53 43 4f 54 54
col 2: [ 7] 41 4e 41 4c 59 53 54
col 3: [ 3] c2 4c 43
col 4: [ 7] 77 bb 04 13 01 01 01
col 5: [ 2] c2 1f
col 6: *NULL*
col 7: [ 2] c1 15
ITL内容主要包括Xid,Uba,Lck
Xid = Undo.Segment.Number + Transaction.Table.Slot.Number + Wrap
8 19 1027
数据块上同样存在指向回滚段的事务信息,0x00c000fb.01ea.32代表文件0x00c000fb,seq:01ea,32为irb信息。
********************************************************************************
UNDO BLK:
xid: 0x0001.008.0000029c seq: 0x1ea cnt: 0x32 irb: 0x32 icl: 0x32 flg: 0x0000
(1)首先当一个事务开始时,需要在回滚段事务表上分配一个事务槽。
(2)在数据块头部获取一个ITL事务槽,该事务槽指向回滚段头的事务槽
(3)在修改数据之前,需要记录前镜像信息,这个信息以UNDO RECORD的形式存储在回滚段中,回滚段头事务槽指向该记录。
(4)锁定修改行,修改行锁定位(lb-lock byte)指向ITL事务槽。
(5)数据修改可以进行。
-- to be continue --
相关阅读: Oracle redo 原理 http://www.linuxidc.com/Linux/2013-03/80324.htm
更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12
