ITPub博客

首页 > Linux操作系统 > Linux操作系统 > oracle回滚段学习

oracle回滚段学习

原创 Linux操作系统 作者:junnior 时间:2008-08-25 09:20:22 0 删除 编辑
Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4 1、Update一条记录

update test2 t set t.a=17111 where t.b=17286

 

2、在v$transaction,v$session视图中可查询到相关事物信息,两个视图通过v$session.taddr=v$transaction.addr(Address of the transaction state object)相关联。

查询出该事物6号回滚段(xidusn)27号事务槽(xidslot)中

select t.XIDUSN,t.XIDSLOT,t.XIDSQN,t.UBAFIL,t.UBABLK,t.UBAREC from v$transaction t

XIDUSN XIDSLOT      XIDSQN       UBAFIL  UBABLK UBAREC

1     6           27           2616                2        489                   89

 

3、查询v$rollname视图获得回滚段名称,usn列对应回滚段号

select * from v$rollname r where r.usn=6

 

4、转储回滚段头信息

Alter system dump undo header’ _SYSSMU6$’

index  state cflags  wrap#    uel         scn            dba            parent-xid    nub     stmt_num

0x1b 10 0x80 0x0a38 0x0002 0x0000.002ad486 0x008001e9 0x0000.000.00000000  0x00000001   0x00000000

 

5、转储前镜像信息100000000000000111101001

通过dba(data block address)字段得到该事务的前镜像数据块地址。

0x008001e9  转化为二进制0000 0000 1000 0000 0000 0001 1110 1001

该地址有10位文件号和22位数据块组成

得到该dba的文件号2 数据块号489与回滚段中UBAFIL(Undo block address (UBA) filenum),UBABLK(UBA block number)相同

 

6、转储文件号2 数据块号489中信息

alter system dump datafile 2 block 489;

irb: 0x5f  指回滚段中记录的最近的未提交变更的开始之处,及最后一次更改之处。

rci:该参数代表的是同一事务中的关联修改。回滚时根据这个数值找到下次回滚之处。

col  0: [ 4]  c3 03 18 2e 记录的就是前置信息。

 

由于test2表中的A字段是索引,所以回滚段中记录的test2的回滚信息和索引的回滚信息。

索引:

*-----------------------------

* Rec #0x5f  slt: 0x1b  objn: 30454(0x000076f6)  objd: 30454  tblspc: 5(0x00000005)

*       Layer:  10 (Index)   opc: 22   rci 0x5e  

Undo type:  Regular undo   Last buffer split:  No

Temp Object:  No

Tablespace Undo:  No

rdba: 0x00000000

*-----------------------------

index undo for leaf key operations

KTB Redo

op: 0x02  ver: 0x01 

op: C  uba: 0x008001e9.00ee.5c

Dump kdilk : itl=2, kdxlkflg=0x1 sdc=5216369 indexid=0x1404c0b block=0x01404c3e

purge leaf row

key :(17):  04 c3 02 48 0e 04 c3 03 18 2e 06 01 40 4b 34 00 04

表数据:

*-----------------------------

* Rec #0x5d  slt: 0x1b  objn: 30449(0x000076f1)  objd: 30449  tblspc: 5(0x00000005)

*       Layer:  11 (Row)   opc: 1   rci 0x5c  

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: 0x008001e9.00ee.5a

KDO Op code: URP row dependencies Disabled

  xtype: XA  bdba: 0x01404b34  hdba: 0x01404b33

itli: 2  ispac: 0  maxfr: 4858

tabn: 0 slot: 4(0x4) flag: 0x2c lock: 0 ckix: 5

ncol: 3 nnew: 1 size: 0

col  0: [ 4]  c3 03 18 2e

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

下一篇: 重建索引
请登录后发表评论 登录
全部评论

注册时间:2008-08-21

  • 博文量
    6
  • 访问量
    11123