1、查看哪些對象被鎖 2、下麵的語句用來殺死一個進程: 3、再一次查詢目前鎖定的對象,若發現以上方法不能解除鎖定的表,則用以下方法: (1)執行下麵的語句獲得進程(線程)號: (2)在OS上kill掉這個進程 Linux: Windows(unix也適用)用orakill殺死線程,orakill是o ...
1、查看哪些對象被鎖
select 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 s.sid = l.sid
and o.object_id = l.id1
and s.username is not null;
2、下麵的語句用來殺死一個進程:
alter system kill session '33,456'; ---其中33,456分別是上面查詢出的sid,serial#
3、再一次查詢目前鎖定的對象,若發現以上方法不能解除鎖定的表,則用以下方法:
(1)執行下麵的語句獲得進程(線程)號:
select spid, osuser, s.program from v$session s, v$process p where s.paddr = p.addr and s.sid = 33; ---33是上面的sid
(2)在OS上kill掉這個進程
Linux:
kill -9 3333 (3333為進程號)
Windows(unix也適用)用orakill殺死線程,orakill是oracle提供的一個可執行命令,語法為: orakill sid thread
sid:表示要殺死的進程屬於的實例名 thread:是要殺掉的線程號,即第3步查詢出的spid。
例:
c:>orakill orcl 3333