Thursday, July 4, 2013

Shared Memory Size - This Is a Prerequisite Condition Tested during Oracle Installation

During the "Prerequisite Checks" of Oracle Database 11g installation[1], one of three issues we have seen is:
  • Shared memory Size

Detailed Message

This is a prerequisite condition to test whether the OS kernel parameter "shmmax" is properly set.(more details)
Expected Value
:Current=4294967296; Configured=4294967296
Actual Value
:Current=2147483648; Configured=2147483648

shmmax & shmall


For Oracle 11g, the following kernel parameters have to be set to values greater than or equal to the recommended values which can be changed in the proc file system:
  • shmmax
    • The maximum size of a shared memory segment
  • shmall[2]
    • This parameter sets the total amount of shared memory pages that can be used system wide. Hence, shmall should always be at least 
      • ceil ( shmmax / PAGE_SIZE).
In some early versions of the kernel, this needed to be changed and the kernel rebuilt. Since the 2.2 version of the kernel, it can be changed while the system is running with commands like

#echo "4294967296" >/proc/sys/kernel/shmmax 
#echo "1048576" >/proc/sys/kernel/shmall

would set it to 4GB.  Note that we also set shmall to be 1M pages.  You can find the size of page by using:

# getconf PAGE_SIZE
4096

Also note that this needs to be done after each boot.  So, you want to control this at boot by using sysctl. You can place entries in /etc/sysctl.conf like:

kernel.shmmax=4294967296
kernel.shmall=1048576

which will be processed at your next reboot and set it to 4GB, 4 * 1024*1024*1024. Larger values are supported. Check the manuals that came with your Linux distribution[3].

More Information


Oracle uses shared memory for implementing the SGA, which needs to be visible to all database sessions.  On OTN, it recommends setting shmmax to be:
  • SHMMAX= max value of shared memory segment = 0.5 * size of physical memory

For servers running Oracle Fusion Applications, shared memory are also needed for Java heap.  It is recommended that your shared memory segment be larger than the Java heap size.

To determine your physical memory size, you use:
  • #cat /proc/meminfo | grep MemTotal
    MemTotal:     148425832 kB
In summary, you can use the following commands to manage shared memory:
  • To view current settings, run command: 
    • # more /proc/sys/kernel/shmmax
  • To set it to a new value for this running session, which takes effect immediately, run command: 
    • # echo 4294967296 > /proc/sys/kernel/shmmax
  • To have the changes to survive reboot, modify the /etc/sysctl.conf file:
    • kernel.shmmax = 4294967296

References

  1. Installing Oracle Database 11g Release 2
  2. Meaning of SHMALL kernel variable
  3. Verifying Kernel Parameters (Redhat)
  4. How I Simplified Oracle Database Installation on Oracle Linux (Good)
  5. Kernel Configuration
  6. Linux Tuning Parameters



1 comment:

Blogger said...

BlueHost is ultimately one of the best hosting company for any hosting services you might need.