락 뷰와 세션 뷰를 조인하여 트랜잭션 락을 조회해 봅니다. 두 가지 뷰는 SID 컬럼으로 조인할 수 있습니다. TX, TM, UL과 같은 락 타입에 대한 설명은 아래에 있습니다.
락 오브젝트 확인하기
SELECT LK.SID,
SE.USERNAME,
SE.OSUSER,
SE.MACHINE,
DECODE (LK.TYPE,
'TX', 'Transaction',
'TM', 'DML',
'UL', 'PL/SQL User Lock',
LK.TYPE)
LOCK_TYPE,
DECODE (LK.LMODE,
0, 'None',
1, 'Null',
2, 'Row-S (SS)',
3, 'Row-X (SX)',
4, 'Share',
5, 'S/Row-X (SSX)',
6, 'Exclusive',
TO_CHAR (LK.LMODE))
MODE_HELD,
DECODE (LK.REQUEST,
0, 'None',
1, 'Null',
2, 'Row-S (SS)',
3, 'Row-X (SX)',
4, 'Share',
5, 'S/Row-X (SSX)',
6, 'Exclusive',
TO_CHAR (LK.REQUEST))
MODE_REQUESTED,
TO_CHAR (LK.ID1) LOCK_ID1,
TO_CHAR (LK.ID2) LOCK_ID2,
DECODE (BLOCK, 0, 'No', 1, 'Yes', 2, 'Global') BLOCK,
SE.LOCKWAIT
FROM V$LOCK LK, V$SESSION SE
WHERE (LK.TYPE = 'TX') AND (LK.SID = SE.SID)
유저 락 확인 쿼리
락 뷰와 세션 뷰에 더불어 오브젝트 뷰를 통해 DML과 PL/SQL 유저 락을 확인하는 쿼리입니다.
SELECT LK.SID,
SE.USERNAME,
SE.OSUSER,
SE.MACHINE,
DECODE (LK.TYPE,
'TX', 'Transaction',
'TM', 'DML',
'UL', 'PL/SQL User Lock',
LK.TYPE)
LOCK_TYPE,
DECODE (LK.LMODE,
0, 'None',
1, 'Null',
2, 'Row-S (SS)',
3, 'Row-X (SX)',
4, 'Share',
5, 'S/Row-X (SSX)',
6, 'Exclusive',
TO_CHAR (LK.LMODE))
MODE_HELD,
DECODE (LK.REQUEST,
0, 'None',
1, 'Null',
2, 'Row-S (SS)',
3, 'Row-X (SX)',
4, 'Share',
5, 'S/Row-X (SSX)',
6, 'Exclusive',
TO_CHAR (LK.REQUEST))
MODE_REQUESTED,
TO_CHAR (LK.ID1) LOCK_ID1,
TO_CHAR (LK.ID2) LOCK_ID2,
OB.OWNER,
OB.OBJECT_TYPE,
OB.OBJECT_NAME,
DECODE (LK.BLOCK, 0, 'No', 1, 'Yes', 2, 'Global') BLOCK,
SE.LOCKWAIT
FROM V$LOCK LK, DBA_OBJECTS OB, V$SESSION SE
WHERE LK.TYPE IN ('TM', 'UL')
AND LK.SID = SE.SID
AND LK.ID1 = OB.OBJECT_ID(+)
Lock Type
락 뷰에는 TYPE 컬럼이 영문 약자로 나와있는데요, 해당 값에 대한 설명은 락 타입 뷰에 있답니다. TX는 트랜잭션 락을 뜻합니다. TM은 DML(Data Manipulation Language: 데이터 조작 언어), 즉 INSERT, UPDATE, DELETE 락을 뜻합니다. 그리고 UL은 PL/SQL 유저 락을 뜻합니다.
SELECT TYPE, NAME, DESCRIPTION
FROM V$LOCK_TYPE
ORDER BY TYPE;
AB
Auto BMR
A general class of locks used by auto BMR for various purposes
AD
ASM Disk AU Lock
Synchronizes accesses to a specific ASM disk AU
AE
Edition Lock
Prevent Dropping an edition in use
AF
Advisor Framework
This enqueue is used to serialize access to an advisor task
AG
Analytic Workspace Generation
Synchronizes generation use of a particular workspace
AK
GES Deadlock Test
Lock used for internal testing
AM
ASM Enqueue
ASM instance general-purpose enqueue
AO
MultiWriter Object Access
Synchronizes access to objects and scalar variables
AR
ASM Relocation Lock
Protects locked extent pointers during ASM file relocation
AS
Service Operations
Synchronizes new service activation
AT
Alter Tablespace
Serializes 'alter tablespace' operations
AV
ASM volume locks
id1 is for persistent DG number locking. id2 is for other volume serialization
AW
Analytic Workspace
Synchronizes access to Analytic Workspace resources
AY
KSXA Test Affinity Dictionary
Affinity Dictionary test affinity synchronization
BB
Global Transaction Branch
2PC distributed transaction branch across RAC instances
BF
BLOOM FILTER
Synchronize access to a bloom filter in a parallel statement
BR
Backup/Restore
Lock held by a backup/restore operation to allow other operations to wait for it
CA
Calibration
Lock used by IO Calibration
CF
Controlfile Transaction
Synchronizes accesses to the controlfile
CI
Cross-Instance Call Invocation
Coordinates cross-instance function invocations
CL
Label Security cache
Synchronizes accesses to label cache and label tables
CM
ASM Instance Enqueue
ASM instance and gate enqueue
CN
KTCN REG enq
Enqueue held for registrations for change notifications
CO
KTUCLO Master Slave enq
Enqueue held for determining Master Slaves
CQ
Cleanup querycache registrations
Serializes access to cleanup client query cache registrations
CR
Reuse Block Range
Coordinates checkpointing of block range reuse
CT
Block Change Tracking
A general class of locks used by change tracking for various purposes
CU
Cursor
Recovers cursors in case of death while compiling
CX
TEXT: Index Specific Lock
Index Specific Lock on CTX index
DB
DbsDriver
Synchronizes modification of database wide supplementallogging attributes
DD
ASM Local Disk Group
Synchronizes local accesses to ASM disk groups
DF
Datafile Online in RAC
Enqueue held by foreground or DBWR when a datafile is brought online in RAC
DG
ASM Disk Group Modification
Synchronizes accesses to ASM disk groups
DI
GES Internal
Coordinates Global Enqueue Service deadlock detection
DL
Direct Loader Index Creation
Lock to prevent index DDL during direct load
DM
Database Mount/Open
Enqueue held by foreground or DBWR to synchronize database mount/open with other operations
DN
Diskgroup number generator
Serializes Group number generations
DO
ASM Disk Online Lock
Synchronizes disk onlines and their recovery
DP
LDAP Parameter
Synchronizes access to LDAP parameters
DQ
ASM RBAL doorbell
Inter-RBAL process metadata invalidation notification
DR
Distributed Recovery
Serializes the active distributed recovery operation
DS
Database Suspend
Prevents a database suspend during LMON reconfiguration
DT
Default Temporary Tablespace
Serializes changing the default temporary table space and user creation
DV
Diana Versioning
Synchronizes access to lower-version Diana (PL/SQL intermediate representation)
DW
In memory Dispenser
Serialize in memory dispenser operations
DX
Distributed Transaction
Serializes tightly coupled distributed transaction branches
E
Library Cache Lock 2
Synchronizes accesses to library cache objects
FA
ASM File Access Lock
Synchronizes accesses to open ASM files
FB
Format Block
Ensures that only one process can format data blocks in auto segment space managed tablespaces
FC
Disk Group Chunk Mount
controls access to an ACD chunk
FD
Flashback Database
Coordinate flashback database
FE
KTFA Recovery
Flashback archive Enqueue to serialize recovery
FG
ACD Relocation Gate Enqueue
ACD relocation serialization
FL
Flashback database log
Synchronize access to flashback database log
FM
File Mapping
Synchronizes access to global file mapping state
FP
File Object
Synchronizes various File Object(FOB) operations
FR
Disk Group Recovery
enqueue to control ASM recovery
FS
File Set / Dictionary Check
Enqueue used to synchronize recovery and file operations or synchronize dictionary check
FT
Disk Group Redo Generation
controls the privilege to generate redo in a thread
FU
DBFUS
This enqueue is used to serialize the capture of the DB Feature Usage and High Water Mark Statistics
FW
Flashback Writer
Coordinate RVWR on multiple instances
FX
ACD Xtnt Info CIC
serialize ACD relocation CIC
FZ
ASM Freezing Cache Lock
Freezes ASM Cache for a diskgroup
G
Library Cache Pin 2
Synchronizes accesses to the contents of library cache objects
HD
ASM Disk Header
Serializes accesses to ASM SGA data structures
HP
Queue Page
Synchronizes accesses to queue pages
HQ
Hash Queue
Synchronizes the creation of new queue IDs
HV
Direct Loader High Water Mark
Lock used to broker the high water mark during parallel inserts
HW
Segment High Water Mark
Lock used to broker the high water mark during parallel inserts
IA
Internal
ID
NID
Lock held by a NID operation to allow other operations to wait for it
IL
Label Security
Synchronizes accesses to internal label data structures
IM
Kti blr lock
Serializes block recovery for an IMU txn
IR
Instance Recovery
Synchronizes instance recovery
IS
Instance State
Enqueue used to synchronize instance state changes
IT
In-Mem Temp Table Meta Creation
Synchronizes accesses to a temp object's metadata
IV
Library Cache Invalidation
Synchronizes library cache object invalidations across instances
IZ
INSTANCE LOCK
Proctects the lock name space used by the instance
JD
Job Queue Date
Synchronizes dates between job queue coordinator and slave processes
JI
Materialized View
Lock held during materialized view operations (like refresh, alter) to prevent concurrent operations on the same materialized view
JQ
Job Queue
Lock to prevent multiple instances from running a single job
JS
Job Scheduler
Synchronizes accesses to the job cache
JX
SQL STATEMENT QUEUE
synchronize SQL statement queue operations
KD
Scheduler Master DBRM
Determine DBRM master
KE
ASM Cached Attributes
Synchronization of ASM cached attributes
KK
Kick Instance to Switch Logs
Lock held by open redo thread, used by other instances to force a log switch
KL
LOB KSI LOCK
KSI lock for buffer cache and wgc concurrency
KM
Scheduler
Synchronizes various Resource Manager operations
KO
Multiple Object Checkpoint
Coordinates checkpointing of multiple objects
KP
Kupp Process Startup
Synchronizes kupp process startup
KQ
ASM Attributes Enque
Single Inst Sync of ASM attributes
KT
Scheduler Plan
Synchronizes accesses to the current Resource Manager plan
L
Library Cache Lock 1
Synchronizes accesses to library cache objects
MD
Materialized View Log DDL
Lock held during materialized view log DDL statements
MH
AQ Notification Mail Host
Lock used for recovery when setting Mail Host for AQ e-mail notifications
MK
Master Key
Serializes enc$ access
ML
AQ Notification Mail Port
Lock used for recovery when setting Mail Port for AQ e-mail notifications
MN
LogMiner
Synchronizes updates to the LogMiner dictionary and prevents multiple instances from preparing the same LogMiner session
MO
MMON restricted session
Serialize MMON operations for restricted sessions
MR
Media Recovery
Lock used to coordinate media recovery with other uses of datafiles
MS
Materialized View Refresh Log
Lock held during materialized view refresh to setup MV log
MV
Online Datafile Move
Synchronizes online datafile move operation or cleanup
MW
MWIN Schedule
This enqueue is used to serialize the calibration of the manageability schedules with the Maintenance Window
MX
ksz synch
Used to synchronize storage server info across all nodes
N
Library Cache Pin 1
Synchronizes accesses to the contents of library cache objects
OC
Outline Cache
Synchronizes write accesses to the outline cache
OD
Online DDLs
Lock to prevent concurrent online DDLs
OL
Outline Name
Synchronizes accesses to a particular outline name
OQ
OLAPI Histories
Synchronizes access to olapi history resources
OT
TEXT: Generic Lock
Generic Lock on CTX index
OW
Encryption Wallet
Serializes wallet initialization and access
PD
Property Lock
Serializes property update
PE
Parameter
Synchronizes system parameter updates
PF
Password File
Synchronizes accesses to the password file
PG
Global Parameter
Synchronizes global system parameter updates
PH
AQ Notification Proxy
Lock used for recovery when setting Proxy for AQ HTTP notifications
PI
Remote PX Process Spawn Status
Communicates remote Parallel Execution Server Process creation status
PL
Transportable Tablespace
Coordinates plug-in operation of transportable tablespaces
PM
ASM PST Signalling
Signals inter-instance access to ASM PST metadata
PR
Process Startup
Synchronizes process startup
PS
PX Process Reservation
Parallel Execution Server Process reservation and synchronization
PT
ASM Partnership and Status Table
Gates inter-node synchronization of ASM PST metadata
PV
KSV slave startup
Synchronizes slave start_shut
PW
Buffer Cache PreWarm
Coordinates Direct Loads with Prewarmed cache buffers
Q
Row Cache
Coordinates updates and accesses to row cache objects
RB
ASM Rollback Recovery
Serializes ASM rollback recovery operations
RC
Result Cache: Enqueue
Accessing a result in the result-set cache
RD
RAC Load
synchronize update of RAC load info
RE
Block Repair/Resilvering
Synchronizes block repair/mirror resilvering operations
RF
Data Guard Broker
Synchronizes broker lock operation involving lock value
RK
wallet_set_mkey
Serializes wallet master key rekey
RL
RAC Encryption Wallet Lock
RAC encryption wallet lock
RM
GES Resource Remastering
Coordinates Global Enqueue Service resource remastering
RN
Redo Log Nab Computation
Coordinates nab computations of online logs during recovery
RO
Multiple Object Reuse
Coordinates flushing of multiple objects
RP
Resilver / Repair
Enqueue held when resilvering is needed or when datablock is repaired from mirror
RR
Workload Capture and Replay
Prevents concurrent invokers of DBMS_WORKLOAD_*
RS
Reclaimable Space
Lock held by a space reclaimable operation to allow other operations to wait for it
RT
Redo Thread
Thread locks held by LGWR, DBW0, and RVWR to indicate mounted or open status
RU
Rolling Migration
Serilized rolling migration operations
RW
Materialized View Flags
Lock used when creating or readingmaterialized view flags in detail tables
RX
ASM Extent Relocation Lock
Synchronizes relocating ASM extents
SB
LogicalStandby
Synchronizes Logical Standby metadata operations
SC
System Change Number
Coordinates system change number generation on multiple instances
SE
Session Migration
Lock used by transparent session migration
SF
AQ Notification Sender
Lock used for recovery when setting Sender for AQ e-mail notifications
SH
Active Session History Flushing
To prevent multiple concurrent flushers
SI
Streams Table Instantiation
Prevents muiltiple streams table instantiations
SJ
KTSJ Slave Task Cancel
Serializes cancelling task executed by slave process
SK
Shrink Segment
Serialize shrink of a segment
SL
Serialize Lock request
Request serialization to LCK0
SM
SMON Serialization
Lock to check SMON global work in RAC
SO
Shared Object
Synchronizes access to Shared Object(PL/SQL Shared Object Manager)
SP
Spare Enqueue
Spare enqueue for one-off backports
SQ
Sequence Cache
Lock to ensure that only one process can replenish the sequence cache
SR
Synchronized Replication
Coordinates replication / streams operations
SS
Sort Segment
Ensures that sort segments created during parallel DML operations aren't prematurely cleaned up
ST
Space Transaction
Synchronizes space management activities in dictionary-managed tablespaces
SU
SaveUndo Segment
Serializes access to SaveUndo Segment
SV
Sequence Ordering
Lock to ensure ordered sequence allocation in RAC mode
SW
Suspend Writes
Coordinates the 'alter system suspend' operation
TA
Instance Undo
Serializes operations on undo segments and undo tablespaces
TB
SQL Tuning Base Existence Cache
Synchronizes writes to the SQL Tuning Base Existence Cache
TC
Tablespace Checkpoint
Lock held to guarantee uniqueness of a tablespace checkpoint
TD
KTF map table enqueue
Serializes updates and inserts to the SMON_SCN_TIME mapping table
TE
KTF broadcast
Serializes broadcasts for flushes to SMON_SCN_TIME
TF
Temporary File
Serializes dropping of a temporary file
TH
Threshold Chain
Serializes threshold in-memory chain access
TK
Auto Task Serialization
Prevents more than one AutoTask Background Slave from being spawned
TL
Log Lock
Serializes threshold log table read and update
TM
DML
Synchronizes accesses to an object
TO
Temp Object
Synchronizes DDL and DML operations on a temp object
TP
Runtime Fixed Table Purge
Lock used for fixed runtime table purge and definition
TQ
Queue table enqueue
Synchronizes access to queue table
TS
Temporary Segment
Serializes accesses to temp segments
TT
Tablespace
Serializes DDL operations on tablespaces
TW
Cross-Instance Transaction
Lock held by one instance to wait for transactions on all instances to finish
TX
Transaction
Lock held by a transaction to allow other transactions to wait for it
UL
User-defined
Lock used by user applications
US
Undo Segment
Lock held to perform DDL on the undo segment
V
Library Cache Lock 3
Synchronizes accesses to library cache objects
WA
AQ Notification Watermark
Lock used for recovery when setting Watermark for memory usage in AQ notifications
WF
AWR Flush
This enqueue is used to serialize the flushing of snapshots
WG
Write gather local enqueue
Long term lock on wgc file state
WL
Being Written Redo Log
Coordinates access to redo log files and archive logs
WM
WLM Plan Operations
Synchronizes new WLM Plan activation
WP
AWR Purge
This enqueue handles concurrency between purging and baselines
WR
LNS archiving log
Coordinates access to logs by Async LNS and ARCH/FG
WS
LogWriter Standby
Used by LogWriter to coordinate communication to standby databases
XB
ASM Group Block lock
Prevents client diskgroup use during storage reconfiguration
XC
XDB Configuration
Synchronization access to XDB configuration
XD
Auto Online Exadata disks
Serialize Auto Management of Exadata disks
XH
AQ Notification No-Proxy
Lock used for recovery when setting No Proxy Domains for AQ HTTP notifications
XL
ASM Extent Fault Lock
Keep multiple processes from faulting in the same extent chunk
XQ
ASM Extent Relocation Enqueue
ASM extent relocation
XR
Quiesce / Force Logging
Lock held during database quiesce or for database force logging
XY
Internal Test
Lock used for internal testing
Y
Library Cache Pin 3
Synchronizes accesses to the contents of library cache objects
ZA
Audit Partition
Lock held for adding partition to Aud table
ZF
FGA Partition
Lock held for adding partition to Fga table
ZG
File Group
Coordinates file group operations
ZH
Compression Analyzer
Synchronizes analysis and insert into compression$, prevents multiple threads analyzing the same table during a load
ZZ
Global Context Action
Lock held for updating Global context hash tables