Cheeky Cockatoo

Life Advice and Stories, Travel, Oracle Tech, Good Food and More

find_PID.sql

Download Script

/*  select_sqla.sql                           */

/*  undefine enter_shadow_proc			*/

PROMPT Enter user id as 'USERID_CC' (CC=Country Code; US, UK, AU)

undefine enter_user_id

 select s.sid,
         s.program,
         s.osuser,
         s.username,
         s.status,
         a.sql_text,
	 p.spid
    from v$process p,
         v$session s,
         v$sqlarea a
   where s.username = '&&enter_user_id'
     and p.addr = s.paddr
     and s.sql_address = a.address (+);