通过下面的语句查到回滚的事务:
select * from v$fast_start_transactions;
或者
select * from x$ktuxe where KTUXECFL='DEAD' AND KTUXESTA!='INACTIVE'
根据上面的语句,我们可以查到事务的undo的segment id(USN或者KTUXEUSN),undo的slot(SLT或者KTUXESLT),和undo的sequence(SEQ或者KTUXESQN)。
根据USN,我们可以查到undo segment:
select * from v$rollname where usn=xxx
根据上面的语句,我们可以dump出undo block:
alter system dump undo block "
如
alter system dump undo block "_SYSSMU33$" XID 33 56 7463;
然后根据dump出来的trace file,可以判断object number(objn)或者object id(objd)
cat xxx.trc |grep objn
* Rec #0x45 slt:0x1f objn:223312(0x00092c2a) objd:223312 tblspc:20(0x00000014)
* Rec #0x44 slt:0x1f objn:223312(0x00092c2a) objd:223312 tblspc:20(0x00000014)
* Rec #0x43 slt:0x1f objn:223312(0x00092c2a) objd:223312 tblspc:20(0x00000014)
* Rec #0x42 slt:0x1f objn:223312(0x00092c2a) objd:223312 tblspc:20(0x00000014)
* Rec #0x41 slt:0x1f objn:223312(0x00092c2a) objd:223312 tblspc:20(0x00000014)
* Rec #0x40 slt:0x1f objn:223312(0x00092c2a) objd:223312 tblspc:20(0x00000014)
* Rec #0x3f slt:0x1f objn:223312(0x00092c2a) objd:223312 tblspc:20(0x00000014)
...
此时,我们根据object id,可以在数据库里面找到回滚的object的对象:
select * from dba_objects where object_id='223312';