oracle undo的继续实验

SQL> update t1 set name='opqrst' where id=0;

1 row updated.

SQL> select * from t1;

    ID NAME
------ --------------------
     0 opqrst
SQL> select dbms_rowid.rowid_relative_fno(rowid),dbms_rowid.rowid_block_number(rowid) from t1;

DBMS_ROWID.ROWID_RELATIVE_FNO(ROWID) DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID)
------------------------------------ ------------------------------------
                   1                     5954

*** 2013-10-17 17:00:42.223
Start dump data blocks tsn: 0 file#: 1 minblk 5954 maxblk 5954
buffer tsn: 0 rdba: 0x00401742 (1/5954)
scn: 0x0000.000a56ad seq: 0x01 flg: 0x00 tail: 0x56ad0601
frmt: 0x02 chkval: 0x0000 type: 0x06=trans data
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x0D921400 to 0x0D923400
D921400 0000A206 00401742 000A56AD 00010000  [....B.@..V......]
D921410 00000000 00000001 000024C8 0009D8B7  [.........$......]
D921420 00000000 00030002 00000000 00100004  [................]
D921430 0000009C 00803DE3 00030050 00020001  [.....=..P.......]
D921440 00000000 00000000 00000000 00000000  [................]
D921450 00000000 00000000 00000000 00010100  [................]
D921460 0014FFFF 1F7E1F86 00001F80 1F860001  [......~.........]
D921470 00000000 00000000 00000000 00000000  [................]
        Repeat 502 times
D9233E0 012C0000 06800102 7271706F 012C7473  [..,.....opqrst,.]
D9233F0 08800102 64636261 68676665 56AD0601  [....abcdefgh...V]
Block header dump:  0x00401742

Object id on Block? Y
 seg/obj: 0x24c8  csc: 0x00.9d8b7  itc: 2  flg: O  typ: 1 - DATA
     fsl: 0  fnx: 0x0 ver: 0x01

 Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0x0004.010.0000009c  0x00803de3.0050.03  ----    1  fsc 0x0002.00000000
0x02   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000

data_block_dump,data header at 0xd92145c
===============
tsiz: 0x1fa0
hsiz: 0x14
pbl: 0x0d92145c
bdba: 0x00401742
     76543210
flag=--------
ntab=1
nrow=1
frre=-1

fsbo=0x14
fseo=0x1f86
avsp=0x1f7e
tosp=0x1f80
0xe:pti[0]      nrow=1  offs=0
0x12:pri[0]     offs=0x1f86
block_row_dump:
tab 0, row 0, @0x1f86
tl: 12 fb: --H-FL-- lb: 0x1  cc: 2
col  0: [ 1]  80
col  1: [ 6]  6f 70 71 72 73 74
end_of_block_dump
End dump data blocks tsn: 0 file#: 1 minblk 5954 maxblk 5954

根据UBA导出UNDO文件

SQL> alter system dump datafile 2 block 15843;

System altered.

*** 2013-10-17 17:03:42.384
Start dump data blocks tsn: 1 file#: 2 minblk 15843 maxblk 15843
buffer tsn: 1 rdba: 0x00803de3 (2/15843)
scn: 0x0000.000a56ad seq: 0x01 flg: 0x04 tail: 0x56ad0201
frmt: 0x02 chkval: 0x8010 type: 0x02=KTU UNDO BLOCK
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x0D921400 to 0x0D923400
D921400 0000A202 00803DE3 000A56AD 04010000  [.....=...V......]
D921410 00008010 00100004 0000009C 03030050  [............P...]
D921420 1FE80000 1F1C1F7C 00001EA4 00000000  [....|...........]
D921430 00000000 00000000 00000000 00000000  [................]
        Repeat 487 times
D9232B0 00000000 00000000 00180010 00140010  [................]
D9232C0 0002001C 00070004 000024C8 000024C8  [.........$...$..]
D9232D0 00000000 00000000 0210010B 009C0000  [................]
D9232E0 00000102 00000001 00803DE3 00020050  [.........=..P...]
D9232F0 00401742 00401741 011312FF 00000001  [B.@.A.@.........]
D923300 00010001 00401742 00401741 811512FF  [....B.@.A.@.....]
D923310 00000001 000A012C 01020000 00020000  [....,...........]

D923320 00000001 00000007 6B6A6906 006E6D6C  [.........ijklmn.]
D923330 0018000C 001D0010 00080002 000024C8  [.............$..]
D923340 000024C8 00000000 00000000 0110010B  [.$..............]
D923350 009C0000 00000102 00000000 00803DE3  [.............=..]
D923360 00010050 00401742 00401741 010512FF  [P...B.@.A.@.....]
D923370 00000001 000A012C 01020000 00000002  [....,...........]
D923380 00000000 00000001 64636261 68676665  [........abcdefgh]
D923390 00480008 00140008 000024C8 000024C8  [..H......$...$..]
D9233A0 00000000 00000000 0010010B 00010408  [................]
D9233B0 00803DE2 00080050 0009C641 BFDF0000  [.=..P...A.......]
D9233C0 0009C649 00000000 0CBD2DE0 0009D8B8  [I........-......]
D9233D0 BFDF0000 00803DE0 00000000 00000000  [.....=..........]
D9233E0 00000103 00000016 00401742 00401741  [........B.@.A.@.]
D9233F0 010312FF 00000001 02000000 56AD0201  [...............V]

********************************************************************************
UNDO BLK:
xid: 0x0004.010.0000009c  seq: 0x50  cnt: 0x3(注意,CNT和IRB这两个数据和REC的总和接近)   irb: 0x3()   icl: 0x0   flg: 0x0000
 Rec Offset      Rec Offset      Rec Offset      Rec Offset      Rec Offset
---------------------------------------------------------------------------
0x01 0x1f7c     0x02 0x1f1c     0x03 0x1ea4

*-----------------------------
* Rec #0x1  slt: 0x10  objn: 9416(0x000024c8)  objd: 9416  tblspc: 0(0x00000000)
*       Layer:  11 (Row)   opc: 1   rci 0x00
Undo type:  Regular undo    Begin trans    Last buffer split:  No
Temp Object:  No
Tablespace Undo:  No
rdba: 0x00000000
*-----------------------------
uba: 0x00803de2.0050.08 ctl max scn: 0x0000.0009c641 prv tx scn: 0x0000.0009c649
txn start scn: scn: 0x0000.0009d8b8 logon user: 0
 prev brb: 8404448 prev bcl: 0



KDO undo record:
KTB Redo
op: 0x03  ver: 0x01
op: Z
KDO Op code: DRP row dependencies Disabled
  xtype: XA flags: 0x00000000  bdba: 0x00401742  hdba: 0x00401741
itli: 1  ispac: 0  maxfr: 4863
tabn: 0 slot: 0(0x0)

*-----------------------------
* Rec #0x2  slt: 0x10  objn: 9416(0x000024c8)  objd: 9416  tblspc: 0(0x00000000)
*       Layer:  11 (Row)   opc: 1   rci 0x01
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
op: C  uba: 0x00803de3.0050.01
KDO Op code: URP row dependencies Disabled

xtype: XA flags: 0x00000000  bdba: 0x00401742  hdba: 0x00401741
itli: 1  ispac: 0  maxfr: 4863
tabn: 0 slot: 0(0x0)  



flag: 0x2c lock: 1 ckix: 10
ncol: 2 nnew: 1 size: 2
col  1: [ 8]  61 62 63 64 65 66 67 68

*-----------------------------
* Rec #0x3  slt: 0x10  objn: 9416(0x000024c8)  objd: 9416  tblspc: 0(0x00000000)
*       Layer:  11 (Row)   opc: 1   rci 0x02
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
op: C  uba: 0x00803de3.0050.02


Array Update of 1 rows:
tabn: 0 slot: 0(0x0) flag: 0x2c lock: 1 ckix: 10
ncol: 2 nnew: 1 size: 0
KDO Op code:  21 row dependencies Disabled




  xtype: XAxtype KDO_KDOM2 flags: 0x00000080  bdba: 0x00401742  hdba: 0x00401741
itli: 1  ispac: 0  maxfr: 4863
vect = 2
col  1: [ 6]  69 6a 6b 6c 6d 6e

End dump data blocks tsn: 1 file#: 2 minblk 15843 maxblk 15843


做了2次UPDATE后,有一件事让我很在意,就是关于OP:C的 标志和OP:Z的标志,还有的就是OP:C标志之后对应的UBA标志,为了验证想法,我又做了如下测试,为了简化如下测试,我这里就口头叙述吧。

我之后测试update了多条语句,发现了一个有趣的现象,当update的数目超过一定的时候,dump出来这个信息.

Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0x0004.010.0000009c  0x00803de4.0050.08  ----    1  fsc 0x0008.00000000
0x02   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000

data_block_dump,data header at 0xd92145c
===============
tsiz: 0x1fa0
hsiz: 0x14
pbl: 0x0d92145c
bdba: 0x00401742
     76543210
flag=--------
ntab=1
nrow=1
frre=-1
fsbo=0x14
fseo=0x1d3a
avsp=0x1f7a
tosp=0x1f82

0xe:pti[0]      nrow=1  offs=0
0x12:pri[0]     offs=0x1d3a
block_row_dump:
tab 0, row 0, @0x1d3a
tl: 10 fb: --H-FL-- lb: 0x1  cc: 2
col  0: [ 1]  80
col  1: [ 4]  66 75 6e 76
end_of_block_dump
End dump data blocks tsn: 0 file#: 1 minblk 5954 maxblk 5954

可以看看红色的地方,对比上次,这次的uba的左边字段加了1.

而在rec 0中的 rdba竟然是不可思议的803de3,从这次实验可以看出,rdba的字段的意思是指向之前的另一个回滚段,

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值