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 


 

 

 


 

 

 

 
 

session_cached_cursors sizing

Oracle Database Tips by Donald Burleson


As we know, as new SQL enters the database Oracle checks the library cache for parsed SQL statements, and the session_cached_cursors can be used to ?pin? the cursors for the most popular SQL.

Pinning SQL with session_cached_cursors is especially useful for reentrant SQL that contains hoist variables, and there are many incarnations of the SQL, each with a different host variable value.  The session_cached_cursors parameter is used to reduce the amount of parsing with SQL statements that use host variables and with PL/SQL cursors. 

The session_cached_cursors parameter has a default value of 50, and increasing the value of session_cached_cursors will requires a larger shared_pool_size to cache the cursors. 

Many shops double the default value for session_cached_cursors to 100, and some use values as high as 1,000, depending on the application.

Oracle notes that the session_cached_cursors is related to the open_cursors parameter and if you are concerned that cursors are being paged-out of the library cache, increasing session_cached_cursors up to the value of open_cursors can improve performance.

To monitor the benefit increasing session_cached_cursors, we look for the session cursor cache hits value in our STATSPACK or AWR reports.  We can also see this metric with data dictionary scripts.

col c1 heading 'sID?
col c2 heading ?Cache|Hits?
col c3 heading ?All Parsing?
col c4 heading Un-used Session|Cached Cursors?

select
   sid         c1,
   stat1.value c2,
   stat2.value c3,
   stat2.value c4
from
   v$sesstat  stat1,
   v$sesstat  stat2,
   v$statname name1,
   v$statname name2
where
   stat1.statistic# = name1.statistic# 
and
   name1.statistic# = name2.statistic#;
and
   name1.name = 'session cursor cache hits'
and
   stat2.statistic#=name2.statistic#
and
   name2.name= 'parse count (total)'
and
   stat2.sid= stat1.sid

 

The session_cached_cursors parameter is used to reduce the amount of parsing with SQL statements that use host variables. 

The session_cached_cursors parameter has a default value of 50, and increasing the value of session_cached_cursors will requires a larger shared_pool_size to cache the cursors. 

Many shops double the default value for session_cached_cursors to 100, and some use values as high as 1,000, depending on the application.

From the Oracle 9.2.0.5 patchset notes:

However, if you have session_cached_cursors set to zero, or set at a value significantly lower than the open_cursors parameter, and you are concerned that PL/SQL cursors need to be cached for optimal performance, then you should ensure that the session_cached_cursors parameter is increased appropriately.

This suggests a starting point for session_cached_cursors at 50:

 If you do not have this parameter set already (session_cached_cursors) then it is advisable to set it to a starting value of about 50.

The statistics section of the bstat/estat report includes a value for 'session cursor cache hits' which shows if the cursor cache is giving any benefit.

Sizing session_cached_cursors

Here are some great tips by Steve Adams for sizing your session_cached_cursors:

"The session cursor cache is an important facility for reducing load on the library cache. In our opinion, the session_cached_cursors parameter should always be set to at least 2.

However, a larger value is normally beneficial.

The session cursor cache can be constrained by either the session_cached_cursors parameter, or the open_cursors parameter.

This script reports the current maximum usage in any session with respect to these limits.

If either of the usage figures approaches 100%, then the corresponding parameter should normally be increased."

 
Get the Complete
Oracle SQL Tuning Information 

The landmark book "Advanced Oracle SQL Tuning  The Definitive Reference"  is filled with valuable information on Oracle SQL Tuning. This book includes scripts and tools to hypercharge Oracle 11g performance and you can buy it for 30% off directly from the publisher.


 

 

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