Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • moving lob object to other tablespace lob_mvmt.sql Oracle
  • AWR license Oracle
  • get_vmstat.ksh for Solaris Oracle
  • Renaming Global Name GLOBAL_NAME Oracle
  • T-SQL Vs PL/SQL Syntax SQL Server
  • 556976.1 Oracle Clusterware: Components installed Oracle
  • eplan9i.sql Oracle
  • Jai Shree Ram Linux/Unix
  • 10g oem configuration Oracle
  • Zip and unzip with tar Linux/Unix
  • xargs use Linux/Unix
  • Important Script Method for tuning Oracle
  • Nice notes on wait events Oracle
  • All About oracle password and security from metalink Oracle
  • Deleting first line and lastline of a file using sed Linux/Unix

good note for shared pool tunnig

Posted on 16-Feb-2007 By Admin No Comments on good note for shared pool tunnig

Note:396940.1

How many Subpools will I have by default?

The number of subpools is calculated using a simple algorithm. First, a subpool must be at least 128MB in 9i releases and at least 256MB in 10g releases. Bugs and internal tests show that subpools around 500M will work most efficiently and in future versions, we may see higher default sizes in the algorithm. Second, there can be one subpool for every four CPUs on the system, up to 7 subpools. The number of subpools can be explicitly controlled using the init.ora parameter _kghdsidx_count. There is no parameter to explicitly control the size of each subpool.

If someone configured an 12-CPU system with a 300MB shared pool on 9i, Oracle will create two subpools, each of size 150MB. If the shared pool size was increased to 500MB, Oracle will create three subpools, each of size 166MB.

Because 128MB (and even 256MB on 10g) can be small compared to some cursors, the memory per subpool will likely need to be increased. There is no parameter to change the minimum size of the subpool; the only recourse is to decrease the number of subpools for a given shared pool size or increase the shared pool size so the size of the subpools increase. Please remember that increasing the size of the shared pool does not necessarily increase the size of the subpool, because the number of subpools can increase if there are many CPUs on the system.

How do I control the number of subpools used?

To see the number of subpools used currently issue

select a.ksppinm “Parameter”,

b.ksppstvl “Session Value”,

c.ksppstvl “Instance Value”

from sys.x$ksppi a, sys.x$ksppcv b, sys.x$ksppsv c

where a.indx = b.indx and a.indx = c.indx

and a.ksppinm like ‘%kghdsidx%’;

or issue

select count(*) from x$kghlu;

The parameter _kghdsidx_count controls the number of subpools used. Setting the value of this parameter to one “reverts” the shared pool behavior back to 8.1.7 behavior, e.g., one subpool.

SQL> alter system set “_kghdsidx_count”= scope=spfile

or add this in the pfile

“_kghdsidx_count”=

NOTE: Subpools are created at startup when the SGA is created. In both examples above, the database has to be restarted to change the number of subpools created. Any change to the _kghdsidx_count will change the number of subpools in the Large Pool as well.

Are all ORA-04031 errors reported in the alert log?

No. Some errors only show up at the client workstation. They may or may not be reported to the DBA as the user may reissue the command or set of application steps and not see the error again.

You can monitor if users have been seeing ORA-04031 using this code

From website http://www.ixora.com.au/

connect / as sysdba

——————————————————————————-

—

— Script: shared_pool_lru_stats.sql

— Purpose: to check the shared pool lru stats

— For: 8.0 and higher

—

— Copyright: (c) Ixora Pty Ltd

— Author: Steve Adams

—

— NOTE: Per Bug 3352753, this may not work with 9i / added kghlushrpool to Steve’s code for 9i/10g

——————————————————————————-

>column kghluops heading “PINS AND|RELEASES”

column kghlunfu heading “ORA-4031|ERRORS”

column kghlunfs heading “LAST ERROR|SIZE”

column kghlushrpool heading “SUBPOOL”

select

kghlushrpool,

kghlurcr,

kghlutrn,

kghlufsh,

kghluops,

kghlunfu,

kghlunfs

from

sys.x$kghlu

where

inst_id = userenv(‘Instance’)

How can we see a breakdown of the data in the “miscellaneous” structure in V$SGASTAT?

When running a query on v$sgastat, there are cases where you will see a very large value for “miscellaneous”. Until Oracle 10g Release 2, the basic design of the SGA structure internally remained unchanged. There were table entries for various memory “comments” in the data dictionary where we keep statistics on the largest memory “comments” or structures. The smaller structures are lumped together in the memory “comment” called miscellaneous because we tracked only a handful of structures. If you run

select * from v$sgastat where pool=’shared pool’;

on an Oracle7 or Oracle 8i database, you will see a short list of memory “comments” reported back. However, with additional memory “comments” or structures added in later versions of 9.2.0.x and 10.1.x, this became a problem and a redesign was necessary to allow more table entries in the data dictionary for statistics on more of the memory structures. Running the query above on an Oracle 10g Release 2 database will report back a long list of memory structures.

Per bug 3663344, there were occasional inconsistencies in the statistics reported in v$sgastat due to memory structures growing and shrinking over time. Once a memory structure reached an internally controlled size, we moved the data about the memory structure from the general purpose table entry, “miscellaneous”, to a specific memory structure table entry. The problem was usually seen with negative numbers in some memory structures in v$sgastat or at times you would see an unusually large value in “miscellaneous”.

The only way to “drill-down” into the way memory is allocated in the “miscellaneous” area is to get a heapdump trace. You can issue this command

alter system set events ‘4031 trace name HEAPDUMP level 536870914’;

NOTE: Setting this event at the instance level will generate large files and if the 4031 error occurs frequently, you will get many trace files. This can impact performance and hang (and in some cases crash a database). Turn this event off using

alter system set events ‘4031 trace name HEAPDUMP off’;

and at the next occurances of the 4031 problem you will get a breakdown of the memory in the SGA and also the breakdown of memory used in the top five subheaps in the SGA. In this scenario, you would expect one or more of the largest subheaps listed in this trace to be within ‘miscellaneous’. Unfortunately, there isn’t a way to see the entire breakdown within ‘miscellaneous’, but we only need to be concerned about larger than expected entries within ‘miscellaneous’.

To get an immediate memory dump use these steps

alter system set events ‘immediate trace name heapdump level 536870914’;

or

sqlplus /nolog

connect / as sysdba

alter system set max_dump_file_size=unlimited;

oradebug setmypid

oradebug unlimit

oradebug dump heapdump 536870914

oradebug tracefile_name

oradebug close_trace

Close the SQL*Plus session and find the heapdump trace file listed in the ‘oradebug tracefile_name’ command above.

If the problem is actually associated with permanent memory structures (tracked under the ‘miscellaneous’ table entry), there is not a way to get information on these memory areas unless you set the event 10235 level 65536. This event should only be set under direction from Oracle Support.

Oracle, SQL scripts

Post navigation

Previous Post: When to rebuld B-tree index
Next Post: Another Tuning Article for subheap of shared pool

Related Posts

  • Good Doc 28-JUN-2006 Oracle
  • Consolidated Reference List Of Notes For Migration / Upgrade Service Requests -ID 762540.1 Oracle
  • Rename Tablespace Oracle
  • Error Handling in Proc Oracle
  • Settting up get_vmstat.sh for colletinf CPU Usage. Oracle
  • get_vmstat_linux Oracle

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Django (0)
  • GIT (1)
  • Linux/Unix (149)
  • MYSQL (5)
  • Oracle (400)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (1)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (18)
  • rman-dataguard (26)
  • shell (150)
  • SQL scripts (348)
  • SQL Server (6)
  • Uncategorized (3)
  • Videos (0)

Recent Posts

  • Running PDB on single node in RAC09-Apr-2026
  • find_arc.sql09-Apr-2026
  • pvm_pre_change.sql08-Apr-2026
  • find_encr_wallet.sql08-Apr-2026
  • find_pdbs.sql08-Apr-2026
  • Creating a Container Database using dbaascli08-Apr-2026
  • track_autoupgrade_copy_progress.sql01-Apr-2026
  • refre.sql for multitenant01-Apr-2026
  • prepfiles.sh for step by step generating pending statistics files10-Mar-2026
  • tracksqltime.sql05-Mar-2026

Archives

  • 2026
  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Oracle Recommended Patches — Oracle Database ID 756671.1 Oracle
  • Histogram Overview Oracle
  • Rman Notes -1 Oracle
  • mutex in Oracle 10.2.0.2 or Oracle 10g Oracle
  • SQL_PLAN.sql for checking real execution plan Oracle
  • Create type and Grant on it. Oracle
  • SCRIPT TO LIST RECURSIVE DEPENDENCY BETWEEN OBJECTS UTLDTREE.sql Oracle
  • How to set Processes Parameter Oracle

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme