en
: enter
enqueue
: queue에 들어간다는 의미
💡 메모리의 자원과 디스크의 자원을 보호하기 위한 오라클 메커니즘
- latch
: 오라클 메모리(SGA)의 락, latch를 확보한 프로세서만 특정 메모리 영역을 사용할 수 있음
- lock
: 오라클 객체(테이블, 시퀀스)를 먼저 update 하겠다고 선점한 사람이 락을 걸면 다른 유저들은 대기해야함
TX enqueue, TM enqueue, SQ enqueue, HW enqueue
- 악성 SQL이 돌 때 발생하는 latch
:db buffer cache latch
- 파싱이 과도할 때 발생하는 latch
:shared pool latch
와library cache latch
[oracle@ora19c ~]$ sys
SQL*Plus: Release 19.0.0.0.0 - Production on 목 9월 4 11:19:49 2025
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
다음에 접속됨:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SYS @ ORA19 > @install
연결되었습니다.
Input data file name(for default tablespace ex. c:\owi\owi01.dbf): /home/oracle/owi01.dbf
Verbose mode on?[ON/OFF]: on
.
.
.
패키지 본문이 생성되었습니다.
OWI @ ORA19 >
OWI @ ORA19 > @exec
OWI @ ORA19 > SELECT name "Scenario List" FROM TABLE(owi_scenario.get_scenario_classes);
Scenario List
--------------------------------------------------
cache_buffers_chains_latch
buffer_busy_waits
db_file_sequential_read
shared_pool_latch
library_cache_latch
library_cache_pin
sq_enqueue
tx_enqueue
log_buffer_space
gc_buffer_busy
gc_current_request
Scenario List
--------------------------------------------------
dfs_lock_handle
generic
13 행이 선택되었습니다.
💡
tx 락
: 행(row)에 거는 락tm 락
: table에 거는 락
ed tx_lock.sql
select sid, type, lmode, request, block
from v$lock
where type in ('TX', 'TM')
order by sid asc;
ed enq_wait.sql
select sid, event
from v$session_wait
where event like '%enq%';
OWI @ ORA19 > connect / as sysdba
연결되었습니다.
SYS @ ORA19 >
SYS @ ORA19 > grant create job to owi;
권한이 부여되었습니다.
경 과: 00:00:00.01
SYS @ ORA19 >
SYS @ ORA19 > grant manage scheduler to owi;
권한이 부여되었습니다.
경 과: 00:00:00.01
SCOTT @ ORA19 > connect owi/owi
연결되었습니다.
OWI @ ORA19 >
OWI @ ORA19 >
OWI @ ORA19 > @exec
OWI @ ORA19 > -------------------------------------------------
OWI @ ORA19 > -- Name : exec.sql
OWI @ ORA19 > -- Script for executing scenario
OWI @ ORA19 > --
OWI @ ORA19 > -- History
OWI @ ORA19 > -- 2006/09/04 Dongwook Cho Initial Coding
OWI @ ORA19 > -- 2006/09/13 Bumkyu Kim Add
OWI @ ORA19 > -- 2006/12/09 Dongwook Cho Add unix-shell functionality
OWI @ ORA19 > --------------------------------------------------
OWI @ ORA19 >
OWI @ ORA19 > set serveroutput on size 100000
OWI @ ORA19 > set timing on
OWI @ ORA19 > col "Scenario List" form a50
OWI @ ORA19 >
OWI @ ORA19 > SELECT name "Scenario List" FROM TABLE(owi_scenario.get_scenario_classes);
Scenario List
--------------------------------------------------
cache_buffers_chains_latch
buffer_busy_waits
db_file_sequential_read
shared_pool_latch
library_cache_latch
library_cache_pin
sq_enqueue
tx_enqueue
log_buffer_space
gc_buffer_busy
gc_current_request
Scenario List
--------------------------------------------------
dfs_lock_handle
generic
13 행이 선택되었습니다.
경 과: 00:00:00.01
OWI @ ORA19 >
OWI @ ORA19 > accept event_name char prompt 'Event name to simulate: '
Event name to simulate: tx_enqueue
OWI @ ORA19 > accept session_num number default 10 prompt 'Session count [10]: '
Session count [10]: 10
OWI @ ORA19 > accept expired_type number default 1 prompt 'Expired by time(1) or looping count(2) [1]: '
Expired by time(1) or looping count(2) [1]: 1
OWI @ ORA19 > accept interval number default 30 prompt 'Execution internval(sec or count) [30]: '
Execution internval(sec or count) [30]: 60
OWI @ ORA19 > accept enable_trace number default 0 prompt 'Enable_trace (1=TRUE, 0=FALSE) [0]: '
Enable_trace (1=TRUE, 0=FALSE) [0]: 1
OWI @ ORA19 > ACCEPT exec_method NUMBER DEFAULT 0 prompt 'Exec method(0=Oracle Job, 1=Unix Shell) [0]: '
Exec method(0=Oracle Job, 1=Unix Shell) [0]: 0
OWI @ ORA19 > accept init_on_creation number default 1 prompt 'Init data(1=TRUE, 0=FALSE) [1]: '
Init data(1=TRUE, 0=FALSE) [1]: 1
OWI @ ORA19 >
OWI @ ORA19 > var sno number;
OWI @ ORA19 > exec :sno := owi_scenario.create_scenario( -
> event_name=>'&event_name', -
> session#=>&session_num, -
> expired_type=>&expired_type, -
> interval=>&interval, -
> enable_trace =>&enable_trace, -
> exec_method => &exec_method, -
> init_on_creation =>&init_on_creation);
PL/SQL 처리가 정상적으로 완료되었습니다.
경 과: 00:00:00.01
OWI @ ORA19 >
OWI @ ORA19 > exec owi_scenario.run_scenario(:sno);
PL/SQL 처리가 정상적으로 완료되었습니다.
경 과: 00:00:00.08
OWI @ ORA19 >