_대문 | 방명록 | 최근글 | 홈피소개 | 주인놈
FrontPage › 락모니터링
Describe 락모니터링 here

---------------------
--락 걸린 객체 조회--
---------------------
col object_name format a30
col subobject_name format a10
col oracle_username format a20
select a.object_name, a.subobject_name, b.process, b.session_id, b.oracle_username, b.locked_mode
from dba_objects a, v$locked_object b
where a.object_id = b.object_id;

------------------------
--블록킹 세션 모니터링--
------------------------

column username for a10
column sid for 999
column lock_type for a25
column mode_held for a11
column mod_requested for a10
column lock_id1 for a8
column lock_id2 format a8
select a.sid,
decode(a.type, 'MR', 'Media Recovery',
               'RT', 'Redo Thread',
               'UN', 'User Name',
               'TX', 'Transaction',
               'TM', 'DML',
               'UL', 'PL/SQL User Lock',
               'DX', 'Distributed Xaction',
               'CF', 'Control File',
               'IS', 'Instance State',
               'FS', 'File Set',
               'IR', 'Instance Recovery',
               'ST', 'Disk Space Transaction',
               'TS', 'Temp Segment',
               'IV', 'Library Cache Invaildation',
               'LS', 'Log Start or Switch',
               'RW', 'Row Wait',
               'SQ', 'Sequence Number',
               'TE', 'Extend Table',
               'TT', 'Temp Table', a.type) lock_type,
decode(a.lmode,
				0, 'None', 			/*Non Lock equivalent*/
				1, 'Null', 			/*N*/
				2, 'Row-S(SS)', 	/*L*/
				3, 'Row-X(SX)', 	/*R*/
				4, 'Share', 		/*S*/
				5, 'S/Row-X(SSX)',/*C*/
				6, 'Exclusive',	/*X*/
				to_char(a.lmode)) mode_held,
decode(a.request,
				0, 'None', 			/*Non Lock equivalent*/
				1, 'Null', 			/*N*/
				2, 'Row-S(SS)', 	/*L*/
				3, 'Row-X(SX)', 	/*R*/
				4, 'Share', 		/*S*/
				5, 'S/Row-X(SSX)',/*C*/
				6, 'Exclusive',	/*X*/
				to_char(a.request)) mode_requested,
				to_char(a.id1) lock_id1,
				to_char(a.id2) lock_id2				             
from v$lock a
where a.type not in ('MR', 'DM', 'RT')
and (id1, id2) in (select b.id1, b.id2
                   from v$lock b 
                   where b.id1 = a.id1
                   and b.id2=a.id2
                   and b.request > 0)
order by 5,6;

-------------------------
--락으로 인한 wait 조회--
-------------------------
select s.sid, s.username, s.machine, 
decode(s.status, 'INACTIVE', '락을 걸고 있는 세션(INACTIVE)', s.status) status, e.event
from v$session s, v$session_wait e
where s.sid = e.sid
                   




댓글 남기기..
이름: : 오른쪽의 새로고침을 클릭해 주세요. 새로고침
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53

과거를 아프게 들여다보지 말라. 그것은 다시 오지 않는다. 현재를 슬기롭게 이용하라. 그것은 그대의 것이다. 힘찬 기상으로 두려워말고 나아가 무지개를 맞으라.