当前位置:操作系统 > Unix/Linux >>

oralce中查询锁表记录以及解锁

oralce中查询锁表记录以及解锁
 
先查询那些表被锁定了
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;
查询出被锁定的表的 sid 和serial# 然后kill
select b.username,b.sid,b.serial#,logon_time 
from v$locked_object a,v$session b
where a.session_id = b.sid and sid in(
select a.SESSION_ID
from v$locked_object a,dba_objects b
where b.object_id = a.object_id) order by b.logon_time
解锁
alter system kill session '589,2693' immediate;(589 是sid,2693是serial)
另外作此操作的必须要有数据库管理的权限否则无法解锁。
 
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,