Understanding the Oracle Library Cache Pin Wait Event

By: Richmond Shee, Kirtikumar Deshpande, K Gopalakrishnan


The library cache pin wait event is associated with library cache concurrency. It occurs when the session tries to pin an object in the library cache to modify or examine it. The session must acquire a pin to make sure that the object is not updated by other sessions at the same time. Oracle posts this event when sessions are compiling or parsing PL/SQL procedures and views.

Fig 3-0

Table 1.Latch Events in Oracle Database 10g

What actions to take to reduce these waits depend heavily on what blocking scenario is occurring. A common problem scenario is the use of DYNAMIC SQL from within a PL/SQL procedure where the PL/SQL code is recompiled and the DYNAMIC SQL calls something that depends on the calling procedure. If there is general widespread waiting, the shared pool may need tuning. If there is a blocking scenario, the following SQL can be used to show the sessions that are holding and/or requesting pins on the object that are given in P1 in the wait:

Fig 3-1

Wait Parameters

Wait parameters for library cache pin are described here:

  • P1 Address of the object being examined or loaded
  • P2 Address of the load lock
  • P3 Contains the mode plus the namespace (mode indicates which data pieces of the object are to be loaded; namespace is the object namespace as displayed in V$DB_OBJECT_CACHE view)

 Wait Time

For the PMON process it is one second; for all others it is three seconds.

Leave a Reply