像之前遇到的分布式事务报错的问题,我们可能很想知道这个transaction对应的sql及user是什么,那怎么办呢?
我们先看看transaction id的组成:
4.10.878948
其中:4 = rbs#(回滚段编号) ,10 = slot#(事务槽编号), 878948 = wrap#(序号)
我们再看看v$transaction中的字段:
Column Datatype Description
———- ———– ——————-
XIDUSN NUMBER Undo segment number
XIDSLOT NUMBER Slot number
XIDSQN NUMBER Sequence number
这三个字段分别对应的就是transaction的第一,第二,第三个数字。那么我们就可以通过下面的语句查询到对应的sql及user:
- select e.sql_text, d.osuser,d.username
- from v$transaction c, v$session d, v$sqlarea e
- where d.taddr = c.addr and e.address = d.prev_sql_addr
- and c.xidusn = 4
- and c.xidslot =10
- and c.xidsqn = 878948;
当然前提是该transaction还能在v$transaction中查询到:)
No Comments
Be the first to comment on this entry.
Leave a comment
Fields in bold are required. Email addresses are never published or distributed.
Some HTML code is allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>URLs must be fully qualified (eg: http://www.dbifan.com),and all tags must be properly closed.
Line breaks and paragraphs are automatically converted.
Please keep comments relevant. Off-topic, offensive or inappropriate comments may be edited or removed.