Oracle锁表与解锁 对象锁与解锁
锁表与解锁
查看锁表进程SQL语句
select * from v$session t1, v$locked_object t2 where t1.sid = t2.SESSION_ID;
解锁
杀掉锁表进程:
记录下SID和serial# ,分别替换掉下面的1155,39095,即可解除锁表
alter system kill session '1155,39095';
对象锁与解锁
这里以包为PKG_ZLGL_BASEDATA为例
注意name为包或者存储过程等;
SELECT * FROM V$DB_OBJECT_CACHE WHERE name='PKG_ZLGL_BASEDATA' AND LOCKS!='0';
查看sid 注意object为包或者存储过程等;
SELECT SID from V$ACCESS WHERE object='PKG_ZLGL_BASEDATA';
查看查看SID和SERIAL# in后面的条件为上述查的sid
SELECT SID,SERIAL#,PADDR,STATUS FROM V$SESSION WHERE SID IN('283','343');
杀进程 实例如下: alter system kill session 'sid,SERIAL'
alter system kill session '283,50673'