← Sessions & Locks
Oracle · Sessions & Locks

How to check DDL and DML locks in Oracle

List Oracle DDL locks (parse and library) and DML locks (TM enqueues) currently held.

Tested on11g12c18c19c21c23ai26ai

DBA_DDL_LOCKS shows parse and library locks — usually breakable, but non-breakable ones block DDL. DBA_DML_LOCKS shows TM enqueues (table-level DML locks).

-- DDL locks (parse / library locks)
SELECT session_id, owner, name, type, mode_held, mode_requested
FROM   dba_ddl_locks
ORDER BY session_id, owner, name;

-- DML locks (TM enqueues on tables)
SELECT session_id, owner, name, mode_held, mode_requested, last_convert
FROM   dba_dml_locks
ORDER BY session_id, owner, name;
locksdba_ddl_locksdba_dml_locks