文章目录
锁的类型和模式
oracle锁的类型、名称、描述可以通过v$lock_type来查看
select * from v$lock_type
在oracle19c中,有291种锁,其中大部分是数据库内部的锁,我们能经常见到的锁类型很少。
v$lock_type的字段说明
编号 | 字段名称 | 字段说明 |
---|---|---|
1 | TYPE | 锁的标识,两个字母的简写 |
2 | NAME | 锁的名称 |
3 | ID1_TAG | 排队类型的描述 |
4 | ID2_TAG | 排队类型的详细信息 |
5 | IS_USER | 用户队列,也就是这些队列是由SQL发起并获得的,应用程序很可能在这些队列上出现死锁,也就是这种死锁被认为是程序错误 |
6 | IS_RECYCLE | 是否可重用,指示队列是否需要缓存DLM中关联的资源,DLM是ORACLE得分布式锁管理器,作用是协调实例间对资源的竞争访问,也就是只在RAC下该值才有意义,该字段有两个值: |
YES | 表示不需要缓存 | |
NO | 表示需要缓存 | |
7 | DESCRIPTION | 字段描述 |
8 | CON_ID | 数据所属容器的ID |
锁类型的描述(19C),从数据库里直接插出来的,后续再补充中文描述
TYPE | NAME | ID1_TAG | ID2_TAG | IS_USER | IS_RECYCLE | DESCRIPTION |
---|---|---|---|---|---|---|
AB | Auto BMR | operation | operation parm | NO | NO | A general class of locks used by auto BMR for various purposes |
AC | Application Continuity | 0 | 0 | NO | NO | Synchronizes new service activation |
AD | ASM Disk AU Lock | group and disk number | AU number | NO | NO | Synchronizes accesses to a specific ASM disk AU |
AE | Edition Lock | edition obj# | pdbuid | NO | NO | Prevent Dropping an edition in use |
AF | Advisor Framework | task id | 0 | NO | NO | This enqueue is used to serialize access to an advisor task |
AG | Analytic Workspace Generation | workspace # | generation | NO | NO | Synchronizes generation use of a particular workspace |
AH | ASM Relocation Lock High | group/file number | virtual extent number | NO | NO | Protects locked extent pointers during ASM file relocation |
AK | GES Deadlock Test | id1 | id2 | NO | NO | Lock used for internal testing |
AM | ASM Enqueue | id1 | id2 | NO | NO | ASM instance general-purpose enqueue |
AO | MultiWriter Object Access | workspace # | object # | NO | NO | Synchronizes access to objects and scalar variables |
AP | SPM Autopurge | 0 | 0 | NO | NO | This enqueue is used to serialize the purging of SQL plan baselines |
AQ | Queue Partitioning local enqueue | QT_OBJ# | 0 | NO | NO | Synchronizes partition operations on queue table within instance |
AR | ASM Relocation Lock | group/file number | virtual extent number | NO | NO | Protects locked extent pointers during ASM file relocation |
AS | Service Operations | 0 | 0 | NO | NO | Synchronizes new service activation |
AT | Alter Tablespace | 0 | 0 | NO | NO | Serializes ‘alter tablespace’ operations |
AU | DBKR | 0 | 0 | NO | NO | This enqueue is used to serialize ADR purge operation |
AV | ASM volume locks | persistent DG number | non-DG number enqs | NO | NO | id1 is for persistent DG number locking. id2 is for other volume serialization |
AW | Analytic Workspace | operation | workspace # | NO | NO | Synchronizes access to Analytic Workspace resources |
AY | KSXA Test Affinity Dictionary | Op1 | Op2 | NO | NO | Affinity Dictionary test affinity synchronization |
AZ | Emon-SRVNTFN_Q Create | 0 | 0 | NO | NO | Synchronize creation of AQ_SRVNTFN_Q among emon slaves |
BA | non durable sub bmap alloc | 0 | 0 | NO | NO | Synchronizes access to globl Bitmap Alloc |
BB | Global Transaction Branch | gtrid hash value | bqual hash value | NO | YES | 2PC distributed transaction branch across RAC instances |
BC | BA Container | container group | container id | NO | NO | Backup Appliance Container |
BE | Critical Block Allocation | tablespace# | block# | NO | NO | Lock used to serialize allocation of critical blocks |
BF | BLOOM FILTER | node#/parallelizer# | bloom# | NO | NO | Synchronize access to a bloom filter in a parallel statement |
BI | BA Contained File Identification | group ID / file ID | file ID | NO | NO | Backup Appliance Contained File Identification |
BM | clonedb bitmap file access | block number | number of blocks | NO | NO | synchronizes clonedb bitmap file operations |
BO | DRM Banned-Object List | 0 | 0 | NO | NO | Coordinates dynamic remastering banned-object list |
BR | Backup/Restore | operation | file # | NO | NO | Lock held by a backup/restore operation to allow other operations to wait for it |
BS | Backup/Restore spare enq | id1 | id2 | NO | NO | KRB space usage |
BU | Buddy Instance Context | 0 | 0 | NO | NO | synchronizes access to Recovery Set constructed by RMS0 |
BV | BA Group Rebuild/Validate | amrv$ key | NO | NO | Backup Appliance Container Rebuild/Validate | |
BZ | BA Contained File Resize | group ID / file ID | file ID | NO | NO | Backup Appliance Contained File Resize |
CA | Calibration | 0 | 0 | NO | NO | Lock used by IO Calibration |
CB | CBAC Master Lock | 0 | 0 | NO | NO | Synchronizes accesses to the CBAC roles cached in KGL |
CC | Column Key | 0 | 0 | NO | NO | Serializes Column Encryption Key Cache |
CF | Controlfile Transaction | 0 | operation | NO | NO | Synchronizes accesses to the controlfile |
CI | Cross-Instance Call Invocation | opcode | type | NO | NO | Coordinates cross-instance function invocations |
CL | Label Security cache | object # | 0 | NO | NO | Synchronizes accesses to label cache and label tables |
CM | ASM Instance Enqueue | disk group # | type | NO | NO | ASM instance and gate enqueue |
CN | KTCN REG enq | reg id | 0 | NO | NO | Enqueue held for registrations for change notifications |
CO | KTUCLO Master Slave enq | inst id | 0 | NO | NO | Enqueue held for determining Master Slaves |
CP | Pluggable Database | Internal | Internal | NO | NO | Coordinate pluggable database operations |
CQ | Cleanup querycache registrations | 0 | 0 | NO | NO | Serializes access to cleanup client query cache registrations |
CR | Reuse Block Range | 2 | 0 | NO | NO | Coordinates checkpointing of block range reuse |
CT | Block Change Tracking | operation | operation parm | NO | YES | A general class of locks used by change tracking for various purposes |
CU | Cursor | handle | handle | NO | NO | Recovers cursors in case of death while compiling |
CX | TEXT: Index Specific Lock | Index Id | Partition Id | NO | NO | Index Specific Lock on CTX index |
DA | Instance DP Array | 0 | 0 | NO | NO | Slave Process Spawn reservation and synchronization |
DB | DbsDriver | EnqMode | 0 | NO | NO | Synchronizes modification of database wide supplementallogging attributes |
DD | ASM Local Disk Group | disk group | type | NO | NO | Synchronizes local accesses to ASM disk groups |
DE | Planned Draining RAC enqueue | 0 | 0 |