ORA-27123: unable to attach to shared memory segment

Posted on 2004-11-30
Last Modified: 2012-08-13

WHile startup a database, I got the following error:

ORA-27123: unable to attach to shared memory segment
SVR4 Error: 12: Not enough space

I tried to reduce shared_pool_size in init file but won't work. The top command give a memory of 61MB free; but shared_pool_size of init file is about 28MB.

Can anyone tell me what is wrong? I hope to solve it soon.

Question by:ebi168
    LVL 23

    Accepted Solution

    A) You are receiving the above error messages because the SGA size for
       the current instance is too large to fit into the available physical
       memory segments.
       Raise SHMMAX in /etc/system or Lower SHARED_POOL_SIZE and/or
       DB_BLOCK_BUFFERS accordingly

       You need to reduce the SGA to a resonable size, so that it can be
       allocated during the startup process.
       Approximating size of the SGA

          To approximate size of the SGA (Shared Global Area), use following formula:
          ((db_block_buffers * block size) +
          (shared_pool_size + large_pool_size + log_buffers) + 1MB


          To approximate size of the SGA (Shared Global Area), use following formula:

          ((db_block_buffers * block size) +
          (shared_pool_size + large_pool_size + java_pool_size + log_buffers) + 1MB

       For Example:
          SHARED_POOL_SIZE = 200 MB
          DB_BLOCK_BUFFERS = 200000 # 1600 MB
          DB_BLOCK_SIZE = 8192 #8K
          LOG_BUFFER = 65536 # 64K

       Total SGA size becomes about 1800 MB for this instance.
       *NOTE: If you have other instances running on the same server,
               you need to calculate SGA size requirements for the other
               instances also.
       Modify DB_BLOCK_BUFFERS from 200000 to approximately 5000 (40 MB)
       in the init<SID>.ora file and restart the database.
          SVRMGR> shutdown immediate
          SVRMGR> startup
          Statement processed.


    Author Comment

    Thanks for the excellent information. I lowered both the shared pool and db buffer size and the database is startup. But what I don't understand is that when I check use the top command, the memory available is still 61MB. I thought startup the database is going to make the memory left smaller. If there is enough memory, why oracle couldn't allocate and I have to reduce the sga size?
    LVL 23

    Expert Comment

    SHMMAX  Available physical memory  Defines the maximum allowable size of one shared memory segment.
    The SHMMAX setting should be large enough to hold the entire SGA in "one" shared memory segment. A low setting can cause creation of multiple shared memory segments which may lead to performance degradation.  
    LVL 23

    Expert Comment

    can you display your share memory setting by using this command?

    $ ipcs -l

    if you shared memory is too smaller, this will happen,

    if your share memory segment is big enough, then change oracle SGA_MAX_SIZE in the database init.ora file.

    most often, this parameter sga_max_size will be default if you don't see one in your init.ora file.

    then add this line explicitly in your init.ora file:


    LVL 23

    Expert Comment

    but of course, you have to adjust the other memory pools accordingly so that they will fit into the SGA.

    Author Comment

    But what I am wondering is why the free memory size didn't change when I use the "top" unix command after I startup the database. Thanks
    LVL 1

    Assisted Solution

    try this:

    ORA-27123: unable to attach to shared memory segment.
    I temporarely increased the shmmax setting for the kernel by executing the following command:

    $ su - root
    # cat /proc/sys/kernel/shmmax
    # echo `expr 1024 \* 1024 \* 1024` > /proc/sys/kernel/shmmax
    # cat /proc/sys/kernel/shmmax
    It is recommended to increase the shmmax setting permanently for Oracle. For more information, see Setting Shared Memory.

    For more information on optimizing shared memory settings for Oracle databases on Linux, see Setting Shared Memory. These parameters apply to all Red Hat Linux versions. But note that except for the shmmax parameter, these parameter do not need to be changed for installing Oracle on Linux. But you might want to adjust all shared memory settings later to optimize the server for Oracle.


    Author Comment

    My concern is no longer the error. It is that before and after the database startup, the memory size is almost the same:


    load averages:  0.37,  0.27,  0.23
    226 processes: 224 sleeping, 1 zombie, 1 on cpu
    CPU states: 70.2% idle, 21.3% user,  5.9% kernel,  2.7% iowait,  0.0% swap
    Memory: 4096M real, 61M free, 475M swap in use, 20G swap free

    The free memory is still around 60M after the database startup. Isn't it going to be less than that since the new instance's sga will consume some memory?
    LVL 23

    Assisted Solution


    don't worry about that. UNix work differently than Windows.

    Unix have a notiion of System cache. so it will cache the memory segment that ever be requested. i.e., they are no longer listed as free memory as they resided in the cache pool. this is somewhat misleading.

    but the system cache pool will provide faster memory allocation when need arises.

    so in your case, 60M free memory are "real" free one, they never be used.


    Author Comment

    Thanks very much, Seazodiac.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    This post first appeared at Oracleinaction  ( Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
    Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
    This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
    Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now