ITPub博客

首页 > Linux操作系统 > Linux操作系统 > oracle实验记录 (dump undo4)

oracle实验记录 (dump undo4)

原创 Linux操作系统 作者:fufuh2o 时间:2009-06-26 10:12:09 0 删除 编辑

连接到:
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> select * from test;

TESTCOL
--------------------
de
de

SQL> select dbms_rowid.rowid_relative_fno(rowid) file#,dbms_rowid.rowid_block_nu
mber(rowid) blk# from test;

     FILE#       BLK#
---------- ----------
         1      56802
         1      56802

SQL> update test set testcol='z';

已更新2行。

SQL> commit
  2  ;

提交完成。

SQL> alter system dump datafile 1 block 56802;

系统已更改。

SQL> update test set testcol='zz';

已更新2行。

SQL> commit
  2  ;

提交完成。

SQL> alter system dump datafile 1 block 56802;

系统已更改。

SQL> update test set testcol='zzzz';

已更新2行。

SQL> commit
  2  ;

提交完成。

SQL> alter system dump datafile 1 block 56802;

系统已更改。

SQL> update test set testcol='zzzz';

已更新2行。

SQL> alter system dump datafile 1 block 56802;

系统已更改。     

SQL>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~dump出来的

*** 2008-11-07 11:04:06.921
*** SERVICE NAME:(SYS$USERS) 2008-11-07 11:04:06.906
*** SESSION ID:(154.29) 2008-11-07 11:04:06.906
Start dump data blocks tsn: 0 file#: 1 minblk 56802 maxblk 56802
buffer tsn: 0 rdba: 0x0040dde2 (1/56802)
scn: 0x0000.0042ef7d seq: 0x01 flg: 0x02 tail: 0xef7d0601
frmt: 0x02 chkval: 0x0000 type: 0x06=trans data
Block header dump:  0x0040dde2
 Object id on Block? Y
 seg/obj: 0xd1fb  csc: 0x00.428554  itc: 2  flg: O  typ: 1 - DATA
     fsl: 0  fnx: 0x0 ver: 0x01
 
 Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0x0006.023.000002c3  0x008002ff.01b6.20  C---    0  scn 0x0000.00428550
0x02   0x0001.02f.000007c2  0x008011b6.02db.12  --U-    2  fsc 0x0000.0042ef7d~~~~~~~~~~~~~~~~~~~已经commit 第一次更新Z时候 旧值得UBA里值de;
 
data_block_dump,data header at 0x61c025c
===============
tsiz: 0x1fa0
hsiz: 0x1a
pbl: 0x061c025c
bdba: 0x0040dde2
     76543210
flag=--------
ntab=1
nrow=4
frre=0
fsbo=0x1a
fseo=0x1e8a
avsp=0x1f74
tosp=0x1f74
0xe:pti[0] nrow=4 offs=0
0x12:pri[0] sfll=1
0x14:pri[1] sfll=-1
0x16:pri[2] offs=0x1e8f
0x18:pri[3] offs=0x1e8a
block_row_dump:
tab 0, row 2, @0x1e8f
tl: 5 fb: --H-FL-- lb: 0x2  cc: 1
col  0: [ 1]  7a~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~第一次更新Z
tab 0, row 3, @0x1e8a
tl: 5 fb: --H-FL-- lb: 0x2  cc: 1
col  0: [ 1]  7a~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~第一次更新Z
end_of_block_dump
End dump data blocks tsn: 0 file#: 1 minblk 56802 maxblk 56802
*** 2008-11-07 11:04:21.562
Start dump data blocks tsn: 0 file#: 1 minblk 56802 maxblk 56802
buffer tsn: 0 rdba: 0x0040dde2 (1/56802)
scn: 0x0000.0042ef88 seq: 0x01 flg: 0x02 tail: 0xef880601
frmt: 0x02 chkval: 0x0000 type: 0x06=trans data
Block header dump:  0x0040dde2
 Object id on Block? Y
 seg/obj: 0xd1fb  csc: 0x00.42ef85  itc: 2  flg: O  typ: 1 - DATA
     fsl: 0  fnx: 0x0 ver: 0x01
 
 Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0x0007.027.00000263  0x008008ef.02cd.19  --U-    2  fsc 0x0000.0042ef88~~~第2次更新~zz时候 这个位置的 ITL被换出去了 放入最新更新已提交 uba里值Z 
0x02   0x0001.02f.000007c2  0x008011b6.02db.12  C---    0  scn 0x0000.0042ef7d~~~~~~~~~~~~~~~~~~~~~~~~~~~~原来更新Z时候的 已经变为C  uba里值de
 
data_block_dump,data header at 0x61c025c
===============
tsiz: 0x1fa0
hsiz: 0x1a
pbl: 0x061c025c
bdba: 0x0040dde2
     76543210
flag=--------
ntab=1
nrow=4
frre=0
fsbo=0x1a
fseo=0x1e7e
avsp=0x1f74
tosp=0x1f74
0xe:pti[0] nrow=4 offs=0
0x12:pri[0] sfll=1
0x14:pri[1] sfll=-1
0x16:pri[2] offs=0x1e84
0x18:pri[3] offs=0x1e7e
block_row_dump:
tab 0, row 2, @0x1e84
tl: 6 fb: --H-FL-- lb: 0x1  cc: 1
col  0: [ 2]  7a 7a
tab 0, row 3, @0x1e7e
tl: 6 fb: --H-FL-- lb: 0x1  cc: 1
col  0: [ 2]  7a 7a
end_of_block_dump
End dump data blocks tsn: 0 file#: 1 minblk 56802 maxblk 56802
Start dump data blocks tsn: 0 file#: 1 minblk 56802 maxblk 56802
buffer tsn: 0 rdba: 0x0040dde2 (1/56802)
scn: 0x0000.0042ef8d seq: 0x01 flg: 0x02 tail: 0xef8d0601
frmt: 0x02 chkval: 0x0000 type: 0x06=trans data
Block header dump:  0x0040dde2
 Object id on Block? Y
 seg/obj: 0xd1fb  csc: 0x00.42ef8b  itc: 2  flg: O  typ: 1 - DATA
     fsl: 0  fnx: 0x0 ver: 0x01
 
 Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0x0007.027.00000263  0x008008ef.02cd.19  C---    0  scn 0x0000.0042ef88~~~~~~~~~~~~~~~~~~~~~更新ZZ时候的 uba里值Z
0x02   0x0003.016.00000bd8  0x0080075b.07fa.28  --U-    2  fsc 0x0000.0042ef8d~~~~~~~~第一次更新Z的已经被换出去变为第3次更新ZZZZ~ UBA里值zz~~~并且已经commit
 
data_block_dump,data header at 0x61c025c
===============
tsiz: 0x1fa0
hsiz: 0x1a
pbl: 0x061c025c
bdba: 0x0040dde2
     76543210
flag=--------
ntab=1
nrow=4
frre=0
fsbo=0x1a
fseo=0x1e6e
avsp=0x1f74
tosp=0x1f74
0xe:pti[0] nrow=4 offs=0
0x12:pri[0] sfll=1
0x14:pri[1] sfll=-1
0x16:pri[2] offs=0x1e76
0x18:pri[3] offs=0x1e6e
block_row_dump:
tab 0, row 2, @0x1e76
tl: 8 fb: --H-FL-- lb: 0x2  cc: 1
col  0: [ 4]  7a 7a 7a 7a~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~zzzzz
tab 0, row 3, @0x1e6e
tl: 8 fb: --H-FL-- lb: 0x2  cc: 1
col  0: [ 4]  7a 7a 7a 7a~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~zzzzz
end_of_block_dump
End dump data blocks tsn: 0 file#: 1 minblk 56802 maxblk 56802
Start dump data blocks tsn: 0 file#: 1 minblk 56802 maxblk 56802
buffer tsn: 0 rdba: 0x0040dde2 (1/56802)
scn: 0x0000.0042ef90 seq: 0x02 flg: 0x00 tail: 0xef900602
frmt: 0x02 chkval: 0x0000 type: 0x06=trans data
Block header dump:  0x0040dde2
 Object id on Block? Y
 seg/obj: 0xd1fb  csc: 0x00.42ef90  itc: 2  flg: O  typ: 1 - DATA
     fsl: 0  fnx: 0x0 ver: 0x01
 
 Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0x0005.02b.000003c8  0x00800543.0213.20  ----    2  fsc 0x0000.00000000~~~~~~~~~~~~~~~~~~~~~~第4次更新还为ZZZZ但未提交,UBA里值第一次ZZZZ的
0x02   0x0003.016.00000bd8  0x0080075b.07fa.28  C---    0  scn 0x0000.0042ef8d~~~~~~~~~~~~~~~~~~~~~~第一次ZZZZ的变为了C,UBA值ZZ
 
data_block_dump,data header at 0x61c025c
===============
tsiz: 0x1fa0
hsiz: 0x1a
pbl: 0x061c025c
bdba: 0x0040dde2
     76543210
flag=--------
ntab=1
nrow=4
frre=0
fsbo=0x1a
fseo=0x1e6e
avsp=0x1f74
tosp=0x1f74
0xe:pti[0] nrow=4 offs=0
0x12:pri[0] sfll=1
0x14:pri[1] sfll=-1
0x16:pri[2] offs=0x1e76
0x18:pri[3] offs=0x1e6e
block_row_dump:
tab 0, row 2, @0x1e76
tl: 8 fb: --H-FL-- lb: 0x1  cc: 1
col  0: [ 4]  7a 7a 7a 7a
tab 0, row 3, @0x1e6e
tl: 8 fb: --H-FL-- lb: 0x1  cc: 1
col  0: [ 4]  7a 7a 7a 7a
end_of_block_dump
End dump data blocks tsn: 0 file#: 1 minblk 56802 maxblk 56802

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~问题来了若一个长时间查询~在还未更新Z时候开始~~当用到更新的这个块的时候,块中ITL 已经无以回滚段信息了 如何构建CR块

问题解决在于 在 undo中也存在 对ITL改变的记录~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~先根据最新的 UBA 0x00800543.0213.20  去找 未COMMIT的

SQL> variable file# number
SQL> variable blk# number
SQL> execute :file#:=dbms_utility.data_block_address_file(to_number('800543','xx
xxxx'));

PL/SQL 过程已成功完成。

SQL> execute :blk#:=dbms_utility.data_block_address_block(to_number('800543','xx
xxxx'));

PL/SQL 过程已成功完成。

SQL> print file#;

     FILE#
----------
         2

SQL> print blk#;

      BLK#
----------
      1347

SQL>

SQL> alter system dump datafile 2 block  1347;

系统已更改。


*-----------------------------
* Rec #0x1f  slt: 0x2b  objn: 53755(0x0000d1fb)  objd: 53755  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: 0x00800543.0213.1d ctl max scn: 0x0000.0042e921 prv tx scn: 0x0000.0042e95b
txn start scn: scn: 0x0000.0042ef90 logon user: 0
 prev brb: 8389945 prev bcl: 0
KDO undo record:
KTB Redo
op: 0x04  ver: 0x01 
op: L  itl: xid:  0x0007.027.00000263 uba: 0x008008ef.02cd.19~~~~~~~~~~~~~~~~~~~~~~~~~~这条记录着 更改ZZ时候的UBA~uba里值Z~还包括ZZ ITL槽中信息
                      flg: C---    lkc:  0     scn: 0x0000.0042ef88
KDO Op code: URP row dependencies Disabled
  xtype: XA flags: 0x00000000  bdba: 0x0040dde2  hdba: 0x0040dde1
itli: 1  ispac: 0  maxfr: 4863
tabn: 0 slot: 2(0x2) flag: 0x2c lock: 0 ckix: 6
ncol: 1 nnew: 1 size: 0
col  0: [ 4]  7a 7a 7a 7a~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~保存上一条 更新的ZZZZ
 
*-----------------------------
* Rec #0x20  slt: 0x2b  objn: 53755(0x0000d1fb)  objd: 53755  tblspc: 0(0x00000000)
*       Layer:  11 (Row)   opc: 1   rci 0x1f  
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: 0x00800543.0213.1f
KDO Op code: URP row dependencies Disabled
  xtype: XA flags: 0x00000000  bdba: 0x0040dde2  hdba: 0x0040dde1
itli: 1  ispac: 0  maxfr: 4863
tabn: 0 slot: 3(0x3) flag: 0x2c lock: 0 ckix: 6
ncol: 1 nnew: 1 size: 0
col  0: [ 4]  7a 7a 7a 7a~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~保存上一条 更新的ZZZZ
 
End dump data blocks tsn: 1 file#: 2 minblk 1347 maxblk 1347

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~等于替换这个块ITL槽信息的 UBA中记录上一个ITL 记录的信息


~~~~~~~~~~~~~~~~来看看 

0x02   0x0003.016.00000bd8  0x0080075b.07fa.28  C---    0  scn 0x0000.0042ef8d~~~~~~~~~~~~~~~~~~~~~~第一次ZZZZ的变为了C 这个没被换出去的ITL ,中uba 保存什么

 

SQL> execute :blk#:=dbms_utility.data_block_address_block(to_number('80075b','xx
xxxx'));

PL/SQL 过程已成功完成。

SQL> execute :file#:=dbms_utility.data_block_address_file(to_number('80075b','xx
xxxx'));

PL/SQL 过程已成功完成。

SQL> print file#

     FILE#
----------
         2

SQL> print blk#

      BLK#
----------
      1883


SQL> alter system dump datafile 2 block 1883;

系统已更改。

SQL>

 

 

* Rec #0x27  slt: 0x16  objn: 53755(0x0000d1fb)  objd: 53755  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: 0x0080075b.07fa.24 ctl max scn: 0x0000.0042e920 prv tx scn: 0x0000.0042e959
txn start scn: scn: 0x0000.0042ef8b logon user: 0
 prev brb: 8390488 prev bcl: 0
KDO undo record:
KTB Redo
op: 0x04  ver: 0x01 
op: L  itl: xid:  0x0001.02f.000007c2 uba: 0x008011b6.02db.12~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~保存第一个更新时候ITL ,Z的 uba
                      flg: C---    lkc:  0     scn: 0x0000.0042ef7d
KDO Op code: URP row dependencies Disabled
  xtype: XA flags: 0x00000000  bdba: 0x0040dde2  hdba: 0x0040dde1
itli: 2  ispac: 0  maxfr: 4863
tabn: 0 slot: 2(0x2) flag: 0x2c lock: 0 ckix: 6
ncol: 1 nnew: 1 size: -2
col  0: [ 2]  7a 7a~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~保存ZZ
 
*-----------------------------
* Rec #0x28  slt: 0x16  objn: 53755(0x0000d1fb)  objd: 53755  tblspc: 0(0x00000000)
*       Layer:  11 (Row)   opc: 1   rci 0x27  
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: 0x0080075b.07fa.27
KDO Op code: URP row dependencies Disabled
  xtype: XA flags: 0x00000000  bdba: 0x0040dde2  hdba: 0x0040dde1
itli: 2  ispac: 0  maxfr: 4863
tabn: 0 slot: 3(0x3) flag: 0x2c lock: 0 ckix: 6
ncol: 1 nnew: 1 size: -2
col  0: [ 2]  7a 7a~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~保存ZZ~~~~的

 


~~~假如有一个长时间查询是 更新块之前 开始的(未更新Z时候)查到这个块时候~根据 uba找到UNDO BLK 根据里面信息构造CR块~~~一点点 回滚直到滚到查询SCN大于找到块的SCN


先找到

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12020513/viewspace-607609/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-06-26

  • 博文量
    182
  • 访问量
    427867