1. 전체적인 lock 대기 상황 모니터링 쿼리
select l.session_id SID
,(case when lock_type = 'Transaction' then 'TX'
when lock_type = 'DML' then 'TM' end) TYPE
, mode_held
, mode_requested mode_reqd
,(case when lock_type = 'Transaction' then
to_char(trunc(lock_id1/power(2,16)))
when lock_type = 'DML' then
(select object_name from dba_objects
where object_id = l.lock_id1)
end) "USN/Table"
,(case when lock_type = 'Transaction' then
bitand(lock_id1, to_number('ffff', 'xxxx')) + 0
end) "SLOT"
,(case when lock_type = 'Transaction' then
to_number(lock_id2) end) "SQN"
,(case when blocking_others = 'Blocking' then ' <<<<<' end) Blocking
from dba_lock l
where lock_type in ('Transaction', 'DML' )
order by session_id, lock_type, lock_id1, lock_id2
2. 현재 유저의 lock 상태 조회쿼리
select username, v$lock.sid, id1, id2
, lmode, request, block, v$lock.type
from v$lock, v$session
where v$lock.sid = v$session.sid
and v$session.username = USER
'DBMS > 오라클' 카테고리의 다른 글
snapshot too old 발생 가능성을 줄이는 법 (0) | 2018.07.27 |
---|---|
오라클 데이타 export script (0) | 2018.07.09 |
세션 커서 캐시 히트율(Hit Ratio)을 구하는 쿼리 (0) | 2018.05.01 |
dictionary table 종류를 검색하는 쿼리 (0) | 2018.05.01 |
v$sql 을 사용해서 전체 시스템의 쿼리 수행 통계정보를 조회하는 쿼리 (0) | 2018.05.01 |