用oracle的job定时调用存储过程,如存储过程陷入死循环或其他原因导致,job的状态是一直运行。这时,手动调用存储过程,由于锁表的原因,存储过程也会执行不下去。此时,需要先停掉job,命令如下:BEGIN dbms_scheduler.stop_job(job_name => 'GETHOLDS');END;
如存储过程还是执行不了,需要检查一下存储过程的表是否被进程占用而被锁住了,找到该进程并杀掉:
select sess.sid,
sess.serial#,
lo.oracle_username,
lo.os_user_name,
ao.object_name,
lo.locked_mode
from v$locked_object lo,
dba_objects ao,
v$session sess
where ao.object_id = lo.object_id and lo.session_id = sess.sid;
alter system kill session '738,1429';