DBA Tips Archive for Oracle


Tuning the Shared Pool

by Jeff Hunter, Sr. Database Administrator

The following SQL script produces a report that will help the DBA to tune the Shared Pool. It produces a report on the library cache hits and misses.

  rem library.sql - lists the library cache
  prompt         ========================= 
  prompt         ========================= 
  prompt (If > 1 then increase the shared_pool_size in init.ora)
  column "LIBRARY CACHE MISS RATIO" format 99.9999
  column "executions"    format 999,999,999
  column "Cache misses while executing"    format 999,999,999
  select sum(pins) "executions", sum(reloads) "Cache misses while executing",
      (((sum(reloads)/sum(pins)))) "LIBRARY CACHE MISS RATIO"
  from v$librarycache; 
  prompt         ========================= 
  prompt          Library Cache Section
  prompt         ========================= 
  prompt hit ratio should be > 70, and pin ratio > 70 ...

  column "reloads" format 999,999,999
  select namespace, trunc(gethitratio * 100) "Hit ratio",
  trunc(pinhitratio * 100) "pin hit ratio", reloads "reloads"
  from v$librarycache;

  Sample Output
  NAMESPACE       Hit ratio pin hit ratio      reloads
  --------------- --------- ------------- ------------
  SQL AREA               98            98            7
  TABLE/PROCEDURE        79            50            0
  BODY                   54            50            0
  TRIGGER                 0             0            0
  INDEX                   0             0            0
  CLUSTER                96            97            0
  OBJECT                100           100            0
  PIPE                  100           100            0

  8 rows selected.

Copyright (c) 1998-2018 Jeffrey M. Hunter. All rights reserved.

All articles, scripts and material located at the Internet address of http://www.idevelopment.info is the copyright of Jeffrey M. Hunter and is protected under copyright laws of the United States. This document may not be hosted on any other site without my express, prior, written permission. Application to host any of the material elsewhere can be made by contacting me at jhunter@idevelopment.info.

I have made every effort and taken great care in making sure that the material included on my web site is technically accurate, but I disclaim any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on it. I will in no case be liable for any monetary damages arising from such loss, damage or destruction.

Last modified on
Tuesday, 06-Apr-1999 00:00:00 EDT
Page Count: 18204