查询oracle被锁的表及其如何释放

查询数据库中哪些表被锁定的sql语句

SELECT object_name, machine, s.sid, s.serial#

FROM gv$locked_object l, dba_objects o, gv$session s

WHERE l.object_id = o.object_id

AND l.session_id = s.sid;

--释放SESSION SQL:

--alter system kill session ‘sid, serial#‘;

ALTER system kill session ‘23, 1647‘;

时间: 2024-10-11 21:38:41

查询oracle被锁的表及其如何释放的相关文章

查看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; 查到的都是被锁的表 SELECT * FROM v$session where sid = xxx; 查到 serial# 最后alter system kill session 'sid,serial#';  关闭锁

解除Oracle被锁的表

1.开一个会话session1 SQL>select sid from v$mystat where rownum=1; SID 158 SQL>create table t(x int primary key); table created SQL>insert into t values(1); commit; SQL>update t1 set    t=10 where  x=1; 2.再开一个会话 SQL>select sid from v$mystat where

查询oracle数据中所有表的大小

select t.bytes,TO_CHAR((t.bytes)/(1024*1024),'999G999D999'), t.* from sys.dba_segments t where t.owner='xxxxx' order by t.bytes desc

Oracle的锁表与解锁

Oracle的锁表与解锁 SELECT /*+ rule */ s.username, decode(l.type,'TM','TABLE LOCK', 'TX','ROW LOCK', NULL) LOCK_LEVEL, o.owner,o.object_name,o.object_type, s.sid,s.serial#,s.terminal,s.machine,s.program,s.osuser FROM v$session s,v$lock l,dba_objects o WHERE

从浅到深掌握Oracle的锁

1.分别模拟insert,update和delete造成阻塞的示例,并对v$lock中的相应的信息进行说明,给 出SQL演示. Insert示例 会话1:SQL> select * from t1;        ID         1         2         3         4 SQL> alter table t1 add primary key(id);表已更改. SQL> select * from v$lock where type in ('TX','TM'

Oracle查询被锁的表及进程的方法

Oracle查询可以有多种方法,下面为您介绍的是如何Oracle查询被锁的表及Oracle查询连接的进程的方法,希望对您能够有所帮助. 一.查看被锁的表 select p.spid,a.serial#, 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

ORACLE查询数据库的锁表情况

  查询数据库的锁表情况语句如下: SELECT p.spid,a.serial#, 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 如果表因为某些情况出现死

查询Oracle锁表和解决方法

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

Oracle数据库锁表查询

--查看数据库最大连接数 select value from v$parameter where name = 'processes'; --更改数据库连接数 alter system set processes = 3000 scope = spfile; --查看被锁的表 select b.owner,b.object_name,a.session_id,a.locked_mode from v$locked_object a,dba_objects b where b.object_id