oracle--v$lock 字段详解

V$LOCK视图结构
列名 类型 字段说明
ADDR RAW(4 | 8) Address of lock state object
KADDR RAW(4|8) Address of lock
SID NUMBER 会话的sid,可以和v$session 关联
TYPE VARCHAR2(2) 区分该锁保护对象的类型(表4)
TM – DML enqueue
TX – Transaction enqueue
UL – User supplied
–我们主要关注TX和TM两种类型的锁
–UL锁用户自己定义的,一般很少会定义,基本不用关注
–其它均为系统锁,会很快自动释放,不用关注
ID1
ID2
NUMBER ID1,ID2的取值含义根据type的取值而有所不同
对于TM 锁
ID1表示被锁定表的object_id 可以和dba_objects视图关联取得具体表信息,ID2 值为0
对于TX 锁
ID1以十进制数值表示该事务所占用的回滚段号和事务槽slot number号,其组形式:
0xRRRRSSSS,RRRR=RBS/UNDO NUMBER,SSSS=SLOT NUMBER
ID2 以十进制数值表示环绕wrap的次数,即事务槽被重用的次数
LMODE NUMBER
  • 0 – none
  • 1 – null (NULL)
  • 2 – row-S (SS)
  • 3 – row-X (SX)
  • 4 – share (S)
  • 5 – S/Row-X (SSX)
  • 6 – exclusive (X)
REQUEST NUMBER 同LMODE
–大于0时,表示当前会话被阻塞,其它会话占有改锁的模式
CTIME NUMBER
  • 已持有或者等待锁的时间
BLOCK NUMBER
  • 是否阻塞其他会话锁申请 1:阻塞 0:不阻塞
TYPE 字段内含义:
System Type Description System Type Description

BL

Buffer hash table instance

NA..NZ

Library cache pin instance (A..Z = namespace)

CF

Control file schema global enqueue

PF

Password File

CI

Cross-instance function invocation instance

PI, PS

Parallel operation

CU

Cursor bind

PR

Process startup

DF

datafile instance

QA..QZ

Row cache instance (A..Z = cache)

DL

Direct loader parallel index create

RT

Redo thread global enqueue

DM

Mount/startup db primary/secondary instance

SC

System change number instance

DR

Distributed recovery process

SM

SMON

DX

Distributed transaction entry

SN

Sequence number instance

FS

File set

SQ

Sequence number enqueue

HW

Space management operations on a specific segment

SS

Sort segment

IN

Instance number

ST

Space transaction enqueue

IR

Instance recovery serialization global enqueue

SV

Sequence number value

IS

Instance state

TA

Generic enqueue

IV

Library cache invalidation instance

TS

Temporary segment enqueue (ID2=0)

JQ

Job queue

TS

New block allocation enqueue (ID2=1)

KK

Thread kick

TT

Temporary table enqueue

LA .. LP

Library cache lock instance lock (A..P = namespace)

UN

User name

MM

Mount definition global enqueue

US

Undo segment DDL

MR

Media recovery

WL

Being-written redo log instance



此表使用相关锁脚本:
select a.sid,b.serial#,
decode(a.type,
'TM',c.object_name,
NULL) OBJECT_NAME,
        decode(a.lmode,
                        0,'0:none',
                        1,'1:NULL',
                        2,'2:SS(Row-Share)',
                        3,'3:SX(Row-X)',
                        4,'4:S(Share)',
                        5,'5:SSX(S/Row-X)',
                        6,'6:X(Exclusive)') lmode,
        decode(a.REQUEST,
                        0,'0:none',
                        1,'1:NULL',
                        2,'2:SS(Row-Share)',
                        3,'3:SX(Row-X)',
                        4,'4:S(Share)',
                        5,'5:SSX(S/Row-X)',
                        6,'6:X(Exclusive)')  REQUEST,
                        a.ctime,a.block 
        from v$lock a,v$session b ,dba_objects c where b.sid=a.sid and  c.object_id(+)=a.id1;
oracle--v$lock 字段详解_第1张图片

你可能感兴趣的:(Performance)