1. 首先使用dba用户登录oracle库
2. 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;
3. 查看那个用户,那个进程造成的死锁
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;
4. 杀掉进程 sid,serial#
alter system kill session 'sid,serial#';
例如:
alter system kill session'1608,21221';
网友评论