Oracle 7.2 error in Sol 2.5

Posted on 1997-06-07
Medium Priority
Last Modified: 2013-12-26
I get the following error from Oracle when using OCI
ORA-04031: unable to allocate 740 bytes of shared memory ("unknown object","sga heap","library cache")
Any hints as to solve this
Question by:waslap
  • 2

Accepted Solution

dhm earned 200 total points
ID: 1293257
I use Oracle/OCI on Solaris-2.5.1 quite a bit, but I've never seen that error.  Is your database up & running correctly?  You are supposed to modify the kernel when you install Oracle, and one of the things you're supposed to do is increase the amount of shared memory that is available to user programs.  If you didn't modify the kernel (and reboot), perhaps your system has just enough shared memory to run Oracle, but not enough for client programs.

The kernel mod in question happens in the file /etc/system; you need to add lines like these (which are copied directly from my /etc/system on an Ultra-2 running 2.5.1):

# Set shared mem and semaphore limits for Oracle
set shmsys:shminfo_shmmax=8388608
set shmsys:shminfo_shmmin=1
set shmsys:shminfo_shmmni=100
set shmsys:shminfo_shmseg=10
set semsys:seminfo_semmns=400
set semsys:seminfo_semmni=70

Then, of course, you have to do a "reboot -- -rv" to reboot and reconfigure the kernel.

Author Comment

ID: 1293258
I did this and the system ran well for a couple of months but now starts giving this error. Its always exactly 740 bytes and the "unknown object" part intrigues me. Could it be that there is just too many processes running and memory is running too low ( I noticed each oracle connection using 25Mb in /proc, is this normal ? ). Next thing I'm going to try is make the SGA larger in INI.ORA. Maybe the DB is too busy, but even if so, Oracle should throw away other cached objects, not so ?

Expert Comment

ID: 1293259
Do you only get the error with this particular program?  Does it always happen, or only when you run (e.g.) 10 copies of the program?  Can you run sqlplus or some other OCI program right after you get the error?

I just ran oerr to find out more about the error; here's what I got:

dhm@eagleone[3]$ oerr ora 04031
04031, 00000, "unable to allocate %s bytes of shared memory (\"%s\",\"%s\",\"%s\")"
// *Cause:  More shared memory is needed than was allocated in the shared
//          pool.
// *Action: Either use the dbms_shared_pool package to pin large packages,
//          reduce your use of shared memory, or increase the amount of
//          available shared memory by increasing the value of the
//          init.ora parameter "shared_pool_size".

So your idea of increasing the SGA in init.ora is close.  I don't know what the "dbms_shared_pool" package is, or how to use it to "pin large packages."  I'd try increasing "shared_pool_size", though.


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question