Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

dba_hist_librarycache


Oracle Tips by Burleson Consulting

dba_hist_librarycache

The dba_hist_librarycache view contains the statistical history for library cache activity. This view stores snapshots for the v$librarycache dynamic view. The library cache stores SQL cursors, Java classes, and PL/SQL programs in executable form. If library cache contention is significant, this view can be queried to get more details about particular library objects that may cause such a contention. These details will give users hints about ways to potentially reduce library cache contention.

 

In order to understand the importance of library cache tuning, users should always be aware that a library and dictionary cache miss is more expensive in terms of resources than data buffer miss because it involves a significant amount of CPU work.

 

SQL> desc DBA_HIST_LIBRARYCACHE

 

Name              Null?    Type

----------------- -------- ------------

SNAP_ID           NOT NULL NUMBER

DBID              NOT NULL NUMBER

INSTANCE_NUMBER   NOT NULL NUMBER

NAMESPACE         NOT NULL VARCHAR2(15)

GETS                       NUMBER

GETHITS                    NUMBER

PINS                       NUMBER

PINHITS                    NUMBER

RELOADS                    NUMBER

INVALIDATIONS              NUMBER

DLM_LOCK_REQUESTS          NUMBER

DLM_PIN_REQUESTS           NUMBER

DLM_PIN_RELEASES           NUMBER

DLM_INVALIDATION_          NUMBER

REQUESTS

DLM_INVALIDATIONS          NUMBER

 

The lib_cache_int_10g.sql query can be used to get a report for library cache statistics.

 

            lib_cache_int_10g.sql

 

 

select b.namespace "Name Space"

     , e.gets - b.gets  "Get Requests"

     , to_number(decode(e.gets,b.gets,null,

       100 - (e.gethits - b.gethits) * 100/(e.gets - b.gets))) "Get Pct Miss"

     , e.pins - b.pins "Pin Requests"

     , to_number(decode(e.pins,b.pins,null,

       100 - (e.pinhits - b.pinhits) * 100/(e.pins - b.pins))) "Pin Pct Miss"

     , e.reloads - b.reloads                                   "Reloads"

     , e.invalidations - b.invalidations                       "Invalidations"

  from dba_hist_librarycache  b

     , dba_hist_librarycache  e

 where b.snap_id         = &pBgnSnap

   and e.snap_id         = &pEndSnap

   and b.dbid            = &pDbId

   and e.dbid            = &pDbId

   and b.dbid            = e.dbid

   and b.instance_number = &pInstNum

 

SEE CODE DEPOT FOR FULL SCRIPTS

 

The following is a possible result of this query.

 

SQL> @ Lib_cache_int_10g.sql

 

Name Space      Get Requests Get Pct Miss Pin Requests Pin Pct Miss    Reloads Invalidations

--------------- ------------ ------------ ------------ ------------ ---------- ------

BODY                    1840   5,76086957         3117   4,39525184         24      0

CLUSTER                  216   2,31481481          532   1,12781955          1      0

INDEX                     37   97,2972973           41    87,804878          0      0

JAVA DATA                  3   33,3333333            5           40          0      0

JAVA RESOURCE              0                         0                       0      0

JAVA SOURCE                0                         0                       0      0

OBJECT                     0                         0                       0      0

PIPE                       0                         0                       0      0

SQL AREA               31706     7,459156       120148   2,84482472        495     60

TABLE/PROCEDURE        13926   17,6576188        83460    5,5415768        425      0

TRIGGER                  119   14,2857143          488   3,89344262          2      0

 

The report shows what particular types of library cache contents have the highest miss percentage. This means that these objects require additional work to reload them back into library cache, thereby causing CPU overhead.

 

The Ion tool has a report named Library Cache, represented in Figure 4.11, which generates charts against the dba_hist_librarycache view.

 

Figure 4.11:  AWR Library Cache chart in Ion*

 

The above Ion screenshot displays a sample chart produced for particular types of library cache objects. This chart shows an activity history of how the database requested particular types of objects during the selected snapshot interval.


 

*       See the code depot page for instructions on downloading a free copy of Ion

 

SEE CODE DEPOT FOR FULL SCRIPTS


This is an excerpt from my latest book "Oracle Tuning: The Definitive Reference". 

You can buy it direct from the publisher for 30%-off and get instant access to the code depot of Oracle tuning scripts:

http://www.rampant-books.com/book_1002_oracle_tuning_definitive_reference_2nd_ed.htm

 


 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2017

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by Conversational