Ch 03: Locks, Latches, and Mutexes

DML Locks

TX (Transaction)

Transaction ID = Segment #, Slot, Sequence #

LMODE = 6 exclusive

DBA_WAITERS

Insufficient transaction slots in a block will cause ORA-54 (resource busy) even if no one else has locked the row.

INITRANS defaults to 2 even though Data Dictionary shows 1 for tables.

TM (DML Equeue)

TM locks are used to ensure that the structure of a table is not altered while you are modifying its contents.

For Oracle 11.2+, DDL_LOCK_TIMEOUT

AE (Edition Lock)

TM ID1 = Object ID

Setting DML_LOCKS = 0 means no DDL allowed.

ALTER TABLE t DISABLE TABLE LOCK

DDL

In Oracle RDBMS, DDL always commit.

Lock Type Description
Exclusive Table R/O
Shareable Protects structures, allows DML
Breakable Parse Notification to plans

DL (Direct Load)

Prevent direct load during online index creation

OD (Online DDL)

11G +

DBA_DDL_LOCKS created through catblock.sql

Cannot DCL on executing procedures

Latches

Latches are lightweight serialisation devices used to coordinate multiuser access to shared data structures, objects, and files.

Miss count

Mutex is a lightweight latch but with less functionality.

Manual Locking

DBMS_LOCK