www.7671.net > orAClE判断表是否锁住

orAClE判断表是否锁住

oracle ebs操作某一个form界面,或者后台数据库操作某一个表时发现一直出于"假死"状态,可能是该表被某一用户锁定,导致其他用户无法继续操作复制代码 代码如下:--锁表查询sqlselect object_name, machine, s.sid, s.serial#from gv$

查看哪个表被锁select b.owner,b.object_name,a.session_id,a.locked_modefrom v$locked_object a,dba_objects bwhere b.object_id = a.object_id查看是哪个session引起的select b.username,b.sid,b.serial#,logon_timefrom v$locked_object a,v$session bwhere a.session_id = b.sid order by b.logon_time

oracle中查看表是否被锁 查看表是否被锁 SELECT /*+ rule*/ a.sid, b.owner, object_name, object_type FROM v$lock a, all_objects b WHERE TYPE = 'TM' and a.id1 = b.object_id; 查询出这个死锁进程在操作系统中的任务ID select spid, osuser, s.

Oracle数据库操作中,我们有时会用到锁表查询以及解锁和kill进程等操作,那么这些操作是怎么实现的呢?本文我们主要就介绍一下这部分内容.(1)锁表查询的代码有以下的形式:select count(*) from v$locked_object;select * from v$locked_

select b.username,b.sid,b.serial#,logon_timefrom v$locked_object a,v$session bwhere a.session_id = b.sid order by b.logon_time 解锁alter system kill session 'sid,SERIAL#';

--下面的语句用来查询哪些对象被锁select sid,serial#,username,SCHEMANAME,osuser,MACHINE,terminal,PROGRAM,owner,object_name,object_type,o.object_id from dba_objects o,v$locked_object l,v$session s where o.object_id=l.object_id and s.sid=l.session_id;

1、查看是否有锁表的sql代码如下:select 'blocker('||lb.sid||':'||sb.username||')-sql:'|| qb.sql_text blockers, 'waiter ('||lw.sid||':'||sw.username||')-sql:'|| qw.sql_text waiters from v$lock lb, v$lock lw, v$session sb, v$session sw, v$sql qb, v$sql qw where lb.sid

select * from V$locked_Object;就能看到那个object被锁了.如果想知道对象具体是什么,在关联一下user_objects就能知道了.

在对指定表做append操作,其他再做truncate时候,会产生锁表,如下验证步骤,1、创建测试表,create table test_lock(id number, value varchar2(200));2、执行append语句;并且不做提交,insert /*+append*/ into test_lock values(1,1);3、再次

查看被锁的表: select p.spid,c.object_name,b.session_id,b.oracle_username,b.os_user_name from v$process p,v$session a, v$locked_object b,all_objects c where p.addr=a.paddr and a.process=b.process and c.object_id=b.object_id 解锁: alter system kill session '146';(其中146为锁住的进程号)

友情链接:sbsy.net | beabigtree.com | dzrs.net | prpk.net | pxlt.net | 网站地图

All rights reserved Powered by www.7671.net

copyright ©right 2010-2021。
www.7671.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com