|
Re: find the sql query from a process id [message #56756 is a reply to message #56744] |
Tue, 22 April 2003 11:22 |
Michel Bartov
Messages: 35 Registered: February 2003
|
Member |
|
|
I posted a GUI Tool to manage and monitor the Oracle database. One of the many functions allows you to display all sessions including Unix process id. You click on the desired session to display its current SQL. The link is http://wwww.barsoft.net/
Or you can try:
Run this query to get the SID (476 is your unix process id).
SELECT a.sid
from v$session a, v$process b
where b.spid=476 and a.paddr = b.addr;
Then run this query to get the SQL (13 is the SID)
SELECT sql_text
from v$sqltext
where (address, hash_value) = (select sql_address, sql_hash_value
from v$session
where sid = 13)
or (address, hash_value) = (select prev_sql_addr, prev_hash_value
from v$session
where sid = 13)
order by piece;
This SQL was yanked from the tool.
|
|
|
|