Home » RDBMS Server » Server Administration » find the sql query from a process id
find the sql query from a process id [message #56744] Tue, 22 April 2003 05:28 Go to next message
ravi_kiran99
Messages: 8
Registered: December 2002
Junior Member
Hi,
Can anyone tell me , how to find out the actual sql beiong executed on the database, from the process id on a solaris machine.

Thanks
Ravi
Re: find the sql query from a process id [message #56756 is a reply to message #56744] Tue, 22 April 2003 11:22 Go to previous messageGo to next message
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.
Re: find the sql query from a process id [message #56760 is a reply to message #56744] Tue, 22 April 2003 13:46 Go to previous message
ravi_kiran99
Messages: 8
Registered: December 2002
Junior Member
Cool thanks.. That was very helpful
Previous Topic: dedicated cpu
Next Topic: v$transaction: The noundo column
Goto Forum:
  


Current Time: Fri Sep 20 09:52:54 CDT 2024