#!/bin/sh
#
#  Script to List and Update Shared Memory and Semaphores in 
#  A Linux kernel to correspond to Oracle's Recommended settings
#
#  From PawPrint.net
#  Implemented: 2001
#
#
#  Contact: http://www.pawprint.net/linux/oracle.php
#
#
SEMMSL_value="250"
SEMMNS_value="32000" 
SEMOPM_value="100" 
SEMMNI_value="100"
#
SHMMAX_value="3294967296"
SHMALL_value="3294967296"
SHMMNI_value="4096"
logger -s -t ORACLE -p local3.info 'Configuring Kernel'
#
echo "Current Settings:"
echo "==========================="
echo "SEMMSL SEMMNS SEMOPM SEMMNI"
/sbin/sysctl kernel.sem
echo "==========================="
echo "SHMALL: "
/sbin/sysctl kernel.shmall
echo "==========================="
echo "SHMMAX: "
/sbin/sysctl kernel.shmmax
echo "==========================="
echo "SHMMNI: "
/sbin/sysctl kernel.shmmni
echo "==========================="
echo "***************************"
echo "Updating Configuration"
echo "==========================="
echo "SEMMSL --> $SEMMSL_value"
echo "SEMMNS --> $SEMMNS_value"
echo "SEMOPM --> $SEMOPM_value"
echo "SEMMNI --> $SEMMNI_value"
/sbin/sysctl -w kernel.sem="$SEMMSL_value $SEMMNS_value $SEMOPM_value $SEMMNI_value"
echo "SHMALL"
/sbin/sysctl -w kernel.shmall=$SHMALL_value
/sbin/sysctl kernel.shmall
echo "SHMMAX"
/sbin/sysctl -w kernel.shmmax=$SHMMAX_value
/sbin/sysctl kernel.shmmax
echo "SHMMNI"
/sbin/sysctl -w kernel.shmmni=$SHMMNI_value
/sbin/sysctl kernel.shmmni
echo "***************************"
echo "done..."
echo "***************************"
logger -s -t ORACLE -p local3.info 'Kernel Configured for Oracle'
#
# NOTES FROM ORACLE BELOW:
#
# Recommended settings (in bits where applicable)
#
#SEMMNI >= 100         Defines the maximum number of semaphore
#                      sets in the entire system.
#              	      
#SEMMNS >= 256 Defines the maximum semaphores on the
#                      system. This setting is a minimum
#                      recommended value, for initial installation
#                      only. 
#                      The SEMMNS parameter should be set to the
#                      sum of the PROCESSES parameter for each
#                      Oracle database, adding the largest one twice,
#                      and then adding an additional 10 for each
#                      database.
#		      
#SEMMSL >= 100         Defines the maximum number of semaphores
#                      for each user id.
#                      The SEMMSL setting should be 10 plus the
#                      largest PROCESSES parameter of any Oracle
#                      database on the system.
#		      
#SEMOPM >= 100         Defines the maximum number of operations
#                      per semop call.
#		      
#SEMVMX >= 32767       Defines the maximum value of a semaphore.
#
#SHMMAX >= 2147483648  Defines the maximum allowable size of the
#                      shared memory. The SHMMAX parameter
#                      does not affect how much shared memory is
#                      used or needed by Oracle9i, the operating
#                      system, or the operating system kernel.
#                      One-half the size of your system’s physical
#                      memory. Check your system for additional
#                      restrictions.
#                      
#SHMMIN >= 1           Defines the minimum allowable size of a
#                      single shared memory segment.
#                      
#SHMMNI >= 100         Defines the maximum number of shared
#                      memory segments in the entire system.
#                      
#SHMSEG >= 4096        Defines the maximum number of shared
#                      memory segments one process can attach.
#              
#Note: These are minimum kernel requirements for Oracle8i/9i. If you have previously
#tuned your kernel parameters to levels equal to or higher than these values,
#continue to use the higher values. A system restart is necessary for kernel changes
#to take effect.

