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 


 

 

 


 

 

 
 

Oracle library cache contention tips

Oracle Database Tips by Donald BurlesonAugust 31, 2015


The Oracle shared pool contains Oracle's library cache, which is responsible for collecting, parsing, interpreting, and executing all of the SQL statements that go against the Oracle database. Hence, the shared pool is a key component which can experience frequent contention, so it's necessary for the Oracle database administrator to check for shared pool contention.
Oracle library cache contention is easy to understand once you know how Oracle processes SQL statements. The library cache is used like the data buffers, a place to store ready-to-run SQL which has already been parsed, semantically checked, optimized and has a load-and-go execution plan in-place.
Library cache contention occurs when Oracle places a "latch" on a SQL statement in order to manage concurrency. There is a dedicated latch-related wait event for the more popular latches that often generate significant contention. For those events the name of the latch appears in the name of the wait event; such as latch: library cache or latch: cache buffers chains. This enables you to quickly figure out if a particular type of latch is responsible for most of the latch-related contention.
Oracle library cache pin wait contention is caused by contention with the library cache, the area used to store SQL executables for re-use.  The library cache pin wait usually happens when you are compiling or parsing a PL/SQL object or a view.
The following query can show whether Oracle has contention for common library cache activities:
select
   sid,
   event,
   p1raw,
   seconds_in_wait,
   wait_time
from
   v$session_wait
where
   event = 'library cache pin'
and
   state = 'WAITING';

Library cache latches function to protect all cached SQL statements as well as the associated object definitions contained within the library cache region in the shared pool of the Oracle SGA. Whenever new statements are added to the library cache area, this type of latch must be acquired by Oracle as part of the operation. Oracle scans the library cache area during the parse phase for matching SQL statements. If one is not found, then Oracle will complete the task, obtain the library cache latchfor the SQL statement and then insert it into the library cache area for future usage by the Oracle database.

There is a hidden Oracle database initialization parameter called kgl_latch_countwhich controls behavior in terms of the number of library cache latches created within the Oracle database. By default, this value should not be changed as it is sufficiently set in most cases. In the event that there should be a library cache contention issue and no other recourse is available to resolve the contention with the library cache latch, this value can be increased.

By the way, the default value for kgl_latch_countis set to the following prime number plus value of the database initialization parameter for cpu_count. The maximum allowable value for kgl_latch_count is no greater than 66 according to Oracle support per Bug # 1381824. Now move on to learning more about shared pool latches within Oracle.


5.      dba_hist_librarycache


 

 

��  
 
 
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 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.