数据锁表及解锁
程序员文章站
2022-03-25 21:13:45
...
--锁表查询SQLSELECT 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';
--研究表级锁及行级锁
SELECT S.SID SID,
S.USERNAME USERNAME,
S.MACHINE MACHINE,
L.TYPE TYPE,
O.OBJECT_NAME OBJECT_NAME,
DECODE(L.LMODE, 0, 'None',
1, 'Null',
2, 'Row Share',
3, 'Row Exlusive',
4, 'Share',
5, 'Sh/Row Exlusive',
6, 'Exclusive') lmode,
DECODE(L.REQUEST, 0, 'None',
1, 'Null',
2, 'Row Share',
3, 'Row Exlusive',
4, 'Share',
5, 'Sh/Row Exlusive',
6, 'Exclusive') request,
L.BLOCK BLOCK
FROM V$LOCK L,
V$SESSION S,
DBA_OBJECTS O
WHERE L.SID = S.SID
AND USERNAME != 'SYSTEM'
AND O.OBJECT_ID(+) = L.ID1
AND S.SID IN ( 199,195)
ORDER BY S.SID;
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';
--研究表级锁及行级锁
SELECT S.SID SID,
S.USERNAME USERNAME,
S.MACHINE MACHINE,
L.TYPE TYPE,
O.OBJECT_NAME OBJECT_NAME,
DECODE(L.LMODE, 0, 'None',
1, 'Null',
2, 'Row Share',
3, 'Row Exlusive',
4, 'Share',
5, 'Sh/Row Exlusive',
6, 'Exclusive') lmode,
DECODE(L.REQUEST, 0, 'None',
1, 'Null',
2, 'Row Share',
3, 'Row Exlusive',
4, 'Share',
5, 'Sh/Row Exlusive',
6, 'Exclusive') request,
L.BLOCK BLOCK
FROM V$LOCK L,
V$SESSION S,
DBA_OBJECTS O
WHERE L.SID = S.SID
AND USERNAME != 'SYSTEM'
AND O.OBJECT_ID(+) = L.ID1
AND S.SID IN ( 199,195)
ORDER BY S.SID;
下一篇: 详细概述C#中的常用字符串方法