本文详细介绍了Oracle回滚段的Update,Select,Alter操作。
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 XIDUSNXIDSLOT XIDSQN UBAFIL UBABLKUBAREC 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 指回滚段中记录的最近的未提交变更的开始之处,及最后一次更改之处。

