Shared Pool Fragmentation View (x$..., k$, ....)

Hi,
does anybody know, if there is a view where i can see at which position in the shared pool there is free space and where are objects?
Reason. I would like to build a fragmentation map (like the EM Tablespace Map)
Thanks
Marco

There is a view called X$KSMSP which you can search in metalink which would let you know the size of chunks which are free but will not tell the location..Secondly queries on this table are known to cause performance impact..I believe making a fancy map is not such a good idea. Just ensure that your hard parses are not more i.e using bind variables and child cursors are not getting generated.<br><br>
Amit<br>
www.askdba.org<br>
www.askdba.org/weblog/

Similar Messages

  • Shared pool fragmentation

    Find below a modified version of a script retrieved from Metalink 146599.1 to check for shared pool fragmentation
    I am not sure if it is possible, but is there any way to incorporate into this script a query that will show the effectiveness of using an ALTER SYSTEM FLUSH SHARED_POOL command .
    select bucket, freespace,
    ROUND(ratio_to_report(freespace) over () * 100, 5) AS "Percentage"
    from
    (select '0 (<140)' BUCKET, sum(KSMCHSIZ) freespace
    from x$ksmsp
    where KSMCHSIZ<140
    and KSMCHCLS='free'
    UNION ALL
    select '1 (140-267)' BUCKET, sum(KSMCHSIZ) freespace
    from x$ksmsp
    where KSMCHSIZ between 140 and 267
    and KSMCHCLS='free'
    UNION ALL
    select '2 (268-523)' BUCKET, sum(KSMCHSIZ) freespace
    from x$ksmsp
    where KSMCHSIZ between 268 and 523
    and KSMCHCLS='free'
    UNION ALL
    select '3-5 (524-4107)' BUCKET, sum(KSMCHSIZ) freespace
    from x$ksmsp
    where KSMCHSIZ between 524 and 4107
    and KSMCHCLS='free'
    UNION ALL
    select '6+ (4108+)' BUCKET, sum(KSMCHSIZ) freespace
    from x$ksmsp
    where KSMCHSIZ >= 4108
    and KSMCHCLS='free');

    Running this SQL, flushing the shared pool, and the re-running should show what the difference before and after is - or does this not suffice?
    Flushing the shared pool is also not really addressing the root cause - which most often is non-sharable SQL.
    Thus I'm not exactly sure what you're trying to achieve here. The SQL identifies the symptoms - flushing the shared pool treats those symptoms. For a while.
    Surely you should rather be looking at the shared pool itself to determine what the problem is and try and fix that instead? A db logon trigger for a poorly written app can for example force cursor sharing for all sessions created by that app.

  • Oracle shared pool fragmentation

    We are running Identity Manager 7.0 using an Oracle database repository. We've been seeing shared pool fragmentation in the database resulting in various java.io.IOException: ORA-00600: internal error code messages when using bulk actions to create and remove accounts. Flushing the oracle shared pool is the only way we've found to clear these errors. Has anyone run into similar problems and found any solution other than increasing the size of the shared pool and issuing an 'alter system flush shared_pool' command periodically?

    Scott Heaton wrote:
    We have an application running WebLogic 5.1 against an Oracle 8.1.7.4 database
    and are seeing very rapid fragmentation of the Oracle database shared pool, ultimately
    resulting in an ORA-04031 error (unable to allocate xxxx bytes of shared memory).
    I'm curious if there are are known issues with WebLogic 5.1 regarding the database
    shared pool, retaining a handle to SQL statements issues (so that they cannot
    be released), or anything similar? Thanks.What sp level of 5.1? We are caching prepared statements in the later versions,
    so for every pooled connection there will be up to 10 (or whatever cache size
    you set) prepared statements cached for re-use, and each of these will retain
    a DBMS-side cursor. I am not an oracle DBA so I don't know if this relates directly
    to the shared pool fragmentation...
    Joe

  • Shared versus dedicated connections in the fragmentation of shared pool mem

    Hi,
    I have a old Oracle 8.1.7 database server.
    I have a legacy application with no source code. This application don't use memory efficiently (no bind variables, etc.) , ie memory becomes fragmented.
    I know that exists two ways to connect the database (dedicated and shared)
    Based on this, I want to know which of the two options creates more fragmentation. I know that recommendation is to use dedicated connection, but I'm not sure if this is recomendation is applicable in this particular environment.
    Thanks in advance.

    Whether you use shared or dedicated connections makes no difference for fragmentation in the shared pool. Whether your hard parse or do not hard parse does matter.
    Measures you can take
    - make sure often used packages like dbms_standard are pinned in the shared pool using a startup trigger
    - set session_cached_cursors to 50 or 100. This will reduce parsing.
    Sybrand Bakker
    Senior Oracle DBA

  • Equivalence of two statment  at point of view sharing in shared pool

    Hello !
    Please explain,
    by what quantity of symbols hash-funtion defined what two statment is
    equivalent (at point of view sharing in shared pool)
    Best regards,
    Paul

    Hi,
    If i understood your question correctly, you want to know when two or more statements share same cursor( in library cache). The reasons if it can use following
    1) statement is prefectly identical.
    2) Use same optimizer env
    3) Use same user id who executes the statement
    4) Use same session parameters
    5) Use same bind datatype
    6) Use same bind data length
    7) Have same OPTIMIZER_MODE
    8) If cursor is not purged.
    Further reasons can be found in V$SQL_SHARED_CURSOR, that why cursor was not shared.
    Hope this Helps

  • Shared Pool utilisation

    Hello Team:
    I ran a metalink script to report the shared pool utilization recently. I took this output when the database was on peak load.
    SQL> /
    Obj mem: 66435759 bytes (63.36MB)
    Shared sql: 324219036 bytes (309.2MB)
    Cursors: 341207073 bytes (325.4MB)
    Free memory: 67228508 bytes (64.11MB)
    Shared pool utilization (total): 468785754 bytes (447.07MB)
    Shared pool allocation (actual): 754974720bytes (720MB)
    Percentage Utilized: 91%
    does this mean I have to add more space to shared pool. If so what is the threshold value?
    Regards,
    Bala

    Bhawani nandan Prasad - Principal DBA -- See a to z diagnostics about Shared pool
    1. Memory     2
    a. Shared Pool     2
    1. Introduction     2
    2. Architecture     2
    3. Scripts for different DBA tasks:     5
    a.Measure object usage inside the shared pool and Tune shared pool     7
    b.Check reload problem in library cache     12
    c.Find the large queries in the shared pool library cache (using > 4mb each)     13
    d.Find objects that can be considered pining into the shared pool     13
    e.LRU work and objects were loaded and flushed     13
    f.How much are waiting for Library Cache Latch     14
    g.Queries identical but aren’t shared.     14
    h.Get Biggest chunk of free memory.     14
    i.Check the shared pool reserved size status     16
    j.When having multiple subheaps:     16
    k.Check shared pool at first glance quick diagnostics     17
    l.Memory Usage - object list level view     17
    m.Loads Number of times object has been loaded     17
    n.Check number of times and object has been executed     18
    o.Check shared pool in more details     18
    p.Library Cache Statistics     18
    q.Reserve Pool Settings     19
    r.Pinned Objects     19
    s.Finding literal SQL     19
    t.Finding the Library Cache hit ratio     19
    u. Row Cache Misses – Dictionary cache stats     19
    v. Checking hash chain lengths     20
    w. Checking for high version counts     20
    x. Finding statement/s which use lots of shared pool memory     20
    y. Allocations causing shared pool memory to be 'aged' out     21
    z. Issues in various Oracle Releases     21
    4. Terminology     22
    5. Oracle 11g Caching and Pooling – SQL Result Cache     27
    6. References     37
    2. SQL     38
    3. Statistics     38
    4. Wait events     38
    5. Schema     39
    6. General     39
    a. Scripts     39
    1. accept.sql     39
    1. Memory
    a. Shared Pool
    1. Introduction
    Shared pool is used to cache different types of data such as textual and executable forms of PL/SQL blocks and SQL statements, dictionary cache data, and other data in SGA. Additional shared memory needed in the SHARED POOL if using ASM storage. Gathering schema/database stats (table/index stats) makes database query performance better and it reduce utilization of shared pool. Hence, practice to schedule job to gather stats regularly which suites your database performance. If you use shared pool effectively you can reduce resource consumption in at least four ways
    1.     Parse overhead is avoided if the SQL statement is already in the shared pool. This saves CPU resources on the host and elapsed time for the end user.
    2.     Latching resource usage is significantly reduced, which results in greater scalability.
    3.     Shared pool memory requirements are reduced, because all applications use the same pool of SQL statements and dictionary resources.
    4.     I/O resources are saved, because dictionary elements that are in the shared pool do not require disk access.
    This sharable area of memory is managed as a sophisticated cache and heap manager rolled into one. It has 3 fundamental problems to overcome:
    1.     The unit of memory allocation is not a constant - memory allocations from the pool can be anything from a few bytes to many kilobytes
    2.     Not all memory can be 'freed' when a user finishes with it (as is the case in a traditional heap manager) as the aim of the shared pool is to maximize share of information. The information in the memory may be useful to another session - Oracle cannot know in advance if the items will be of any use to anyone else or not.
    3.     There is no disk area to page out to so this is not like a traditional cache where there is a file backing store. Only "rewriteable" information can be discarded from the cache and it has to be re-created when it is next needed.
    Oracle 10g architecture of Shared pool:
    Library Cache     Shared SQL Area (Hash Value, SQL source, Execution plan)
    Data Dictionary Cache
    Enqueues     Fixed Area     Other
    Latches          
    Oracle 11g architecture of Shared pool:
    Library Cache     Shared SQL Area (Hash Value, SQL source, Execution plan)
    Data Dictionary Cache
    Result Cache
    Enqueues     Fixed Area     Other
    Latches          
    1. Library Cache
    Shared Sql Area: contains Parsed SQL and execution Plans for statements already run against the database. This area allows SQL execution plans to be reused by many users.
    Private SQL Area: Private SQL areas are non-shared memory areas assigned to unique user sessions.
    Pl/sql Area: contains the recently executed Procedures, Functions and Packages.
    Control Structures: Common control structure information example Memory for Latches and locks, sequence cache.
    2. Dictionary cache known as the row cache.
    Dictionary cache stores all the metadata info of tables and views in the database, Names and data types of the columns in the database, Object and system privileges of all the Users. Oracle maintains the stats of all the objects in the shared pool, if any of the memory objects are not used from the last 3 seconds, these memory objects will be aged out and will be removed from the cache. All the Shared Pool Structures are maintained by a LRU (least recently Used) algorithm, by which Oracle removes the objects from the shared Pool, until there is enough free space in the shared Pool to keep new Object.
    3. Scripts for different DBA tasks:
    Dictionary Views for shared POOL:
    NON-RAC
    V$DB_CACHE_ADVICE
    V$DB_OBJECT_CACHE
    V$DLM_LATCH
    V$DLM_LOCKS
    V$LATCH
    V$LATCHHOLDER
    V$LATCHNAME
    V$LATCH_CHILDREN
    V$LATCH_MISSES
    V$LATCH_PARENT
    V$LIBRARYCACHE
    V$LOCK
    V$LOCKED_OBJECT
    V$LOCKS_WITH_COLLISIONS
    V$LOCK_ACTIVITY
    V$LOCK_ELEMENT
    V$OPEN_CURSOR
    V$PROCESS
    V$PX_PROCESS
    V$PX_PROCESS_SYSSTAT
    V$PX_SESSION
    V$PX_SESSTAT
    V$ROWCACHE
    V$ROWCACHE_PARENT
    V$ROWCACHE_SUBORDINATE
    V$SESSION
    V$SESSION_CONNECT_INFO
    V$SESSION_CURSOR_CACHE
    V$SESSION_EVENT
    V$SESSION_LONGOPS
    V$SESSION_OBJECT_CACHE
    V$SESSION_WAIT
    V$SESSTAT
    V$SESS_IO
    V$SGA
    V$SGASTAT
    V$SGAINFO
    V$SGA_DYAMIC_COMPONENTS
    V$SGA_DYNAMIC_FREE_MEMORY
    V$SGA_RESIZE_OPS
    V$SGA_CURRENT_RESIZE_OPS
    v$shared_pool_advice
    V_$SHARED_POOL_ADVICE
    V$SHARED_POOL_RESERVED
    V$SHARED_SERVER
    V$SORT_SEGMENT
    V$SORT_USAGE
    V$SQL
    V$SQLAREA
    V$SQLTEXT
    V$SQLTEXT_WITH_NEWLINES
    V$SQL_BIND_DATA
    V$SQL_BIND_METADATA
    V$SQL_CURSOR
    V$SQL_SHARED_CURSOR
    V$SQL_SHARED_MEMORY
    V$STATNAME
    V$SUBCACHE
    V$SYSSTAT
    V$SYSTEM_CURSOR_CACHE
    V$SYSTEM_EVENT
    V$SYSTEM_PARAMETER
    X$KSMSP
    RAC
    GV$LATCH
    GV$LATCHHOLDER
    GV$LATCHNAME
    GV$LATCH_CHILDREN
    GV$LATCH_MISSES
    GV$LATCH_PARENT
    GV$LIBRARYCACHE
    GV$LOCK
    GV$LOCKED_OBJECT
    GV$LOCKS_WITH_COLLISIONS
    GV$LOCK_ACTIVITY
    GV$LOCK_ELEMENT
    GV$PROCESS
    GV$PX_PROCESS
    GV$PX_PROCESS_SYSSTAT
    GV$PX_SESSION
    GV$PX_SESSTAT
    GV$ROWCACHE
    GV$ROWCACHE_PARENT
    GV$ROWCACHE_SUBORDINATE
    GV$SESSION
    GV$SESSION_CONNECT_INFO
    GV$SESSION_CURSOR_CACHE
    GV$SESSION_EVENT
    GV$SESSION_LONGOPS
    GV$SESSION_OBJECT_CACHE
    GV$SESSION_WAIT
    GV$SESSTAT
    GV$SESS_IO
    GV$SGA
    GV$SGASTAT
    gv$shared_pool_advice
    GV$SHARED_POOL_RESERVED
    GV$SHARED_SERVER
    GV$SORT_SEGMENT
    GV$SORT_USAGE
    GV$SQL
    GV$SQLAREA
    GV$SQLTEXT
    GV$SQLTEXT_WITH_NEWLINES
    GV$SQL_BIND_DATA
    GV$SQL_BIND_METADATA
    GV$SQL_CURSOR
    GV$SQL_SHARED_CURSOR
    GV$SQL_SHARED_MEMORY
    GV$STATNAME
    GV$SUBCACHE
    GV$SYSSTAT
    GV$SYSTEM_CURSOR_CACHE
    GV$SYSTEM_EVENT
    GV$SYSTEM_PARAMETER
    GV$WAITSTAT
    GV$_LOCK
    a.Measure object usage inside the shared pool and Tune shared pool
    set pagesize 132
    column owner format a16
    column name format a36
    column sharable_mem format 999,999,999
    column executions format 999,999,999
    prompt
    prompt Memory Usage of Shared Pool Order - Biggest First
    prompt
    column name format 45
    select owner, name||' - '||type name, sharable_mem from v$db_object_cache
    where sharable_mem > 10000
    and type in ('PACKAGE', 'PACKAGE BODY', 'FUNCTION', 'PROCEDURE')
    order by sharable_mem desc
    prompt
    prompt Loads into Shared Pool - Most Loads First
    prompt
    select owner, name||' - '||type name, loads , sharable_mem from v$db_object_cache
    where loads > 3
    and type in ('PACKAGE', 'PACKAGE BODY', 'FUNCTION', 'PROCEDURE')
    order by loads desc
    prompt
    prompt Executions of Objects in the Shared Pool - Most Executions First
    prompt
    select owner, name||' - '||type name, executions from v$db_object_cache
    where executions > 100
    and type in ('PACKAGE', 'PACKAGE BODY', 'FUNCTION', 'PROCEDURE')
    order by executions desc
    select 'If the values for the EXEC and LOADS close increase SHARED_POOL_SIZE!' from dual ;
    set feedback off
    set linesize 80
    set pagesize 52
    clear columns
    clear breaks
    col executions HEADING EXEC
    col sharable_mem heading SHAMEM
    col owner format a8
    col name format a30
    col type format a12
    set numwidth 8
    ttitle center 'Data Base Objects Owned by All Users Statistics' skip 2
    select name, type, sharable_mem, loads, executions, pins
    from sys.v_$db_object_cache ;
    b.Check reload problem in library cache
    select namespace, pins, reloads from v$librarycache;
    show parameters shared_pool
    select bytes/1024/1024 from v$sgastat where pool='shared pool' and name='free memory';
    c.Find the large queries in the shared pool library cache (using > 4mb each)
    SELECT sql_text "Stmt", count(*), sum(sharable_mem) "Mem",
    sum(users_opening) "Open", sum(executions) "Exec"
    FROM v$sql GROUP BY sql_text HAVING sum(sharable_mem) > 4096000;
    d.Find objects that can be considered pining into the shared pool
    column name format a40
    column owner format a15
    select owner, name, executions, locks, pins, loads, kept from v$db_object_cache where loads > 10;
    create temp table and insert records of candidates to be pinned.
    CREATE TABLE LRU_TMP AS SELECT * FROM X$KSMLRU;
    INSERT INTO LRU_TMP SELECT * FROM X$KSMLRU;
    Use the LRU_TMP table for analysis.
    SELECT USERNAME, KSMLRCOM, KSMLRHON, KSMLRNUM, KSMLRSIZ, SQL_TEXT
    FROM V$SQLAREA A, LRU_TMP K, V$SESSION S WHERE KSMLRSIZ > 3000
    AND A.ADDRESS=S.SQL_ADDRESS AND A.HASH_VALUE = S.SQL_HASH_VALUE
    AND SADDR=KSMLRSES;
    You can see the candidates to pin from the query below
    COL STORED_OBJECT FORMAT A40;
    COL SQ_EXECUTIONS FORMAT 999,999;
    SELECT /*+ ORDERED USE_HASH(D) USE_HASH(C) */ O.KGLNAOWN||’.'||O.KGLNAOBJ STORED_OBJECT, SUM(C.KGLHDEXC) SQL_EXECUTIONS
    FROM SYS.X$KGLOB O, SYS.X$KGLRD D, SYS.X$KGLCURSOR C
    WHERE
    O.INST_ID = USERENV(’INSTANCE’) AND
    D.INST_ID = USERENV(’INSTANCE’) AND
    C.INST_ID = USERENV(’INSTANCE’) AND
    O.KGLOBTYP IN (7, 8, 9, 11, 12) AND
    D.KGLHDCDR = O.KGLHDADR AND
    C.KGLHDPAR = D.KGLRDHDL
    GROUP BY O.KGLNAOWN, O.KGLNAOBJ
    HAVING SUM(C.KGLHDEXC) > 0
    ORDER BY 2 DESC;
    How to pin object
    EXECUTE SYS.DBMS_SHARED_POOL.SIZES(150);
    EXECUTE SYS.DBMS_SHARED_POOL.KEEP('SYS.STANDARD');
    EXECUTE SYS.DBMS_SHARED_POOL.UNKEEP('SYS.STANDARD');
    e.LRU work and objects were loaded and flushed
    LRU work in the shared pool KSMLRNUM stores the number of objects that were flushed to load the large object. KSMLRISZ stores the size of the object that was loaded (contiguous memory allocated)
    column ksmlrcom format a20
    column username format a5
    select username,sid,KSMLRCOM,KSMLRSIZ,KSMLRNUM, KSMLRHON, KSMLROHV, KSMLRSES from x$ksmlru , v$session where KSMLRSES=SADDR and KSMLRNUM >2 ;
    f.How much are waiting for Library Cache Latch
    select count(*),event from v$session_wait where event not like '%SQL%' and event not like '%ipc%' and event not like '%timer%' GROUP BY EVENT;
    select count(*),wait_time from v$session_wait where event='latch free' and p2=106 group by wait_time;
    select sid,wait_time,seconds_in_wait from v$session_wait where event='latch free' and p2=106 and WAIT_TIME>1;
    g.Queries identical but aren’t shared.
    SELECT address, hash_value, version_count , users_opening , users_executing,
    substr(sql_text,1,240) "SQL" FROM v$sqlarea WHERE version_count > 10;
    h.Get Biggest chunk of free memory.
    select sysdate, decode( sign(ksmchsiz - 812), -1, (ksmchsiz - 16) / 4,
    decode(sign(ksmchsiz - 4012),-1, trunc((ksmchsiz + 11924) / 64),
    decode(sign(ksmchsiz - 65548), -1, trunc(1/log(ksmchsiz - 11, 2)) + 238,254))) bucket,
    sum(ksmchsiz) free_space, count(*) free_chunks, trunc(avg(ksmchsiz)) average_size,
    max(ksmchsiz) biggest from x$ksmsp
    where inst_id = userenv('Instance') and ksmchcls = 'free' group by
    decode(sign(ksmchsiz - 812),-1, (ksmchsiz - 16) / 4,
    decode(sign(ksmchsiz - 4012),-1, trunc((ksmchsiz + 11924) / 64),
    decode(sign(ksmchsiz - 65548),-1, trunc(1/log(ksmchsiz - 11, 2)) + 238,254 ))) ;
    SELECT KSMCHCLS CLASS, COUNT(KSMCHCLS) NUM, SUM(KSMCHSIZ) SIZ,
    To_char( ((SUM(KSMCHSIZ)/COUNT(KSMCHCLS)/1024)),’999,999.00′)||’k’ “AVG SIZE”
    FROM X$KSMSP GROUP BY KSMCHCLS;
    CLASS     NUM     SIZ     AVG SIZE
    freeabl     19010     34519404     1.77k
    recr     23581     24967956     1.03k
    R-freea     68     1632     .02k
    perm     22     39801268     1,766.75k
    R-free     34     7238192     207.90k
    free     2389     36075980     14.75k
    Watch for trends using these guidelines:
    a) if ‘free’ memory is low (less than 5mb or so) you may need to increase the shared_pool_size and shared_pool_reserved_size. You should expect ‘free’ memory to increase and decrease over time. Seeing trends where ‘free’ memory decreases consistently is not necessarily a problem, but seeing consistent spikes up and down could be a problem.
    b) if ‘freeable’ or ‘perm’ memory continually grows then it is possible you are seeing a memory bug.
    c) if ‘freeabl’ and ‘recr’ memory classes are always huge, this indicates that you have a lot of cursor info stored that is not releasing.
    d) if ‘free’ memory is huge but you are still getting 4031 errors, the problem is likely reloads and invalids in the library cache causing fragmentation.
    -Note says that this query can hang database on HP platforms
    See the shared pool parameters
    column name format a30
    select name,value from v$parameter where name like '%shared_pool%' ;
    select x.ksppinm, y.ksppstvl from x$ksppi x , x$ksppcv y where x.indx = y.indx and lower(x.ksppinm) like '%spin%';
    SELECT count(*) FROM v$latch_children WHERE NAME = 'library cache';
    Shrinking and growing operations from V$SGA_RESIZE_OPS dynamic view:
    select to_char(end_time, ‘dd-Mon-yyyy hh24:mi’) end, oper_type, initial_size, target_size, final_size from V$SGA_RESIZE_OPS where component=’shared pool’ order by end;
    #shared_pool_summary.sql -get an overview of chunks in the shared pool
    select
    ksmchcom contents,
    count(*) chunks,
    sum(decode(ksmchcls, 'recr', ksmchsiz)) recreatable,
    sum(decode(ksmchcls, 'freeabl', ksmchsiz)) freeable,
    sum(ksmchsiz) total
    from
    sys.x_$ksmsp
    where
    inst_id = userenv('Instance') and
    ksmchcls not like 'R%'
    group by
    ksmchcom
    #reserved_pool_summary.sql - get an overview of chunks in the reserved pool
    select
    ksmchcom contents,
    count(*) chunks,
    sum(decode(ksmchcls, 'R-recr', ksmchsiz)) recreatable,
    sum(decode(ksmchcls, 'R-freea', ksmchsiz)) freeable,
    sum(ksmchsiz) total
    from
    sys.x_$ksmspr
    where
    inst_id = userenv('Instance')
    group by
    ksmchcom
    #save_sqlplus_settings.sql -reset sqlplus settings
    set termout off
    store set sqlplus_settings replace
    clear breaks
    clear columns
    clear computes
    set feedback off
    set verify off
    set termout on
    set define "&"
    #restore_sqlplus_settings.sql -reset sqlplus settings
    set termout off
    @sqlplus_settings
    clear breaks
    clear columns
    clear computes
    set termout on
    i.Check the shared pool reserved size status
    SELECT free_space, avg_free_size, used_space, avg_used_size, REQUEST_MISSES, request_failures, last_miss_size FROM v$shared_pool_reserved;
    An ORA-04031 error referencing large failed requests, indicates the Reserved Area is too fragmented. The reserved pool is small when: REQUEST_FAILURES > 0 (and increasing), The DBA should Increase shared_pool_reserved_size and shared_pool_size together. It is possible that too much memory has been allocated to the reserved list. The DBA should Decrease shared_pool_reserved_size, If: REQUEST_MISS = 0 or not increasing
    FREE_MEMORY = > 50% of shared_pool_reserved_size minimum
    col free_space for 999,999,999,999 head “TOTAL FREE”
    col avg_free_size for 999,999,999,999 head “AVERAGE|CHUNK SIZE
    col free_count for 999,999,999,999 head “COUNT”
    col request_misses for 999,999,999,999 head “REQUEST|MISSES
    col request_failures for 999,999,999,999 head “REQUEST|FAILURES”
    col max_free_size for 999,999,999,999 head “LARGEST CHUNK”
    select free_space, avg_free_size, free_count, max_free_size, request_misses, request_failures from v$shared_pool_reserved;
    TOTAL FREE     AVERAGE
    CHUNK SIZE     COUNT     LARGEST CHUNK     REQUEST
    MISSES     REQUEST
    FAILURES
    7,238,192     212,888     34     212,888     0     0
    You should also use hidden and unsupported parameter “_shared_pool_reserved_pct” to control reserved pool. This parameter controls the allocated percentage of shared pool for reserved pool. By default it is %5 of the shared pool and if you use ASMM for memory management you can set this value higher like 10 to allocate reserved pool dynamically. When you set the parameter you will see the shared_pool_reserved_size parameter will be adjusted to the new setting. The parameter can not be modified when instance is started. You can use the query below to see the current value
    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 = ‘_shared_pool_reserved_pct’;
    Parameter     Session Value     Instance Value
    sharedpool_reserved_pct     10     10
    j.When having multiple subheaps:
    select KSMCHIDX, ksmchcom ChunkComment,
    decode(round(ksmchsiz/1000),0,'0-1K', 1,'1-2K', 2,'2-3K', 3,'3-4K',4,'4-5K',5,'5-6k',6,'6-7k',7,'7-8k',8,'8-9k', 9,'9-10k', '> 10K'), count(*), ksmchcls Status, sum(ksmchsiz) Bytes
    from x$ksmsp where KSMCHCOM = 'free memory' group by KSMCHIDX,ksmchcom, ksmchcls, decode(round(ksmchsiz/1000),0,'0-1K', 1,'1-2K', 2,'2-3K', 3,'3-4K',4,'4-5K',5,'5-6k',6,'6-7k',7,'7-8k',8,'8-9k', 9,'9-10k','> 10K');
    SubPool     SGA_HEAP     CHUNKCOMMENT     size     COUNT(*)     STATUS     BYTES
    1     sga heap(1,0)     free memory     > 10K     34     R-free     7238192
    1     sga heap(1,0)     free memory     3-4K     2     free     6284
    1     sga heap(1,0)     free memory     > 10K     241     free     35707400
    1     sga heap(1,0)     free memory     8-9k     1     free     7712
    1     sga heap(1,0)     free memory     2-3K     4     free     6752
    1     sga heap(1,0)     free memory     0-1K     2090     free     133288
    1     sga heap(1,0)     free memory     9-10k     21     free     188676
    1     sga heap(1,0)     free memory     1-2K     30     free     25868
    If you see lack of large chunks it is possible that you can face with ORA-04031 in near future.
    k.Check shared pool at first glance quick diagnostics
    select 'You may need to increase the SHARED_POOL_RESERVED_SIZE' Description, 'Request Failures = '||REQUEST_FAILURES Logic
    from      v$shared_pool_reserved where      REQUEST_FAILURES > 0
    and      0 != (select      to_number(VALUE) from      v$parameter
    where      NAME = 'shared_pool_reserved_size')
    union
    select 'You may be able to decrease the SHARED_POOL_RESERVED_SIZE' Description,'Request Failures = '||REQUEST_FAILURES Logic
    from      v$shared_pool_reserved where      REQUEST_FAILURES < 5
    and      0 != (select      to_number(VALUE) from      v$parameter
         where      NAME = 'shared_pool_reserved_size')
    l.Memory Usage - object list level view
    •     Owner - Owner of the object
    •     Object - Name/namespace of the object
    •     Sharable Memory - Amount of sharable memory in the shared pool consumed by the object
    select OWNER, NAME||' - '||TYPE object,SHARABLE_MEM
    from      v$db_object_cache where SHARABLE_MEM > 10000
    and     type in ('PACKAGE','PACKAGE BODY','FUNCTION','PROCEDURE')
    order by owner asc ,SHARABLE_MEM desc
    SELECT * FROM (SELECT ROW_NUMBER () over (PARTITION BY NAMESPACE ORDER BY SHARABLE_MEM DESC) ROW_within , NAMESPACE, SHARABLE_MEM, SUBSTR(NAME,1,40) NAME FROM V$DB_OBJECT_CACHE ORDER BY SHARABLE_MEM DESC) WHERE ROW_WITHIN <= 2 ORDER BY NAMESPACE, ROW_WITHIN;
    ROW_WITHIN NAMESPACE SHARABLE_MEM NAME
    1 CLUSTER 2794 C_OBJ#_INTCOL#
    2 CLUSTER 1684 SMON_SCN_TO_TIME
    1 RSRCPLAN 5117 SYS_GROUP

  • "shared pool free memory" include "SHARED_POOL_RESERVED_SIZE" area??

    Hi, all.
    "shared pool free memory" from v$sgastat include "SHARED_POOL_RESERVED_SIZE" ??
    For example,
    select * from v$sgastat
    where pool ='shared pool'
    and name like 'free memory'
    assuming that the result of the above query is about 100Megabytes
    and "SHARED_POOL_RESERVED_SIZE" is 50Megabytes,
    "100 M free memory" in shared pool includes 50M (reserved area)??
    Thanks and Regards.
    Message was edited by:
    user507290

    Shortly after the database starts up, some of the 'shared_pool_reserved_size' will probably be in use, although quite a lot of it may still be free; so you cannot say (directly) how much of the "free memory" belongs in the reserved area and how much comes from the rest of the shared pool.
    However, there is a view called v$shared_pool_reserved that tells you how much of the reserved area is currently free (and gives various other statisics about the pool's use). There are some versions of Oracle where the definition of this view is wrong, though - possibly in the lower 9i versions.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk

  • Is dictionary cache double buffered (shared pool, buffer cache)

    Hi,
    I'm trying to get idea about how dictionary cache is buffered .
    Let us say we're talking about dc_objects .
    It is dba_tables view related so all underlying sys.obj$ sys.user$ ... tables block are cached in buffer cache.
    So why we are caching them in dictionary cache space in shared pool additionally ?
    Looks like double buffering and wasting SGA .
    Please explain .
    Regards
    GregG

    HI,
    Dictionary cache will not cache data of tables, rather it will cache the structural information of table (in your case).
    If i will do "select ename from emp", during statement compilation, it needs to check whether "ename" is a real column? and for this it needs to query data dictionary information (from using physical read of system data file or from data dictionary cache if information is there). It also need to check whether i have (logged in user) rights to access this table/column and all this information comes from data dictionary.
    This is a simple example, otherwise dictionary cache need to store a lot of other information also (but purely the information present in data dictionary)
    Salman

  • Keeping Large Objects in shared pool

    Hi,
    what is my doubt is the following mention objects
    1) DBMS_Application_info
    2) Trigger
    3) Dbms_space_admin
    4) DBMS_RCVCAT
    5) DBMS_RCVMAN
    6) DBMS_Shared_pool
    7) dbms_standard
    8) dbms_utility
    9) dbms_backup_resotre
    10) standard
    the above mention object i keep in shared pool, IS it ok? or anythink peformance problems plz reply as soon as possible

    hi,
    Loading large objects is the primary source of fragmentations. Users' response time is affected because of the large number of small objects that need to be aged out from the shared pool to make room. To prevent these situations Keep these large or frequently required objects in the shared pool to make sure that they are never aged out of the shared pool.
    thanking u

  • Script to find the " List of objects to be pinned in the shared pool"

    hi all,
    please suggest me any script is there to find the recommended objects to be pinned in to shared pool.
    Regards,
    Vamsi.

    I think the important question here is – do you really need to PIN objects? Are you facing any ORA-4031 errors?
    Oracle would tell you to PIN packages such as STANDARD, DBMS_STANDARD, DBMS_UTILITY, DBMS_OUTPUT. It really depends on your application. So I am afraid there is no exact answer for that, but you can work with your application team to learn if there is some large object that is very frequently used that you might want to PIN.
    I suggest that you check the larger objects from your SGA using the view v$db_object_cache that folks already pointed out checking the column SHARABLE_MEM.
    You can refer to v$sql or v$sqlarea (which is a grouping of v$sql) to find the most executed stored procedures and packages and so on.
    However, most of the problems shared pool problems I have faced were related to bad application coding - such as lack of bind variables - or shared pool undersized. Once those problems were fixed, I hardly had to PIN anything into the SGA.
    Regards

  • Shared Pool Free Memory

    The query 'select * from v$sgastat' showed that there is a shared pool free memory of 80MB. I read that a high value of free memory is a symptom of fragmentation. If that's also in my case, how can I defragment it? (I'm assuming that this has nothing to do with I/O tablespace fragmentation)

    The only was to really defragment the shared pool is to bounce Oracle.
    You can run a "alter system flush shared pool" command however this only makes contiguous chunks of free space available to be used. Oracle does not actually combine the chunks into one free extent like it does with dictionary managed tablespace free extents. The memory is managed by link lists and once a chunk is attached to a list it pretty much stays that way.
    A large amount of free space could also indicate an over allocated shared pool.
    HTH -- Mark D Powell --

  • Shared pool size

    Hi All,
    DB:oracle9iR2
    os:solaris
    how to get the shared_pool usage,free total size and hit ratio in oracle 9i R2?,can any one help to me....
    POOL BYTES MB
    shared pool used :
    shared pool free :
    shared pool (Total):
    =================
    Shared_pool hit ratio:
    thanks.

    Hi All,
    thank you for all the responses..
    Db:oracle 9iR2
    os :solaris
    Actually i am facing below problem..
    prob: ORA-00604: error occurred at recursive SQL level 2
    ORA-04031: unable to allocate 4224 bytes of shared memory ("shared pool","select obj#,type#,ctime,mtim...","sga heap(1,0)","library ca
    che")
    Wed Feb 8 19:33:43 2012
    Errors in file /ora/admin/cddp/bdump/cddp_cjq0_2601.trc:
    ORA-00604: error occurred at recursive SQL level 2
    ORA-04031: unable to allocate 4224 bytes of shared memory ("shared pool","select obj#,type#,ctime,mtim...","sga heap(1,0)","library ca
    che")
    Wed Feb 8 19:33:43 2012
    Errors in file /ora/admin/cddp/bdump/cddp_cjq0_2601.trc:
    ORA-00604: error occurred at recursive SQL level 2
    ORA-04031: unable to allocate 4224 bytes of shared memory ("shared pool","select obj#,type#,ctime,mtim...","sga heap(1,0)","library ca
    che")
    Wed Feb 8 19:33:48 2012
    Errors in file /ora/admin/cddp/bdump/cddp_cjq0_2601.trc:
    ORA-00604: error occurred at recursive SQL level 2
    ORA-04031: unable to allocate 4224 bytes of shared memory ("shared pool","select obj#,type#,ctime,mtim...","sga heap(1,0)","library ca
    che")
    ========================================
    i was running with 200MB size of share pool....couple of days back un expectdly i got above error....for temparory solution i did shared pool flush...
    again nexday same error got repeated....for that i increased shared pool size to 420 MB....
    while monitoring db it is using shared pool memory up to 400MB with avg shared pool hit ratio of 94.5 %..(database started recently)...
    Earlier shared_pool size:200MB
    Now:420 MB
    Avg usage:up to 400MB
    my question is :
    1)if we have many different sql statements in shared pool ..won't
    oracle flush share pool (ie aged out based on LRU or some alogorithm) if any program need memory in shared pool?
    2) Any data Fragmentation will cause@above error?
    3)can any one please explain..... how to check whats going on in Shared_pool(internally)...why it is using 400MB while compare to erlier avg usage 170MB .....any idea...(how to find root cause)..?
    4)will plan table cause any issue ?
    can any one explain to me...
    thanks..
    Edited by: kk001 on Feb 11, 2012 4:54 PM
    Edited by: kk001 on Feb 11, 2012 4:56 PM

  • Flush shared pool

    Hi,
    ALTER SYSTEM FLUSH SHARED POOL;
    when we issue the above command, it will fulsh the shared pool. it means, it will remove all the stored/parsed sql statements from shared pool. if any new query comes, first it has to parse and execute and show it to user.which will take time....
    So, in what scenarios we do flush the shared pool...how do we know there is fragmentation is shared pool....
    i am not experienced Performance Analayist..please share your experience.

    How can you reconcile what you wrote with the above statement from the Oracle docs?Um, because it's true?
    It's realy clear to me that you don't have much job experience with Oracle (also evidence by your hiding your credentials and work history).
    Back before cursor_sharing, the only way to relieve library cache stress was to make the shared_pool very small (see Metaink for the official recommendation), and the same holds true today for systems with ad-hoc query tools that can take-up 90% of the library cache with executions=1.
    BTW, Mr. Morgan, I WANT MY MONEY BACK for your con-job on me.
    When you told me that PSOUG was offering RAC classes, you knew that I believed that you were graciously volunteering a sevice to the community, and that's why you got all of those RAC books for your class at-cost, I wanted to help a good cause.
    Of course, now we know that it was all a ruse, and that you were profiting from the PSOUG training.
    When are you going to pay me back for those books that you conned me out of?
    Message was edited by:
    burleson

  • Shared Pool Statistics - awr report -m 10.2.0.1

    Hi,
    I'm new to reading awr report and performance tuning.
    I have the below in my statspack.
    Do i need to increase my shared pool?
    Any one can advise and explain "% Memory for SQL w/exec" and "% SQL with executions>1"
    Shared Pool Statistics
    Begin End
    Memory Usage %: 95.78 97.71
    % SQL with executions>1: 51.51 80.85
    % Memory for SQL w/exec> 1: 67.88 82.46
    thanks!

    user21123 wrote:
    The sweet point for the shared pool Memory Usage % is at about ~70%-80% because of aging out. You are at ~90%. It would be advisable to increase the shared pool, but if you're using 10g SGA_TARGET and SGA_MAX_SIZE, then that might require increasing those parameters. It depends how your AWR report looks for the Buffer Cache.
    What makes you think this ?
    In an OLTP system you hope for 100% shareable SQL, and correct allocation for the other objects, which would lead to 100% usage. In realistic terms, you're likely to get a few percent (which is often the shared_pool_reserved) free because there's a constant turn-over of non-shareable SQL.
    If you're always seeing 70% - 80%, then there are several scenraios that might explain the figure. One is that you've simply made shared pool a bit too big. At the opposite extreme you might be constantly flushing 20%-30% of the material from the shared pool because it has become so fragmented that you have to clear a lot of garbage to create a small amount of contiguous space.
    The best guideline to follow is to check whether you appear to be losing a significant amount of time on libarary cache and shared pool latches, using up an undesirable amount of CPU on parse time, see lots of reloads (without corresponding invalidations) in v$librarycache.
    Without further information, we really can't say how good or bad the situation is. In fact, it's possible that the information that +"50% of your SQL has been shared, 50% has been single use"+ is a possible indicator that the shared_pool_size is too small, and we are filling the excess space with garbage rather than keeping the garbage (and library cache search time) to a minimum.
    I would be interested to hear the thinking behind your suggestion, though.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    "The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge." Stephen Hawking.

  • Increase Shared Pool for erorr # ORA-04031

    hi,
    what do i need to look at before i increase the shared pool of our database?
    there is just the one database instance on the machine.
    i am concerned about the repurcussions on the server.
    i hope the information below is of help.
    db version: 10.2.0.1.0
    os: Red Hat Linux 3
    SQL> select name, value from v$parameter where name like '%pool%';
    name value
    shared_pool_size 150994944
    large_pool_size 33554432
    java_pool_size 50331648
    streams_pool_size 0
    shared_pool_reserved_size 10066329
    buffer_pool_keep
    buffer_pool_recycle
    global_context_pool_size
    olap_page_pool_size 0
    thanks,
    santosh sewlal

    Hi Santosh,
    This is what i faced last two days back! Now i am monitoring the Issue! If you got any solutions please let me know how to avoid this!
    ORA-04031 error can be due to either an inadequeate sizing of the SHARED POOL size or due to heavy
    fragmentation leading the database to not finding large enough chuncks of memory.
    You can monitor this with the two events...
    alter system set events '4031 trace name errorstack level 3';
    alter system set events '4031 trace name heapdump level 3';
    Fragmentataion is one of the causes of ora 4031
    Please refer these.
    1.Article-ID: Note 146599.1
    Title: Diagnosing and Resolving Error ORA-04031
    2.Article-ID: Note 62143.1
    Title: Understanding and Tuning the Shared Pool
    3.Article-ID: Note 61623.1
    This is paticular for Oracle 9i Rel 2, Hope the same for Oracle 10 G
    Regards
    Ravi

Maybe you are looking for

  • HOW DO I SEND AN EMAIL AND SHOW IT COMING FROM A DIFFERENT ADDRESS?

    Hi All. I'm a newbie to the iMac, having taken receipt yesterday and currently trying to set up email - can anyone help please? I have a business email address attached to my domain name that I like to appear on all emails I send and be the default a

  • Billing Block in SD Document

    Hi All, How I can put Billing Block in specific SD Document (Sales Order), after Invoicing (Invoice/Credit Memo/ Debit Memo) Completed for the Document. Purpose is, after this Block, there will NOT be possible to do any Invoice or Collection from Cus

  • Import javax.swing.*;

    I start my programm with: import java.awt.*; import java.awt.event.*; import javax.swing.*; import rechenwerk.Rechenwerk; import rechenwerk.RechenwerkFassade; import zahl.Zahl; import zahl.ZahlFassade; import oberflaeche.Oberflaeche; At "import javax

  • Why won't logic read my guitar??

    I have input 1 set to instrument.  I've tried every combination of phase invert and phantom power (although i dont even know what those things are) and my guitar still won't read.  Fresh batteries, volume turned up.  I've tried all diff settings on m

  • Find the difference between previous row value

    Hi All, I have a Property Rent Review table which holds the last rent update done on a property. I need to be able to compare the rent change (%) at any interval for a property. - so the query should allow to pull the property rent at 2 or more point