News
Perth, Australia
+ (61) 417713124
prosolutions@gavinsoorma.com

Script – Find SQL being executed by a OS Process ID (PID)

  • Posted by Gavin Soorma
  • On July 1, 2009
  • 1 Comments
prompt "Please Enter The UNIX Process ID"
set pagesize 50000
set linesize 30000
set long 500000
set head off
select
s.username su,
substr(sa.sql_text,1,540) txt
from v$process p,
v$session s,
v$sqlarea sa
where p.addr=s.paddr
and s.username is not null
and s.sql_address=sa.address(+)
and s.sql_hash_value=sa.hash_value(+)
and spid=&SPID;
 

1 Comments

Girisha
  • Mar 6 2011
Thanks is to found out the sql statement using this query

Leave Reply

Your email address will not be published. Required fields are marked *