Jump to Navigation

267 - Show running SQLs

If you want to know the running SQLs at that moment, the commands are useful.

SQL> col USERNAME format a15
SQL> col MACHINE  format a10
SQL> set lin 500
SQL> set pagesize 20000

SQL> select a.username, a.sid, a.serial#, a.machine, b.sql_text from v$session a, v$sqltext b where a.sql_address = b.address and a.sql_hash_value = b.hash_value and b.piece = 0 and a.username is not null and a.status = 'ACTIVE' order by a.username, a.sid, b.piece;

 

SQL> select a.sid from v$session a, v$sqltext b where a.sql_address = b.address and a.sql_hash_value = b.hash_value and b.piece = 0 and a.username is not null and a.status = 'ACTIVE' group by a.sid;

 

Oracle:


Main menu 2

Story | by Dr. Radut