PL/SQL中记录被另一个用户锁住的原因及处理方法
?
注意之前的SQL查出来的是持有锁的所有会话,也可以加一句,查出锁定指定对象的会话
select Distinct 'alter system kill session '||chr(39)||b.sid||','||b.serial#||chr(39)||';'
As cmd,b.username,b.logon_time
from v$locked_object a,v$session b
where a.session_id=b.sid
AND a.object_id =
(select object_id from dba_objects
?where object_name = 'table_name'?
and owner = 'xxx'? and rownum = 1)
order by b.logon_time
?
table_name为这条记录所在的表,xxx为表的所有者(即这个表是属于哪个数据库用户的,如scott或是其他)。
?
?
http://wenwen.soso.com/z/q279366883.htm
?