首先
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