--ORACLE表被鎖原因:具體操作某一個FORM界面,,或者后臺數(shù)據(jù)庫操作某一個表時發(fā)現(xiàn)一直出于"假死"狀態(tài), --可能是該表被某一用戶鎖定,,導(dǎo)致其他用戶無法繼續(xù)操作 --查詢被鎖的表 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; --查看是哪個session引起的 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; --殺掉對應(yīng)進(jìn)程即解鎖 alter system kill session '866,20840' --其中866是sid 20840是serial#
--解鎖表 ==>查看對應(yīng)的鎖定表找到s.sid s.serial# 兩個字段的值 --權(quán)限 system/oracle SELECT /*+ rule */ 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 l.sid = s.sid AND l.id1 = o.object_id(+) AND s.username is NOT Null and s.OSUSER IN ('用戶名') --然后殺死進(jìn)程解鎖 alter system kill session 's.sid,s.serial#' alter system kill session '429,55473'; |
|