In this article, we are going to share how to increase shared memory in rhel7 for machines running Oracle Databases that use SGA.
You can use the ipcs command in linux to display all shared memory settings on the system.
[[email protected] ~]# ipcs -lm ------ Shared Memory Limits -------- max number of segments = 4096 max seg size (kbytes) = 7101126 max total shared memory (kbytes) = 8388608 min seg size (bytes) = 1
How to set shmmax parameter in rhel7
shmmax parameter defines the maximum size in bytes of a single shared memory segment that a Linux process can allocate in its virtual address space. Since SGA is made up of shared memory so SHMMAX can potentially limit the size of the SGA. SHMMAX should be slightly larger than the SGA size. If SHMMAX is too small you may encounter error messages like below.
ORA-27123: unable to attach to shared memory segment
In this scenario, you have to increase the shared memory Segment Value. Let us see how to find the maximum size of a shared memory segment.
There is two way how to find the maximum size of a shared memory segment. Please see below for more details.
[[email protected]~]# cat /proc/sys/kernel/shmmax 681312256 [[email protected]~]# cat /etc/sysctl.conf |grep kernel.shmmax kernel.shmmax=681312256
consider if you got the reference that you have to change the value to 7271553024.
As per best practice better to take a backup copy of the kernel configuration file before making a change.
[[email protected]~]# cp -p /etc/sysctl.conf /etc/sysctl.conf.$date
The shared memory limit for SHMMAX can be changed in the /proc file system without a reboot.
[[email protected]~]# echo 7271553024 > /proc/sys/kernel/shmmax
either method you can parse value to the kernel is as below.
[[email protected]~]#sysctl -w kernel.shmmax=7271553024
That`s it you are done.
You can validate the change using the above commands. Please refer to the example display.
[[email protected]~]# cat /etc/sysctl.conf |grep kernel.shmmax kernel.shmmax=7271553024 [[email protected]~]# cat /proc/sys/kernel/shmmax 7271553024
Hang on you still need to make it permanent so the configuration will remain intact even after rebooting the host. For that you can simply edit sysctl.conf and update the value manually.
That`s it. You are good and change is consistent. That is all about how to increase shared memory in rhel7. I guess you will find it useful in crunch time. If so will be glad to share this and feel accomplished. If you like our work please subscribe to our blog to have an immediate update once a new topic gets published. Please share as much as possible in your online community to extends its reach.