Home » RDBMS Server » Server Administration » sql query from spid (10.2.0.2)
sql query from spid [message #379240] Mon, 05 January 2009 11:54 Go to next message
varunvir
Messages: 363
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 #379241 is a reply to message #379240] Mon, 05 January 2009 11:56 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
v$session
v$process

Regards
Michel
Re: sql query from spid [message #379266 is a reply to message #379241] Mon, 05 January 2009 14:07 Go to previous messageGo to next message
varunvir
Messages: 363
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 #379316 is a reply to message #379266] Tue, 06 January 2009 00:58 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
With sql_id.

Regards
Michel
Re: sql query from spid [message #379453 is a reply to message #379316] Tue, 06 January 2009 10:13 Go to previous message
varunvir
Messages: 363
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

Previous Topic: Issues with Trace
Next Topic: alert log messages
Goto Forum:
  


Current Time: Sat Dec 10 20:44:36 CST 2016

Total time taken to generate the page: 0.11973 seconds