确实是这样:
select b.used_urec from v$session a,v$transaction b where a.saddr=b.ses_addr and a.sid=&1;
----------------------------------------------------------------------------------------------------
测试日志:
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------------------
fengwei OPEN
SQL> conn my_user/my_user
已连接。
SQL> create table test_transaction(id number,ads varchar2(20));
表已创建。
SQL> insert into test_transaction values(1,'1');
已创建 1 行。
SQL> insert into test_transaction values(2,'2');
已创建 1 行。
SQL> insert into test_transaction values(3,'3');
已创建 1 行。
SQL> insert into test_transaction values(4,'4');
已创建 1 行。
SQL> commit;
提交完成。
SQL> select start_time,start_scnb,used_ublk,used_urec,log_io,phy_io
2 from v$transaction;
未选定行
SQL> delete from test_transaction where id < 3;
已删除2行。
SQL> select start_time,start_scnb,used_ublk,used_urec,log_io,phy_io
2 from v$transaction;
START_TIME START_SCNB USED_UBLK USED_UREC LOG_IO PHY_IO
-------------------- ---------- ---------- ---------- ---------- ----------
12/02/10 18:44:18 479327 1 2 4 0
SQL> update test_transaction set ads='test' where id = 4;
已更新 1 行。
SQL> select start_time,start_scnb,used_ublk,used_urec,log_io,phy_io
2 from v$transaction;
START_TIME START_SCNB USED_UBLK USED_UREC LOG_IO PHY_IO
-------------------- ---------- ---------- ---------- ---------- ----------
12/02/10 18:44:18 479327 1 3 6 0
SQL> select distinct sid from v$mystat;
SID
----------
157
SQL> select a.sid from v$session a,v$transaction b
2 where a.saddr=b.ses_addr;
SID
----------
157
SQL> commit;
提交完成。
SQL> select start_time,start_scnb,used_ublk,used_urec,log_io,phy_io
2 from v$transaction;
未选定行
SQL> spool off;