Oracle 查找被锁的表并解锁

Lamaara ·
更新时间:2024-11-14
· 540 次阅读

1、查看被锁的表

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;

2、查看那个用户那个进程照成死锁

select b.username, b.sid, b.serial#, b.logon_time, o.OBJECT_NAME from v$locked_object a, v$session b , dba_objects o where a.session_id = b.sid and a.OBJECT_ID = o.OBJECT_ID order by b.logon_time;

3、杀掉进程 sid,serial#

alter system kill session '2201,24581';

4、查看连接的进程 

SELECT sid, serial#, username, osuser FROM v$session where username = 'zss';

5、查出锁定表的sid, serial#,os_user_name, machine_name, terminal,锁的type,mode

SELECT s.sid, s.serial#, s.username, s.schemaname, s.osuser, s.process, s.machine, s.terminal, s.logon_time, l.type FROM v$session s, v$lock l WHERE s.sid = l.sid AND s.username IS NOT NULL ORDER BY sid; 技术大咖秀 原创文章 157获赞 166访问量 7万+ 关注 私信 展开阅读全文
作者:技术大咖秀



解锁 Oracle

需要 登录 后方可回复, 如果你还没有账号请 注册新账号