Monday, February 23, 2015

Row cache enqueue lock

Row cache enqueue lock 

Question:  What are row cache enqueue locks?  I see many row cache enqueue locks and I need to know how to remove this event?

The row cache enqueue lock is caused by DDL locking portions of the data dictionary as you create a table/index of other DDL command.  The row cache lock escalates into the row cache enqueue lock when multiple DDL statements are waiting to execute.  The row cache enqueue locks are allocated within the shared_pool_size region of the SGA.

If the lock wait exceed a predefined threshold, the DDL will abort and cause a trace file to be generated.  This trace file will contain the string “WAITED TOO LONG FOR A ROW CACHE ENQUEUE LOCK”.

Note:  Long-running DDL (alter table xxx move" is far more likely to generate a row cache enqueue lock than a fast-running DDL statement (e.g. truncate table).
The solution to excessive row cache enqueue lock waits is:
1 - Serialize the DDL running on a small number of concurrent DDL tasks.
2 - If the row cache enqueue locks are for dc_sequences, consider using DBMS_SHARED_POOL.KEEP to pin your sequences.
Specifically, the row cache enqueue lock is within the data dictionary files and they tend to be located in the dc_objects and dc_tablespaces.
You can run this script to see data dictionary row cache statistics by querying the v$rowcache view:

REM SET FLUSH OFF
REM SET TERM OFF
SET HEAD ON
SET PAGESIZE 59
SET LINESIZE 79
COLUMN parameter FORMAT A20
COLUMN type FORMAT a11
COLUMN percent FORMAT 999.99    HEADING "%";
COLUMN gets FORMAT 999,999      HEADING 'Gets'
COLUMN getmisses FORMAT 999,999 heading 'Get|Misses'
COLUMN count FORMAT 999,999     heading 'Count'
COLUMN usage FORMAT 999,999     HEADING 'Usage'
ttitle "DATA DICTIONARY CACHE STATISTICS"

SPOOL rep_out/ddcache.lis
SELECT
   parameter,
   type,
   gets,
   getmisses,
   ( getmisses / gets * 100) percent,
   count,
   usage
FROM
   v$rowcache
WHERE
   gets > 100 AND
   getmisses > 0
ORDER BY parameter;



No comments:

Post a Comment