Home > Database > Mysql Tutorial > Oracle中表死锁的处理

Oracle中表死锁的处理

WBOY
Release: 2016-06-07 17:15:34
Original
1046 people have browsed it

在进行Oracle数据库管理的过程中,经常会出现数据表被用户的一些不合理操作而导致表被锁定的情况,以下主要介绍如何查找哪些表被哪

在进行Oracle数据库管理的过程中,经常会出现数据表被用户的一些不合理操作而导致表被锁定的情况,以下主要介绍如何查找哪些表被哪个用户所锁定,以及如何解除锁定:

1.查找被锁定的表:

select object_name,session_id,os_user_name,oracle_username,process,locked_mode,status

from v$locked_object l, all_objects a

where l.object_id=a.object_id;

Oracle中表死锁的处理

如果想知道具体是哪个进程阻塞了哪个进程,可用以下语句查看:

select username,v$lock.sid,trunc(id1/power(2,16)) rbs,bitand(id1,to_number('ffff','xxxx'))+0 slot,id2 seq,lmode,request from v$lock, v$session where v$lock.type = 'TX' and v$lock.sid = v$session.sid and v$session.username = 'CENTER' ;

select

(select username||':'||sid||':'||serial# from v$session where sid=a.sid) ||

' 阻塞了 ' ||

(select username ||':'||sid||':'||serial# from v$session where sid=b.sid)

from v$lock a, v$lock b

where a.block = 1

and b.request > 0

and a.id1 = b.id1

and a.id2 = b.id2;

Oracle中表死锁的处理

linux

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template