Find current running SQL Queries in Oracle

Check the current running SQL Queries in Oracle

Check the current running SQL statements

set line 200 pages 200
select s.module,sql_text
from v$sqltext_with_newlines t,V$SESSION s
where t.address = s.sql_address
and t.hash_value = s.sql_hash_value
and s.status = 'ACTIVE'
and s.username is not null
order by s.sid,t.piece;

Find the Current SQL with SQL ID, Username and hash value , elapsed time, sql Text columns

set line 200 pages 200
col username for a20
select s.sid, s.username,optimizer_mode,hash_value,
address,cpu_time,elapsed_time,sql_text
from v$sqlarea q, v$session s
where s.sql_hash_value = q.hash_value
and s.sql_address = q.address
and s.username is not null;

Find SID and Serial# for the current SQL running

select s.sid,s.serial#,s.username,s.sql_id,q.sql_text
from v$sqlarea q ,v$session s
where s.sql_hash_value = q.hash_value
and s.sql_address = q.address
and s.username is not null;

Unknown's avatar

Author: SandeepSingh

Hi, I am working in IT industry with having more than 15 year of experience, worked as an Oracle DBA with a Company and handling different databases like Oracle, SQL Server , DB2 etc Worked as a Development and Database Administrator.

2 thoughts on “Find current running SQL Queries in Oracle”

Leave a Reply

Discover more from SmartTechWays - Innovative Solutions for Smart Businesses

Subscribe now to keep reading and get access to the full archive.

Continue reading