欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

oracle中查找锁住的表并解锁

程序员文章站 2022-06-17 23:52:56
...

--查出所有被锁住的表 select b.owner TABLEOWNER, b.object_name TABLENAME, c.OSUSER LOCKBY, c.USERNAME LOGINID, c.sid SID, c.SERIAL# SERIAL from v$locked_object a,dba_objects b, v$session c where b.object_id = a.object_id AND a.SESSION_ID =c

--查出所有被锁住的表
select b.owner TABLEOWNER, b.object_name TABLENAME, c.OSUSER LOCKBY, c.USERNAME LOGINID, c.sid SID, c.SERIAL# SERIAL
from v$locked_object a,dba_objects b, v$session c
where b.object_id = a.object_id AND a.SESSION_ID =c.sid;

--通过SID, SERIAL解锁
alter system kill session 'SID, SERIAL'
;

锁表

lock table BSZ1_W_DOT010_PB01T252_wk2 in exclusive mode;


conn sys/orcl AS SYSDBA

Alter user hr identified by hr account unlock;

alter user scott account unlock;