oracle数据库几种锁模式

oracle有以下几种模式:
0:none
1:null 空
2:Row-S 行共享(RS):共享表锁,sub share
3:Row-X 行独占(RX):用于行的修改,sub exclusive
4:Share 共享锁(S):阻止其他DML操作,share
5:S/Row-X 共享行独占(SRX):阻止其他事务操作,share/sub exclusive
6:exclusive 独占(X):独立访问使用,exclusive

锁级别约高,影响的操作越多

(1)查询锁的SQL语句
col owner for a12
col object_name for a16
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
(2)查询锁的sid,serial
select t2.username,t2.sid,t2.serial#,t2.logon_time
from v$locked_object t1,v$session t2
where t1.session_id=t2.sid
order by t2.logon_time;
(3)杀掉长期没有释放的锁:
alter system kill session 'sid,serial#';

锁模式图:

 

不畏将来,不念过往,如此,安好。--vast desert
原文地址:https://www.cnblogs.com/damo-h/p/12564458.html