--1、查看数据库锁,诊断锁的来源及类型:
SELECT OBJECT_ID, SESSION_ID, LOCKED_MODE FROM V$LOCKED_OBJECT;
--2、找出数据库的serial#,以备杀死:
SELECT T2.USERNAME, T2.SID, T2.SERIAL#, T2.LOGON_TIME
FROM V$LOCKED_OBJECT T1, V$SESSION T2
WHERE T1.SESSION_ID = T2.SID
ORDER BY T2.LOGON_TIME;
--3、杀死该session
alter system kill session 'sid,serial#' ps: sid ,serial# --为步骤2中查出来的值
--查询
select o.session_id sid,
s.serial#,
o.locked_mode,
o.oracle_username,
s.user#,
o.os_user_name,
s.machine,
s.terminal,
a.sql_text,
a.action
from v$sqlarea a, v$session s, v$locked_object o
where o.session_id = s.sid
and s.prev_sql_addr = a.address
order by sid, s.serial#;
Oracle中表被锁住及解锁方法
最新推荐文章于 2024-07-01 12:46:23 发布