首页 > 代码库 > 锁(下)

锁(下)

(2)解锁方法
alter system kill session ‘878,1773‘;    /*878为SID,1773为SERIAL#*/


select /*+ rule */ s.username,
     decode(l.type,‘tm‘,‘table lock‘,‘tx‘,‘row lock‘,null) lock_level,
      o.owner,o.object_name,o.object_type,
      s.sid,s.serial#,s.terminal,s.machine,s.program,s.osuser
from v$session s,v$lock l,dba_objects o
where l.sid = s.sid
and l.id1 = o.object_id(+)
and s.osuser = ‘okf55657‘ and s.username = ‘lbimk_babilon‘
and s.username is not null

select b.owner,b.object_name,a.session_id,a.locked_mode   from v$locked_object a,dba_objects b   where b.object_id = a.object_id;

select b.username,b.sid,b.serial#,logon_time   from v$locked_object a,v$session b   where a.session_id = b.sid
and a.session_id = 745;

alter system kill session‘767,19132‘;


select a.sid,a.serial#,c.object_name,a.sql_id
from v$session a,v$locked_object b,all_objects c
where a.sid=b.session_id
and b.object_id=c.object_id;

select spid from v$process
where addr = (
select paddr from v$session where sid = 767
);

找到对应的spid后,在后台用命令kill -9 spid杀掉OS进程。

锁(下)