I got ” ORA-27123: unable to attach to shared memory segment ” error in Oracle database.
ORA-27123: unable to attach to shared memory segment
Details of error are as follows.
ORA-27123: Unable to attach to shared memory segment Cause: shmat() call failed Action: check permissions on segment, contact Oracle support SQL> startup mount; ORA-27123: unable to attach to shared memory segment Linux-x86_64 Error: 22: Invalid argument
unable to attach to shared memory segment
This ORA-27123 error is related to the shared memory segment.
The below error is received while trying to start Database on Linux node:
SQL> startup mount; ORA-27123: unable to attach to shared memory segment Linux-x86_64 Error: 22: Invalid argument
The environment is configured similar to the below example:
SQL*Plus: Release 18.104.22.168.0 Production on Fri Dec 6 15:38:34 2013 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to an idle instance. SQL> startup mount; ORA-27123: unable to attach to shared memory segment Linux-x86_64 Error: 22: Invalid argument Physical Memory on the node is == 128GB # grep HugePsges /proc/meminfo AnonHugePages: 0 kB HugePages_Total: 5 << 5 x 1 Gb Pages HugePages_Free: 5 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 1048576 kB <<< 1Gb # grep memlock /etc/security/limits.conf * soft memlock 5242880 * hard memlock 5242880 # sysctl -a |grep shm kernel.shmmax = 68719476736 kernel.shmall = 33024983 kernel.shmmni = 4096 vm.hugetlb_shm_group = 0 # uname -a Linux server1 2.6.32-220.13.1.el6.x86_64 #1 SMP Thu Mar 29 11:46:40 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux Command line: ro root=/dev/mapper/vg_root-lv_root pci=bfsort rd_NO_LUKS rd_LVM_LV=vg_root/lv_root LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=vg_root/lv_swap KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM console=ttyS0,115200 console=tty1 selinux=0 printk.time transparent_hugepage=never hugepagesz=1G default_hugepagesz=1G hugepages=15
The SGA size is 3Gb , where the HugePages reservers is 5Gb ( 5 x 1Gb) and the maximum shared memory defined is upto 68Gb (kernel.shmmax = 68719476736 )
According to UNIX: Resolving the ORA-27123 error (Doc ID 115753.1):
SVR4 Error: 22: Invalid argument
The value of the kernel parameter “shmmax” is at least 10% bigger than the estimated size of the SGA of for database. You lower the
“sgabeg” address as instructed in NOTE:1028623.6, relink Oracle and still receive the same error when you attempt to startup the database.
Set “sgabeg” to a value within the address space of your physical RAM.
Note that valid values start at 0x000000, and that the system requires 32M to boot up.
– If you have 64M of RAM, then you have a physical address space from 0x000000 to 0x4000000 (64M in hexadecimal).
– Set sgabeg address to 0x3000000 using the method shown in NOTE:1028623.6.
This will attach the SGA leaving 48M for the system.
NOTE: sgabeg = 0x10000000 for sun4c machines does not work because this is still too high of an address if machine has more than 256Mb of RAM.
The above condition will not be suitable as the SGA size is only 3Gb, and HugePages defined is 5Gb and the maximum shared memory defined is 68Gb ( shmmax )
Setting the Hugepagesize value
As per unpublished Bug 17271305, the issue is in Oracle code.
Ideally the fixed SGA would be in 2MB HugePages (it is small enough to fit into a 2MB huge page), but would require additional changes to Oracle code since the Linux shm*() interface only supports one hugepage size (whatever is set to default, either 2MB or 1GB).
Set the HugePageSize to the default value, that is 2Mb and try to restart the Database process.
# sysctl -a |grep hugepages vm.nr_hugepages = 2560 # grep HugePages /proc/meminfo AnonHugePages: 0 kB HugePages_Total: 2560 HugePages_Free: 2119 HugePages_Rsvd: 1096 HugePages_Surp: 0 Hugepagesize: 2048 kB
Error message while starting the database is
SQL> startup pfile='/<DIR>/dbs/init<SID>.ora' ORA-27123: unable to attach to shared memory segment IBM AIX RISC System/6000 Error: 13: Permission denied
The permissions in the Oracle home directory are properly set.
The Oracle executable in $ORACLE_HOME/bin permissions are already set as -rwsr-s–x
ORACLE_HOME directory has been set properly.
Another database can be brought up without any error from this same Oracle home.
Action plan provided in the below document in step C could not resolve this issue:
Note 1907569.1 – ORA-27123 While Starting the Database
Note that also shmmax should be verified to be set properly because of its relation to SGA_TARGET.
Please refer to:
Note 1527109.1 – Relationship Between SGA_TARGET and SHMMAX
In situations where shmmax was set incorrectly, the same error could be demonstrated.
In this case, none of the above pointed to the possible root cause, being a problem to attach to shared memory segments upon startup.
Rebooting the server resolved the issue as Oracle did not shutdown cleanly and could not attach to shared memory segments upon startup.
953 views last month, 1 views today