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 


 

 

 


 

 

 

 
 

Top Oracle shared pool scripts

Oracle Database Tips by Donald Burleson


The Oracle shared pool has very few tuning knobs other than adjusting the shared_pool_size, setting cursor_sharing and tuning the SQL that reside within the library cache of the shared pool.

A shortage of shared pool RAM may result in high library cache reloads, high row cache reloads, and shared pool latch contention. You may also see the error: "ORA-04031: Out of shared pool memory".

Also see Oracle shared pool latch internals.

Oracle shared pool scripts

Here are some common shared pool scripts for monitoring the shared pool.  For a complete set of shared pool scripts, see my book "Oracle Tuning: The Definitive Reference", with 950 pages of tuning tips and scripts. 

select *
from(
   select
      name, bytes/(1024*1024) MB
   from
      v$sgastat
   where
      pool ='shared pool'
   order by
      bytes desc
   )
where rownum < 20;

We also need scripts to monitor for non-reentrant SQL (SQL without bind variables, which can be corrected by setting cursor_sharing=force). This shared pool script will identify SQL where "executions=1", indicating nonreentrant SQL:

select
   count(1) num_sql,
   sum(decode(executions, 1, 1, 0)) one_use_sql,
   sum(sharable_mem)/1024/1024      meg_used,
   sum(decode(
      executions,   1,
      sharable_mem, 0)
   )/1024/1024                      mb_per
from
   v$sqlarea
where
   sharable_mem > 0;

This shared pool script will display shared pool data from STATSPACK:

set lines 80; 
set pages 999; 
 
column mydate heading 'Yr.  Mo Dy  Hr.' format a16 
column c1 heading "execs"    format 9,999,999 
column c2 heading "Cache Misses|While Executing"    format 9,999,999 
column c3 heading "Library Cache|Miss Ratio"     format 999.99999 
 
break on mydate skip 2; 
 
select  
   to_char(snap_time,'yyyy-mm-dd HH24')  mydate, 
   sum(new.pins-old.pins)               c1, 
   sum(new.reloads-old.reloads)          c2, 
   sum(new.reloads-old.reloads)/ 
   sum(new.pins-old.pins)                library_cache_miss_ratio 
from  
   stats$librarycache old, 
   stats$librarycache new, 
   stats$snapshot     sn 
see code depot for full scripts
where 
   new.snap_id = sn.snap_id 
and 
   old.snap_id = new.snap_id-1 
and 
   old.namespace = new.namespace 
group by 
   to_char(snap_time,'yyyy-mm-dd HH24') 
;
 

This shared pool script will use the automatic workload repository (AWR) for a time-series look at the shared pool:

column enqueue_deadlocks format 999,999,999

select
   to_char(sn.end_interval_time,'dd Mon HH24:mi:ss') mydate,
   a.value enqueue_deadlocks
from
   dba_hist_sysstat a,
   dba_hist_snapshot sn
see code depot for full scripts
where
   sn.snap_id = (select max(snap_id) from dba_hist_snapshot)
   and a.snap_id = sn.snap_id
   and a.stat_name = 'enqueue deadlocks'
;
 

 
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.