Find the sql_text using ospid

Find top pids of oracle user
$top -u oracle

Enter the os pid and find the sql id 

select sid, sql_id from v$session s, v$process p
where s.paddr = p.addr
and p.spid = &OS_PID;

Enter the sql_id to find the sql_text

set long 1000
set pages 1000 lines 1000
col sql_text for a100
select sql_text
from v$sql
where sql_id = ‘&sql_id’;

  • January 21, 2019 | 16 views
  • Comments