存储过程解锁语法如下,前提是要有dba权限,不然会提示表或者视图不存在。
--1.查找用户user下的被锁定的存储过程
select * from V$DB_OBJECT_CACHE where owner='user' AND LOCKS!='0';
--2.通过查出来的存储过程名查找sid
select sid,sql_text from v$open_cursor where UPPER(sql_text) like '%procedure_name%';
SELECT spid
FROM V$DB_OBJECT_CACHE OC,
V$OBJECT_DEPENDENCY OD,
DBA_KGLLOCK W,
V$SESSION S,
V$PROCESS P
WHERE OD.TO_OWNER = OC.OWNER
AND OD.TO_NAME = OC.NAME
AND OD.TO_ADDRESS = W.KGLLKHDL
AND W.KGLLKUSE = S.SADDR
AND P.ADDR = S.PADDR
AND OC.NAME = 'procedure_name';
--3.通过sid查找serial#
select sid,serial#,paddr from v$session where sid='1212';--983 1212
--4.杀死会话参数为查出来的sid和serial#
alter system kill session '1212,29203' immediate;