Oracle 杀死锁进程
Oracle查询被锁的表:
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 order by b.logon_time;
查看连接的进程:
SELECT sid, serial#, username, osuser FROM v$session;
在系统上杀死进程:
先查出进程的sid号,然后根据SID号查出SPID(系统进程)
select spid, osuser, s.program from v$session s,v$process p where s.paddr=p.addr and s.sid=24;
--杀掉进程 sid,serial#
alter system kill session'210,11562';
涉及到的表:
SELECT * FROM v$lock;
SELECT * FROM v$sqlarea;
SELECT * FROM v$session;
SELECT * FROM v$process ;
SELECT * FROM v$locked_object;
SELECT * FROM all_objects;
SELECT * FROM v$session_wait;