Search This Blog

Total Pageviews

Friday, 12 November 2010

Oracle os process (unix ) to Sql text

run top command on unix prompt. find out oracle os pid from top command

and run following Sql .

set linesize 200
col SID_serial format a15
select ses.sid||','||ses.SERIAL# SID_serial,sqa.SQL_TEXT SQL
from v$session ses, v$sqlarea sqa, v$process proc
where ses.paddr=proc.addr
and ses.sql_hash_value=sqa.hash_value
and proc.spid=&pid_sql;

prompt -- alter system kill session ' ' ;

1 comment:

Anuj Singh said...


set linesize 300
col kill for a15
col SQL for a50 wrap
select /* MYCONNECTION */ ''''||ses.sid ||','|| ses.serial#||'''' kill ,ses.sql_id,ses.prev_sql_id ,ses.prev_exec_start,sqa.SQL_TEXT SQL from v$session ses, v$sqlarea sqa, v$process proc
where ses.paddr=proc.addr
and ses.sql_hash_value=sqa.hash_value
and proc.spid=&pid_sql;

Oracle DBA

anuj blog Archive