记一次oracle事务被锁,进程杀不掉 User session ID does not exist
首先
truncate table *;
报错:
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
查看当前锁住的sid:
select l.session_id,o.owner,o.object_name from v$locked_object l,dba_objects o where l.object_id=o.object_id;
根据session_id查看serial#
SELECT sid, serial#, username, oSUSEr, terminal,program ,action, prev_exec_start FROM v$session where sid = 619;
杀掉占用资源: alter system kill session 'sid,serial#';
alter system kill session '619,29746';
如果出现了 ORA-00030: User session ID does not exist
那么需要通过sid查看系统进程号psid
select spid, osuser, s.program from v$session s, v$process p where s.paddr = p.addr and s.sid =619;
在oracle所在的服务器查看psid
ps -ef | grep 23421 oracle 23421 1 0 Dec21 ? 00:00:00 oracle10g (LOCAL=NO) 这样的local=no就是可以杀掉的,如果进程中有local=yes
执行kill命令
kill -9 23421