Oracle error
ORA-04021
ORA-04021: timeout occurred while waiting to lock object
What usually causes it
A compile or DDL needed a library cache lock on an object that running sessions have pinned.
What to check first
Find the sessions executing the object and compile during a quiet period.
Scripts that help
- Blocked sessions and their blockersSessions waiting on another session, joined to the blocker. Both sides show as SID,SERIAL#, ready to paste into a kill. On RAC, also check…
- What active sessions are doing right nowActive user sessions grouped by wait event, with CPU shown separately. A quick live picture before you reach for ASH.