SQL> select * from v$mystat where rownum<2;
SID STATISTIC# VALUE
---------- ---------- ----------
1996 0 0
SQL> select count(*), USERNAME from v$session group by username;
COUNT(*) USERNAME
---------- ------------------------------
25
13 CZCB
1 SYS
----之前执行的SQL
SQL> select sql_text
from v$sqlarea
where (address, hash_value) in
(select prev_sql_addr, prev_hash_value
from v$session
where sid = '1996')
2 3 4 5 6 7 ;
SQL_TEXT
--------------------------------------------------------------------------------
select count(*), USERNAME from v$session group by username
----正在执行的SQL
SQL> select sql_text
from v$sqlarea
where (address, hash_value) in
(select SQL_ADDRESS, SQL_HASH_VALUE
from v$session
where sid = '1996'); 2 3 4 5 6
no rows selected
测试2:
SQL> select count(*) from T_PM_ACCT_DTL_AF;
SQL> select sql_text
from v$sqlarea
where (address, hash_value) in
(select prev_sql_addr, prev_hash_value
from v$session
where sid = '1996')
2 3 4 5 6 7 ;
SQL_TEXT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
select sql_text from v$sqlarea where (address, hash_value) in (select SQL_ADDRESS, SQL_HASH_VALUE from v$session where sid = '199
6')
SQL> select sql_text
from v$sqlarea
where (address, hash_value) in
(select SQL_ADDRESS, SQL_HASH_VALUE
from v$session
where sid = '1996'); 2 3 4 5 6
SQL_TEXT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
select count(*) from T_PM_ACCT_DTL_AF