DESC V$ROWCACHE_PARENT
Name Null? Type
------------------ -------- -----------------
INDX NUMBER
HASH NUMBER
ADDRESS RAW(8)
CACHE# NUMBER
CACHE_NAME VARCHAR2(64)
EXISTENT VARCHAR2(1)
LOCK_MODE NUMBER
LOCK_REQUEST NUMBER
TXN RAW(8)
SADDR RAW(8)
INST_LOCK_REQUEST NUMBER
INST_LOCK_RELEASE NUMBER
INST_LOCK_TYPE VARCHAR2(2)
INST_LOCK_ID1 RAW(4)
INST_LOCK_ID2 RAW(4)
KEY RAW(100)
;
SELECT CACHE#,
CACHE_NAME,
LOCK_MODE,
LOCK_REQUEST,
SADDR
FROM V$ROWCACHE_PARENT
WHERE ROWNUM <= 10
;
CACHE# CACHE_NAME LOCK_MODE LOCK_REQUEST SADDR
------ ------------------- ---------- ------------ ----------------
0 dc_tablespaces 0 0 00
0 dc_tablespaces 0 0 00
0 dc_tablespaces 0 0 00
0 dc_tablespaces 0 0 00
0 dc_tablespaces 0 0 00
0 dc_tablespaces 0 0 00
0 dc_tablespaces 0 0 00
0 dc_tablespaces 0 0 00
0 dc_tablespaces 0 0 00
0 dc_tablespaces 0 0 00
CACHE# | 캐시 번호 |
CACHE_NAME | 캐시 이름 예) DC SEQUENCE |
LOCK_MODE | 해당 딕셔서리 오브젝트에 대해 Row Cache Lock 을 획득하고 있는 모드 |
LOCK_REQUEST | 해당 딕셔너리 오브젝트에 대해 Row Cache Lock 을 획득하기 위해 대기하는 모드 |
SADDR | Row Cache Lock 을 획득하거나 대기하고 있는 세션의 주소 V$SESSION.SADDR 값과 조인하면 세션 정보를 얻을 수 있음 |
-- 1. Sequence 생성
CREATE SEQUENCE SEQ1 NOCACHE ;
-- 2. 수행
EXEC DBMS_APPLICATION_INFO.SET_CLIENT_INFO('SESSION_1');
BEGIN
FOR IDX IN 1..100000 LOOP
FOR R IN (SELECT SEQ1.NEXTVAL
FROM DUAL) LOOP
NULL;
END LOOP;
END LOOP;
END;
/
SQL >
1 CREATE SEQUENCE SEQ1 NOCACHE ;
Sequence created.
SQL >
1 EXEC DBMS_APPLICATION_INFO.SET_CLIENT_INFO('SESSION_1');
PL/SQL procedure successfully completed.
SQL >
1 BEGIN
2 FOR IDX IN 1..100000 LOOP
3 FOR R IN (SELECT SEQ1.NEXTVAL
4 FROM DUAL) LOOP
5 NULL;
6 END LOOP;
7 END LOOP;
8 END;
9 /
PL/SQL procedure successfully completed.
EXEC DBMS_APPLICATION_INFO.SET_CLIENT_INFO('SESSION_2');
BEGIN
FOR IDX IN 1..100000 LOOP
FOR R IN (SELECT SEQ1.NEXTVAL
FROM DUAL) LOOP
NULL;
END LOOP;
END LOOP;
END;
/
SQL >
1 CREATE SEQUENCE SEQ1 NOCACHE ;
Sequence created.
SQL >
1 EXEC DBMS_APPLICATION_INFO.SET_CLIENT_INFO('SESSION_2');
PL/SQL procedure successfully completed.
SQL >
1 BEGIN
2 FOR IDX IN 1..100000 LOOP
3 FOR R IN (SELECT SEQ1.NEXTVAL
4 FROM DUAL) LOOP
5 NULL;
6 END LOOP;
7 END LOOP;
8 END;
9 /
PL/SQL procedure successfully completed.
-- 1. Row Cache Lock 세션 모니터링
set serveroutput on
col sid new_value sid
SELECT SID
FROM V$SESSION
WHERE CLIENT_INFO = 'SESSION_2';
BEGIN
PRINT_TABLE('SELECT *
FROM V$SESSION_WAIT
WHERE SID = &SID');
END;
/
-- 2. 상세 모니터링
col cache_name format a15
SELECT (SELECT SID
FROM V$SESSION
WHERE SADDR = H.SADDR) AS HOLDER_SID,
H.CACHE_NAME,
H.LOCK_MODE
FROM V$ROWCACHE_PARENT H,
V$ROWCACHE_PARENT W,
V$SESSION S
WHERE H.ADDRESS = W.ADDRESS
AND W.SADDR = S.SADDR
AND S.SID = &SID
AND H.LOCK_MODE > 0
;
SQL >
1 SELECT SID
2 FROM V$SESSION
3 WHERE CLIENT_INFO = 'SESSION_2';
SID
----------
9623
1 row selected.
SQL >
1 BEGIN
2 PRINT_TABLE('SELECT *
3 FROM V$SESSION_WAIT
4 WHERE SID = &SID');
5 END;
6 /
SID : 9623
SEQ# : 105
EVENT : row cache lock
P1TEXT : cache id
P1 : 13
P1RAW : 000000000000000D
P2TEXT : mode
P2 : 0
P2RAW : 00
P3TEXT : request
P3 : 5
P3RAW : 0000000000000005
WAIT_CLASS_ID : 3875070507
WAIT_CLASS# : 4
WAIT_CLASS : Concurrency
WAIT_TIME : 0
SECONDS_IN_WAIT : 19
STATE : WAITING
---------------------------------------------------------------------------
PL/SQL procedure successfully completed.
SQL >
1 col cache_name format a15
SQL >
1 SELECT (SELECT SID
2 FROM V$SESSION
3 WHERE SADDR = H.SADDR) AS HOLDER_SID,
4 H.CACHE_NAME,
5 H.LOCK_MODE
6 FROM V$ROWCACHE_PARENT H,
7 V$ROWCACHE_PARENT W,
8 V$SESSION S
9 WHERE H.ADDRESS = W.ADDRESS
10 AND W.SADDR = S.SADDR
11 AND S.SID = &SID
12 AND H.LOCK_MODE > 0
13 ;
HOLDER_SID CACHE_NAME LOCK_MODE
---------- --------------- ----------
9889 dc_sequences 5
1 row selected.
- 강좌 URL : http://www.gurubee.net/lecture/4304
- 구루비 강좌는 개인의 학습용으로만 사용 할 수 있으며, 다른 웹 페이지에 게재할 경우에는 출처를 꼭 밝혀 주시면 고맙겠습니다.~^^
- 구루비 강좌는 서비스 제공을 위한 목적이나, 학원 홍보, 수익을 얻기 위한 용도로 사용 할 수 없습니다.