How to increase shared memory in RHEL7

Getting your Trinity Audio player ready...

How-to-Increase-Shared-Memory-in-RHEL 7

How to increase shared memory in RHEL7

In this article, we are going to share how to increase shared memory in rhel7 for machines running Oracle Databases that use SGA.

What is shared memory?

Shared Memory is the fastest form of IPC which does not involve the kernel and when data is passed directly to processes.
It allows processes to access common structures and data by keeping them in the shared memory area.
Oracle uses shared memory segments for the Shared Global Area (SGA) which is a memory area that is shared by Oracle processes.
The size of the SGA has a significant impact on Oracle’s performance since it holds a database buffer cache and much more.

How to display all shared memory settings

You can use the ipcs command in linux to display all shared memory settings on the system.

[root@lindev01 ~]# 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 SGASHMMAX 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.

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.

[root@lindev01~]# cat /proc/sys/kernel/shmmax
681312256
[root@lindev01~]# cat /etc/sysctl.conf |grep kernel.shmmax
kernel.shmmax=681312256

How to change shared memory in rhel7

consider if you got the reference that you have to change the value to 7271553024.

First Step

As per best practice better to take a backup copy of the kernel configuration file before making a change. 

[root@lindev01~]# cp -p /etc/sysctl.conf /etc/sysctl.conf.$date

Second Step

The shared memory limit for SHMMAX can be changed in the /proc file system without a reboot.

[root@lindev01~]# echo 7271553024 > /proc/sys/kernel/shmmax 

either method you can parse value to the kernel is as below.

[root@lindev01~]#sysctl -w kernel.shmmax=7271553024

That`s it you are done.

Third Step

You can validate the change using the above commands. Please refer to the example display.

[root@lindev01~]# cat /etc/sysctl.conf |grep kernel.shmmax
kernel.shmmax=7271553024
[root@lindev01~]# cat /proc/sys/kernel/shmmax
7271553024

Fourth Step

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.

Conclusion

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.

[maxbutton id=”18″ ]  [maxbutton id=”20″ ]

Leave a Reply