session 一:
SQL> update emp set ename='rhys' where empno=7369;
更新一条语句,但不commit。
session 二:
查询v$transaction可以目前有一个激活的事务,使用undo segment为5,slot为24,sequence number为1048
SQL> select xidusn,xidslot,xidsqn from v$transaction;
XIDUSN XIDSLOT XIDSQN
---------- ---------- ----------
5 24 1048
SQL>
在v$lock视图中查看发现tx锁的id1为327704,id2为1048
SQL> select sid,type,id1,id2,lmode,request,ctime,block from v$lock where lmode=6;
SID TYPE ID1 ID2 LMODE REQUEST CTIME BLOCK
---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
1 TX 327704 1048 6 0 1213 0
7 KD 0 0 6 0 1415 0
11 RT 1 0 6 0 1420 0
查看tx锁的id1和id2内容
SQL> select type,name,id1_tag,id2_tag,is_user,description from v$lock_type where type='TX';
TYPE NAME ID1_TAG ID2_TAG IS_ DESCRIPTION
---------- -------------------- ------------------------------ ------------------------------ --- ----------------------------------------
TX Transaction usn<<16 | slot sequence YES Lock held by a transaction to allow othe
r transactions to wait for it
其实在v$lock中显示的是decimal rbs @slot,换算为hex为:0xaaaabbbb,前4为usn,后4为slot,不足则补零。
eg:
327704换算16进制为0x00050018,前面4为0005也就是usn为5,后四位为:0018换算为10进制为:24
That's all !