oracle查看undo表位置,Oracle 通过undo块查看事务信息

数据库版本:

Oracle 11.2.0.3 RAC

实验目的:

通过undo块查看Oracle事务信息

实验细节:

1开始一个事务

SQL> select * from t1;

ID NAME

---------- ------------------------------

1 ycr

2 zhy

3 wya

5 lj

4 zhb

2 mk

2 cc

SQL> update t1 set id=6 where name='cc';

1 row updated.

此事务不要commit或者rollback。

2查看事务信息

a)查看session号:

SQL> select sid from v$mystat where rownum=1;

SID

----------

27

b)获取undo槽位等信息:

SQL> select xidusn,xidslot,xidsqn from V$TRANSACTION t,v$session s where s.sid=27 and s.taddr=t.addr;

XIDUSN    XIDSLOT     XIDSQN

---------- ---------- ----------

10         26       1741

SQL> select sid,trunc(id1/65536) usn,mod(id1,65536) slot,id2 wrap,lmode from v$lock where type='TX' and sid='27';

SID        USN       SLOT       WRAP      LMODE

---------- ---------- ---------- ---------- ----------

27         10         26       1741          6

其中

Column Description

XIDUSNUndo segment number

XIDSLOTSlot number

XIDSQNSequence number

3根据查询到的信息找到undo块:

a)查看undo块头位置

SQL> clear columns

columns cleared

SQL> col name for a40

SQL> select * from v$rollname where usn=10;

USN NAME

---------- ----------------------------------------

10 _SYSSMU10_3271578125$

b)dump undo块

alter system dump undo header"_SYSSMU10_3271578125$";

select * from v$diag_info where name='Default Trace File';

/u01/app/oracle/diag/rdbms/irac/IRAC1/trace/IRAC1_ora_4444.trc

c)查看undo块头信息:

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

------------------------------------------------------------------------------------------------

0x19    9    0x00  0x06d0  0x0012  0x0000.00b6ed00  0x00c00382  0x0000.000.00000000  0x00000001   0x00000000  1509426012

0x1a   10    0x80  0x06cd  0x0004  0x0000.00b6f712  0x00c00397  0x0000.000.00000000  0x00000001   0x00000000  0

0x1b    9    0x00  0x06ce  0x0002  0x0000.00b6ed4f  0x00c00397  0x0000.000.00000000  0x00000003   0x00000000  1509426012

可以看到找到了对应的事务

state为10说明为活动事务,warp#为0x06cd同v$lock查到的信息相同,换算成10进制为1741。

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

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值