首页 > 代码库 > Oracle查询锁表和解锁

Oracle查询锁表和解锁

1.查询是否锁表

SELECT l.session_id sid, s.serial#, l.locked_mode,l.oracle_username,  l.os_user_name,s.machine, s.terminal, o.object_name, s.logon_time  FROM v$locked_object l, all_objects o, v$session s  WHERE l.object_id = o.object_id  AND l.session_id = s.sid    and oracle_username = 用户名   --用户名要大写  ORDER BY sid, s.serial# 

2.解锁

ALTER system KILL session SID,serial#

 

Oracle查询锁表和解锁