查询引起了锁表的原因
select l.session_id sid,
s.serial#,
l.locked_mode,
l.oracle_username,
s.user#,
l.os_user_name,
s.machine,
s.terminal,
a.sql_text,
a.action
from v$sqlarea a, v$session s, v$locked_object l
where l.session_id = s.sid
and s.prev_sql_addr = a.address
order by sid, s.serial#;
查询被锁的表
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
查看是哪个session引起的
select b.username,b.sid,b.serial#,logon_time
from v$locked_object a,v$session b
where a.session_id = b.sid
order by b.logon_time
杀掉对应进程即解锁
alter system kill session '135,39751'; --其中135是第3步中查询的sid, 39751是serial#。
备注:执行以上查询的数据库用户必须拥有DBA权限,否则提示找不到表和视图。
标签:locked,object,中表,查询,session,sid,Oracle,id From: https://www.cnblogs.com/xfeiyun/p/17765218.html