Library cache pin (%)

Description

Library cache pins are used to manage library cache concurrency. Pinning an object causes the heaps to be loaded into memory (if not already loaded). PINS can be acquired in NULL, SHARE or EXCLUSIVE modes and can be considered like a special form of lock. A wait for a "library cache pin" implies some other session holds that PIN in an incompatible mode.

Metric Summary

The rest of the information in this section is only valid for this metric when it appears in either the Enterprise Manager Grid Control or the Enterprise Manager Database Control (if applicable).

The following table shows how often the metric's value is collected and compared against the default thresholds. The 'Consecutive Number of Occurrences Preceding Notification' column indicates the consecutive number of times the comparison against thresholds should hold TRUE before an alert is generated.

Target Version

Evaluation and Collection Frequency

Upload Frequency

Operator

Default Warning Threshold

Default Critical Threshold

Consecutive Number of Occurrences Preceding Notification

Alert Text

pre-10g

Every Minute

After Every Sample

>

20

Not Defined

3

%value%%% of service time is spent waiting on the 'library cache pin' event.

Data Source

(DeltaLibraryCachePinTime/DeltaServiceTime)*100 where:

See Idle Events

User Action

What to do to reduce these waits depends 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 which depends on the calling procedure.

The following query will list the waiters and the session holding the pin, along with the wait event the holder is waiting for.

column h_wait format A20
SELECT s.sid,
    waiter.p1raw w_p1r,
    holder.event h_wait,
    holder.p1raw h_p1r,
    holder.p2raw h_p2r,
    holder.p3raw h_p2r,
    count(s.sid) users_blocked,
    sql.hash_value
FROM
    v$sql sql,
    v$session s,
    x$kglpn p,
    v$session_wait waiter,
    v$session_wait holder
WHERE
    s.sql_hash_value = sql.hash_value and
    p.kglpnhdl=waiter.p1raw and
    s.saddr=p.kglpnuse and
    waiter.event like 'library cache pin' and
    holder.sid=s.sid
GROUP BY
    s.sid,
    waiter.p1raw ,
    holder.event ,
    holder.p1raw ,
    holder.p2raw ,
    holder.p3raw ,
    sql.hash_value
;

Related Topics

About Alerts

About the Metric Detail Page

Editing Thresholds

Understanding Line Charts