Oracle查看正在执行的存储过程

正在执行的存储过程

select owner,name from v$db_object_cache where type like '%PROCE%' and locks >0 and pins >0;

 

正在执行的sql

select a.program, b.spid, c.sql_text,c.SQL_ID
from v$session a, v$process b, v$sqlarea c
where a.paddr = b.addr
and a.sql_hash_value = c.hash_value
and a.username is not null

 

查找正在执行的存储过程的sid

   select   b.sid,b.SERIAL#,a.OBJECT, 'alter system kill session   ' || '''' || b.sid || ',' ||b.SERIAL# ||  ''';' kill_command
               from   SYS.V_$ACCESS a, SYS.V_$session b
               where    a.type = 'PROCEDURE'
                  and   (a.OBJECT like upper('%存储过程名%') or
                            a.OBJECT like lower('%存储过程名%'))
                 and a.sid = b.sid
                 and b.status = 'ACTIVE';

posted @ 2019-10-16 21:01  不会游泳的鱼丶  阅读(12519)  评论(0编辑  收藏  举报