<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ORA-04031 Error  + Library Cache in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ora-04031-error-library-cache/m-p/4032179#M743041</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;We are getting the ORA-04031 error while running our application on Database.&lt;BR /&gt;&lt;BR /&gt;The exact error we get is:&lt;BR /&gt;Unable to allocate 4216 bytes of shared memory ("shared pool","unknown object","sga heap(2,0)","library cache")&lt;BR /&gt;&lt;BR /&gt;As we found from the various sources, this is due to fragmented SGA, or insufficient Shared Memory.&lt;BR /&gt;&lt;BR /&gt;Our init.ora Parameter for Shared Pool are:&lt;BR /&gt;&lt;BR /&gt;shared_pool_reserved_size=52428800&lt;BR /&gt;shared_pool_size=524288000&lt;BR /&gt;java_pool_size=262144000&lt;BR /&gt;&lt;BR /&gt;We are executing the SELECT query which return 8,00,000 rows. We are also having one other query which executed 8,00,000 times.&lt;BR /&gt;&lt;BR /&gt;Is this SELECT Statement can cause this error?&lt;BR /&gt;&lt;BR /&gt;As we are getting the Notification related to Library cache, is it related to fragmented Library Cache?&lt;BR /&gt;&lt;BR /&gt;Please help us in resolving this issue.&lt;BR /&gt;&lt;BR /&gt;Thanks in Advance.</description>
    <pubDate>Wed, 04 Jul 2007 07:27:19 GMT</pubDate>
    <dc:creator>ManojMac</dc:creator>
    <dc:date>2007-07-04T07:27:19Z</dc:date>
    <item>
      <title>ORA-04031 Error  + Library Cache</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ora-04031-error-library-cache/m-p/4032179#M743041</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;We are getting the ORA-04031 error while running our application on Database.&lt;BR /&gt;&lt;BR /&gt;The exact error we get is:&lt;BR /&gt;Unable to allocate 4216 bytes of shared memory ("shared pool","unknown object","sga heap(2,0)","library cache")&lt;BR /&gt;&lt;BR /&gt;As we found from the various sources, this is due to fragmented SGA, or insufficient Shared Memory.&lt;BR /&gt;&lt;BR /&gt;Our init.ora Parameter for Shared Pool are:&lt;BR /&gt;&lt;BR /&gt;shared_pool_reserved_size=52428800&lt;BR /&gt;shared_pool_size=524288000&lt;BR /&gt;java_pool_size=262144000&lt;BR /&gt;&lt;BR /&gt;We are executing the SELECT query which return 8,00,000 rows. We are also having one other query which executed 8,00,000 times.&lt;BR /&gt;&lt;BR /&gt;Is this SELECT Statement can cause this error?&lt;BR /&gt;&lt;BR /&gt;As we are getting the Notification related to Library cache, is it related to fragmented Library Cache?&lt;BR /&gt;&lt;BR /&gt;Please help us in resolving this issue.&lt;BR /&gt;&lt;BR /&gt;Thanks in Advance.</description>
      <pubDate>Wed, 04 Jul 2007 07:27:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ora-04031-error-library-cache/m-p/4032179#M743041</guid>
      <dc:creator>ManojMac</dc:creator>
      <dc:date>2007-07-04T07:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: ORA-04031 Error  + Library Cache</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ora-04031-error-library-cache/m-p/4032180#M743042</link>
      <description>you could flush the shared pool in the weekend :-)&lt;BR /&gt;alter system flush shared_pool;&lt;BR /&gt;&lt;BR /&gt;This would clean it.</description>
      <pubDate>Wed, 04 Jul 2007 07:46:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ora-04031-error-library-cache/m-p/4032180#M743042</guid>
      <dc:creator>Jannik</dc:creator>
      <dc:date>2007-07-04T07:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: ORA-04031 Error  + Library Cache</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ora-04031-error-library-cache/m-p/4032181#M743043</link>
      <description>Hi Jannik,&lt;BR /&gt;&lt;BR /&gt;we are flushing the Shared Pool, but its not solving the problem.&lt;BR /&gt;&lt;BR /&gt;This is due to fragmented memory.&lt;BR /&gt;&lt;BR /&gt;Can we have some other solution?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Jul 2007 08:08:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ora-04031-error-library-cache/m-p/4032181#M743043</guid>
      <dc:creator>ManojMac</dc:creator>
      <dc:date>2007-07-04T08:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: ORA-04031 Error  + Library Cache</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ora-04031-error-library-cache/m-p/4032182#M743044</link>
      <description>This should solv your problem???&lt;BR /&gt;These two errors are mainly caused by shared pool allocation error, or process creation error. See below SHARED_POOL ERROR (ORA-04030) and PROCESS CREATION/ALLOCATION ERROR (ORA-04031). &lt;BR /&gt;&lt;BR /&gt;Sometimes Oracle send this error message not because the SHARED_POOL is full (or too small), but simply because it is too fragmented, so Oracle cannot allocate the needed memory, since it cannot find non fragmented memory area. &lt;BR /&gt;&lt;BR /&gt;You can solve this problem simply executing a shared pool memory flush. In this way, you clear this memory area; it means it is defragmented. &lt;BR /&gt;&lt;BR /&gt;This links tells even more:&lt;BR /&gt;&lt;A href="http://ale870.pbwiki.com/ResolveORA-04031" target="_blank"&gt;http://ale870.pbwiki.com/ResolveORA-04031&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Allsow how to detect when the flush is needed.&lt;BR /&gt;&lt;BR /&gt;Oracle Corporation recommends that you set the SHMMAX parameter value to the amount of available physical memory on the system. Doing this ensures that the entire shared memory for a single Oracle instance is assigned to one shared memory segment and your instance needs only one protection key. To display the list of active shared memory segments on the system, enter the following command: &lt;BR /&gt;&lt;BR /&gt;$ ipcs -m&lt;BR /&gt;&lt;BR /&gt;If the Oracle server creates more than six segments for the instance, increase the value of the SHMMAX kernel parameter.&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Jul 2007 03:19:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ora-04031-error-library-cache/m-p/4032182#M743044</guid>
      <dc:creator>Jannik</dc:creator>
      <dc:date>2007-07-05T03:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: ORA-04031 Error  + Library Cache</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ora-04031-error-library-cache/m-p/4032183#M743045</link>
      <description>A single select statement -- whether executed 8,000,000 times or returning 8,000,000 rows -- will not cause your problems.  Because each of these are a single object that is stored in the shared pool library cache.  (Assuming you're using parameterized SQL, that is ...)&lt;BR /&gt;&lt;BR /&gt;The shared pool servers two basic functions:  the library cache and session data.  (It actually does a lot more, but I don't want to go there.)  How much memory it needs for these things really depends on two things:  1) your application design, and 2) the number of sessions that you have.  &lt;BR /&gt;&lt;BR /&gt;The dependence on sessions should be obvious.  As for the application design, if your application uses a lot of PL/SQL, or your sessions open a lot of cursors, then there are going to be a lot of objects in the library cache.  And, while the system flushes out the shared pools with a LRU algorithm, if particular PL/SQL procedure is being executed, it can't get flushed out.  In addition, if the application does not use sharable SQL, then there are just more objects that need to be in the shared pool library cache.&lt;BR /&gt;&lt;BR /&gt;At the end of the day, your base problem is that the shared pool needs to be larger.  Flushing the shared pool might temporarily alleviate the symptoms, but as procedures get executed and sessions connect, it will just get fragmented again.  Other posters have discussed the relevent kernel settings for having a large shared pool.&lt;BR /&gt;</description>
      <pubDate>Thu, 12 Jul 2007 16:15:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ora-04031-error-library-cache/m-p/4032183#M743045</guid>
      <dc:creator>Ben Dehner</dc:creator>
      <dc:date>2007-07-12T16:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: ORA-04031 Error  + Library Cache</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ora-04031-error-library-cache/m-p/4032184#M743046</link>
      <description>HI Ben,&lt;BR /&gt;Thanks for your reply.</description>
      <pubDate>Thu, 12 Jul 2007 22:38:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ora-04031-error-library-cache/m-p/4032184#M743046</guid>
      <dc:creator>ManojMac</dc:creator>
      <dc:date>2007-07-12T22:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: ORA-04031 Error  + Library Cache</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ora-04031-error-library-cache/m-p/4032185#M743047</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;It could also be related to the fact that your application is not using Bind Variables.&lt;BR /&gt;&lt;BR /&gt;Simply speaking, you will never have a good hit ratio if everyone submits UNIQUE sql.  Your SHARED POOL will never be used right and you will be using excessive CPU (90% of the time it takes to process "insert into mytable values ( 'a' )" is parsing.  If you use "insert into mytable values ( :x )", and bind the value of 'a' -- then the next person that runs that insert will benefit from your work and run that much faster. &lt;BR /&gt;&lt;BR /&gt;hope this helps!&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj</description>
      <pubDate>Thu, 12 Jul 2007 23:05:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ora-04031-error-library-cache/m-p/4032185#M743047</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2007-07-12T23:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: ORA-04031 Error  + Library Cache</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ora-04031-error-library-cache/m-p/4032186#M743048</link>
      <description>Please asign some points  to people who gave the suggetions.</description>
      <pubDate>Thu, 12 Jul 2007 23:06:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ora-04031-error-library-cache/m-p/4032186#M743048</guid>
      <dc:creator>skt_skt</dc:creator>
      <dc:date>2007-07-12T23:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: ORA-04031 Error  + Library Cache</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ora-04031-error-library-cache/m-p/4032187#M743049</link>
      <description>hi again,&lt;BR /&gt;&lt;BR /&gt;Below a script quote from Tom Kyte which describes how to query the statements that are identical in the shared pool.&lt;BR /&gt;&lt;BR /&gt;&lt;QUOTE&gt;&lt;BR /&gt;create table t1 as select sql_text from v$sqlarea;&lt;BR /&gt;&lt;BR /&gt;alter table t1 add sql_text_wo_constants varchar2(1000);&lt;BR /&gt;&lt;BR /&gt;create or replace function &lt;BR /&gt;remove_constants( p_query in varchar2 ) return varchar2&lt;BR /&gt;as&lt;BR /&gt;    l_query long;&lt;BR /&gt;    l_char  varchar2(1);&lt;BR /&gt;    l_in_quotes boolean default FALSE;&lt;BR /&gt;begin&lt;BR /&gt;    for i in 1 .. length( p_query )&lt;BR /&gt;    loop&lt;BR /&gt;        l_char := substr(p_query,i,1);&lt;BR /&gt;        if ( l_char = '''' and l_in_quotes )&lt;BR /&gt;        then&lt;BR /&gt;            l_in_quotes := FALSE;&lt;BR /&gt;        elsif ( l_char = '''' and NOT l_in_quotes )&lt;BR /&gt;        then&lt;BR /&gt;            l_in_quotes := TRUE;&lt;BR /&gt;            l_query := l_query || '''#';&lt;BR /&gt;        end if;&lt;BR /&gt;        if ( NOT l_in_quotes ) then&lt;BR /&gt;            l_query := l_query || l_char;&lt;BR /&gt;        end if;&lt;BR /&gt;    end loop;&lt;BR /&gt;    l_query := translate( l_query, '0123456789', '@@@@@@@@@@' );&lt;BR /&gt;    for i in 0 .. 8 loop&lt;BR /&gt;        l_query := replace( l_query, lpad('@',10-i,'@'), '@' );&lt;BR /&gt;        l_query := replace( l_query, lpad(' ',10-i,' '), ' ' );&lt;BR /&gt;    end loop;&lt;BR /&gt;    return upper(l_query);&lt;BR /&gt;end;&lt;BR /&gt;/&lt;BR /&gt;update t1 set sql_text_wo_constants = remove_constants(sql_text);&lt;BR /&gt;&lt;BR /&gt;select sql_text_wo_constants, count(*)&lt;BR /&gt;  from t1&lt;BR /&gt; group by sql_text_wo_constants&lt;BR /&gt;having count(*) &amp;gt; 100&lt;BR /&gt; order by 2&lt;BR /&gt;/&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The output of that last query will show you statements that are identical in the shared &lt;BR /&gt;pool after all numbers and character string constants have been removed.  These statements -- and more importantly their counts -- are the potential bottlenecks.  In &lt;BR /&gt;addition to causing the contention, they will be HUGE cpu consumers.&lt;BR /&gt;&lt;BR /&gt;&lt;/QUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps too!&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj</description>
      <pubDate>Thu, 12 Jul 2007 23:11:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ora-04031-error-library-cache/m-p/4032187#M743049</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2007-07-12T23:11:39Z</dc:date>
    </item>
  </channel>
</rss>

