sql query from spid [message #379240] |
Mon, 05 January 2009 11:54  |
varunvir
Messages: 389 Registered: November 2007
|
Senior Member |
|
|
Hi Experts,
I have taken the value of spid of query using
high cpu from Top command.Can you please tell me how
I can get the sql statement from spid.
Regards,
Varun Punj
|
|
|
|
Re: sql query from spid [message #379266 is a reply to message #379241] |
Mon, 05 January 2009 14:07   |
varunvir
Messages: 389 Registered: November 2007
|
Senior Member |
|
|
Hi Michel,
I get the data with following query:-
select * from v$process b,v$session a where a.process=b.spid and a.process='8770';
Now how can I join it with v$sql to get the sql statement.
Regards,
Varun Punj,
|
|
|
|
Re: sql query from spid [message #379453 is a reply to message #379316] |
Tue, 06 January 2009 10:13  |
varunvir
Messages: 389 Registered: November 2007
|
Senior Member |
|
|
Thanks Michel.
I am writing the exact query to get sql statement with high cpu usage:-
select sql_text,sql_fulltext from v$sql where sql_id in(SELECT A.SQL_ID FROM V$SESSION A,V$PROCESS B
WHERE A.PADDR=B.ADDR AND B.SPID='6023');
Regards,
Varun Punj,
[Updated on: Tue, 06 January 2009 10:31] by Moderator Report message to a moderator
|
|
|