shmmax setting in sysctl.conf not taking effect

11,032

Solution 1

OK, I think I know why. This is 32-bit version of Linux. Seems maximum value for shmmax in this case is 2GB.

Solution 2

First off, editing sysctl.conf doesn't change the value until you either reboot, or execute:

sysctl -p

To have it reload the values.

You mention this is a 32-bit Linux. That puts constraints on how large you can set SHMMAX to and how big the Oracle SGA can be. See Installing Oracle9i on FC2 for more information about the limits you'll run into here. The largest generally useful setting is this:

kernel.shmmax=2147483648

And since the one you tried is >4GB that's why it failed altogether.

Many people seem to use some guide or Oracle's suggestions for a setting here as a magic number without actually considering whether the shared memory values really make sense for their system or not. I wrote the following little script to generate the settings for me on Linux. As written, it limits the shared memory block to 50% of total RAM, which might be light for your Oracle use; easy to adjust it to a higher percentage. I hate seeing people set this value to higher than the amount of RAM in their server.

#!/bin/bash
mem_bytes=`awk '/MemTotal:/ { printf "%0.f",$2 * 1024}' /proc/meminfo`
mem_max=`expr $mem_bytes / 2` 
page_size=`getconf PAGE_SIZE`
shmall=`expr $mem_bytes / $page_size`
echo \# Maximum shared segment size in bytes
echo kernel.shmmax = $mem_max
echo \# Maximum number of shared memory segments in pages
echo kernel.shmall = $shmall

The output from this can get written right to the end of the sysctl.conf, run "sysctl -p", and you're off with a reasonable yet safe setting.

Share:
11,032

Related videos on Youtube

martin
Author by

martin

Updated on September 17, 2022

Comments

  • martin
    martin over 1 year

    We are running RHEL 4 Update 6 and I am going through an Oracle installation. As per the Oracle Installation Guide I am trying to update the shmmax value. As per the guide I have added the following line to /etc/sysctl.conf:

     kernel.shmmax = 5319303168
    

    However when I subsequently enter the following command to check:

    /sbin/sysctl -a | grep shm 
    

    I can see the value is still 1024335872. If I execute the following:

    cat /proc/sys/kernel/shmmax
    

    I can also see the value 1024335872. I have tried rebooting the system, but that still doesn't work. Any ideas how I can make this setting take effect?

  • martin
    martin over 14 years
    Oracle 10.2.0.3 for what it's worth. Just tried updating directly, doesn't work either: [root@hklfcgis01 ~]# echo 5319303168 > /proc/sys/kernel/shmmax [root@hklfcgis01 ~]# cat /proc/sys/kernel/shmmax 1024335872