重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
查询锁表:SELECT l.session_id sid,
创新互联主要从事成都网站制作、网站设计、网页设计、企业做网站、公司建网站等业务。立足成都服务南乐,10多年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:13518219792
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 ORDER BY sid,
s.serial#;
解锁:ALTER system KILL session 'sid,serial#';
查询锁住原因:SELECT b.sid oracleID,b.username 登录Oracle用户名,b.serial#,spid 操作系统ID,paddr,
sql_text 正在执行的SQL,b.machine 计算机名 FROM v$process a, v$session b, v$sqlarea c
WHERE a.addr = b.paddr AND b.sql_hash_value = c.hash_value and b.USERNAME='FKPHIS24';
在对指定表做append操作,其他再做truncate时候,会产生锁表,如下验证步骤,
1、创建测试表,
create table test_lock(id number, value varchar2(200));
2、执行append语句;并且不做提交,insert /*+append*/ into test_lock values(1,1);
3、再次执行清表语句,truncate table test_lock;报锁表错误,
4、查看锁表语句,发现被锁表,
select b.object_name, t.*
from v$locked_object t, user_objects b
where t.object_id = b.object_id
查询锁表
select object_name, machine, s.sid, s.serial#
from v$locked_object l, dba_objects o, v$session s
where l.object_id = o.object_id
and l.session_id = s.sid;
解表
ALTER system kill session 'sid, serial#';
ALTER system kill session '256, 34034';