1. Install “orarun” package  (which creates oracle:dba with diff IDs than we use, resolve, or try installing our IDs first, then installing orarun pkg.).
  2. Install the following packages
    • binutils-

    • compat-libstdc++-5.0.7

    • gcc-4.1.0

    • glibc-2.4-31.2

    • glibc-devel-2.4-31.2

    • ksh-93r-12.9

    • libaio-0.3.104

    • libaio-devel-0.3.104

    • libelf-0.8.5

    • libgcc-4.1.0

    • libstdc++-4.1.0

    • libstdc++-devel-4.1.0

    • make-3.80

    • sysstat-6.0.2

    Configure the following kernel parameters

  3. Configure Kernel Parameters

    Verify that the kernel parameters shown in the following table are set to values greater than or equal to the minimum value shown. If the current value for any parameter is higher than the value listed in this table, then do not change the value of that parameter. The procedure following the table describes how to verify and set the values.

    Execute command

    /sbin/sysctl -a | egrep "kernel.shmall|kernel.shmmax|kernel.shmmn|kernel.sem"

    and compare the values with the values in the table below


    The kernel parameter and shell limit values shown in the following section are minimum values only. For production database systems, Oracle recommends that you tune these values to optimize the performance of the system. Refer to the operating system documentation for more information about tuning kernel parameters.



    Minimum Value

    Recommended value










    Set only if those that are set by OS or other applications are lower




    usually page_size=4



    Minimum of the following values:

    ·       Half the size of the memory

    ·       4GB - 1 byte

    Note: The minimum value required for shmmax is 0.5 GB. However, Oracle recommends that you set the value of shmmax to 2.0 GB for optimum performance of the system.

    Half of RAM or if swap file is less then half of RAM the size of swap file







    512 * PROCESSES





    Maximum: 65000



























    To display the current value specified for these kernel parameters, and to change them if necessary, use the following steps:

    ·       Enter the commands shown in the following table to display the current values of the kernel parameters, make a note of these values and identify any values that you must change:



    semmsl, semmns, semopm, and semmni

    # /sbin/sysctl -a | grep sem

    This command displays the value of the semaphore parameters in the order listed.

    shmall, shmmax, and shmmni

    # /sbin/sysctl -a | grep shm

    This command displays the details of the shared memory segment sizes.


    # /sbin/sysctl -a | grep file-max

    This command displays the maximum number of file handles.


    # /sbin/sysctl -a | grep ip_local_port_range

    This command displays a range of port numbers.


    # /sbin/sysctl -a | grep rmem_default


    # /sbin/sysctl -a | grep rmem_max


    # /sbin/sysctl -a | grep wmem_default


    # /sbin/sysctl -a | grep wmem_max


    # /sbin/sysctl -a | grep tcp_wmem


    # /sbin/sysctl -a | grep tcp_rmem

    ·       If the value of any kernel parameter is different from the minimum value, then complete the following procedure:

    Using any text editor, create or edit the /etc/sysctl.conf file, and add or edit lines similar to the following:


    Include lines only for the kernel parameter values that you want to change. For the semaphore parameters (kernel.sem), you must specify all four values. However, if any of the current values are larger than the minimum value, then specify the larger value.

    fs.file-max = 512 * PROCESSES

    kernel.shmall = 2097152

    kernel.shmmax = 2147483648

    kernel.shmmni = 4096

    kernel.sem = 250 32000 100 128


    kernel.sem = 250 256000 100 1024

    net.ipv4.ip_local_port_range = 1024 65000

    net.core.rmem_default = 4194304

    net.core.rmem_max = 4194304

    net.core.wmem_default = 262144

    net.core.wmem_max = 262144

    net.ipv4.tcp_wmem = 262144 262144 262144

    net.ipv4.tcp_rmem = 4194304 4194304 4194304


    The minimum value required for shmmax is 0.5 GB. However, Oracle recommends that you set the value of shmmax to 2.0 GB for optimum performance of the system.

    By specifying the values in the /etc/sysctl.conf file, they persist when you restart the system. However, on SUSE Linux Enterprise Server systems, enter the following command to ensure that the system reads the /etc/sysctl.conf file when it restarts:

    # /sbin/chkconfig boot.sysctl on

    Enter the following command to change the current values of the kernel parameters:

    # /sbin/sysctl -p

    Review the output from this command to verify that the values are correct. If the values are incorrect, edit the /etc/sysctl.conf file, then enter this command again.

    Enter the command /sbin/sysctl -a to confirm that the values are set correctly.

    On SUSE systems only, enter the following command to cause the system to read the /etc/sysctl.conf file when it restarts:

    # /sbin/chkconfig boot.sysctl on

    On SUSE systems only, you must enter the GID of the oinstall group as the value for the parameter /proc/sys/vm/hugetlb_shm_group. Doing this grants members of oinstall a group permission to create shared memory segments.

    For example, where the oinstall group GID is 501:

    # echo 501 > /proc/sys/vm/hugetlb_shm_group

    After running this command, use vi to add the following text to /etc/sysctl.conf, and enable the boot.sysctl script to run on system restart:



    Only one group can be defined as the vm.hugetlb_shm_group.

    After updating the values of kernel parameters in the /etc/sysctl.conf file, either restart the computer, or run the command sysctl -p to make the changes in the /etc/sysctl.conf file available in the active kernel memory.

  4. Set Shell Limits for the oracle User

    To improve the performance of the software, you must increase the following shell limits for the oracle user:


    Shell Limit

    Item in limits.conf

    Hard Limit

    Maximum number of open file descriptors



    Maximum number of processes available to a single user



    To increase the shell limits:

    Add the following lines to the /etc/security/limits.conf file:

    oracle              soft    nproc   2047

    oracle              hard    nproc   16384

    oracle              soft    nofile  1024

    oracle              hard    nofile  65536

    Add or edit the following line in the /etc/pam.d/login file, if it does not already exist:

    session    required     pam_limits.so

    Depending on the oracle user's default shell, make the following changes to the default shell start-up file:

    ·       For the Bourne, Bash, or Korn shell, add the following lines to the /etc/profile file (or the file on SUSE Linux Enterprise Server systems /etc/profile.local):

    if [ $USER = "oracle" ]; then

            if [ $SHELL = "/bin/ksh" ]; then

                  ulimit -p 16384

                  ulimit -n 65536


                  ulimit -u 16384 -n 65536




linux - unix kernel parameters « Irrelevant thoughts of an oracle DBA

Irrelevant thoughts of an oracle DBA

11 November 2007

linux / unix kernel parameters

Filed under: Uncategorized — dhoogfr @ 16:05
I have a confession to make: the linux/unix kernel parameters have always been somewhat of a mistery to me and while I have installed several databases on linux and solaris systems I never realy understood how to tune them. I just followed the oracle installation documentation and metalink note 169706.1.

But recently I had to perform an installation on a 64bit linux system. The database in question was going to be used to develop a data warehouse system and the company asked to have at least a buffer cache of 4 GB. Now the box had 16 GB of ram so this requirement should not pose any problem.

So I started preparing the os for the installation and looked to metalink for the recommended kernel values. At that point I noticed that the value for the shmmax parameter on linux 64bit was stated as “max(ram in bytes, 4GB) / 2″ “max(ram in bytes/2, 4 GB * 1024^3)”. This limit of 4 GB seems a little bit strange to me for a 64bit system, so I posted a service request on this and started a quest for more information on the kernel parameters.

I found an excellent explanation here, but after reading it I started to ask myself more questions on the values recommended by Oracle in the installation guide and on metalink.
As I understand it, the shmmax parameter is supposed to be the maximum size of a single shared memory segments (and the oracle sga is build out of these shared memory segments). The shmmni parameter gives the maximum number of shared memory segments system wide and shmall gives the total amount of shared memory (expressed in pages).
If I combine the 3 definitions I understand that the maximum shared memory will be the minimum between shmmax * shmmni and shmall * page_size.

When I calculate the parameters with the values specified in metalink note 169706.1 (for my system with 16 GB ram) I get the following results:

shmmax = min(4294967296, RAM in bytes) /2 = min(4294967296, 17179869184)/2 = 4294967296/2 = 2147483648
shmmax = min(RAM in bytes / 2 , 4294967296) = min (17179869184 / 2, 4294967296) = 4294967296
shmmni = 4096
shmall = shmmax / page_size = 2147483648 / 4096 = 524288
shmall = shmmax / page_size = 4294967296 / 4096 = 1048576

Which would mean that on my system I get a maximum of 2 GB 4 GB of shared memory, and thus a maximum sga of 2GB 4 GB (actually less, because this limit is system wide and not only for my oracle instance). Needless to say that when you are needing a 64bit system, this 2 GB 4 GB limit is a little bit on the low side…

In metalink note 169706.1 there is, next to the shmall parameter, a link to another note (301830.1) which states to set the shmall parameter to “ram size / page_size” instead of shmmax / page_size. For my system with 16 GB of ram, this would give a shmall of 4194304 instead of 524288 and thus indeed fixing my problem.
Also if you would compare the proposed values in the installation guide with those from metalink you will notice that the shmall in the installation guide (2097152) is much higher then on metalink (allowing for 8 GB of shared memory when your pagesize is 4096) and that there is no 4GB limitation in the calculation of the shmmax parameter.

During my searh Oracle also responded on my SR on metalink, saying that the 4 GB limit in the shmmax calculation is not an os limit but an oracle limit. They also said that this was because 4GB is the maximum size of a core dump. Now what the size of the core dump has to do with the size of a shared memory segment is yet unclear to me, and it also makes me wonder if my calculation of shmmax is correct. (After having received some feedback by oracle it indeed turned out that my formulla for shmmax was not correct, so I have made the necessary adjustments in the post)
I will keep searching for this and update the post when I have more information.

shmmax and solaris 10

A couple of days later, I needed to install oracle on a solaris 10 system. Now with solaris 10 the way to specify kernel parameters differs from the prior solaris versions. You now no longer need to put your kernel parameters in the /etc/system file, but instead use projects and projmod.
Because of past experiences on solaris 10 I already knew that the oracle installation guide was not very correct on how to work with projects (and because of my newly gained understanding of the kernel parameters) I started to search for more information on solaris 10 kernel parameters.

I soon found out that the parameter project.max-shm-memory which is replacing the old shmmax parameter differs not only in name and how to set it (note that using prctl to set the kernel parameter, as suggested in the installation guide will make the parameter not persistant), but also in definition!
When you look at the solaris tunable parameters reference manual you will note that the parameter is not specifying the maximum size of a single shared memory segment, but instead the maximum shared memory for your entire project. In the installation guide, however, oracle is still using the same value for the new project.max-shm-memory parameter as with the old shmmax parameter. So when you follow the recommended values for the installation guide you would suddenly limit the total sga size for all databases on your system to 4GB (unless you use different users with different projects for your databases).

So be warned: when it comes to kernel parameters, don’t just take the values specified in the installation guide.


  1. I have made some corrections in the past after receicing some more feedback from oracle.
    As it turned out, I misinterpreted the formulla for shmmax on metalink.
    It should be “max(ram in bytes/2, 4 GB * 1024^3)” and not “max(ram in bytes, 4GB * 1024^3) / 2″.
    If you use this formulla in your calculations you would get a maximum of 4 GB shared memory instead of 2 GB.

    Still waiting on feedback about the core dump limitation.

    Comment by dhoogfr — 13 November 2007 @ 12:00

  2. [...] Filed under: infrastructure — dhoogfr @ 21:21 This is a follow-up note on my prior linux / unix kernel parameters [...]

    Pingback by linux / unix kernel parameters follow-up « Irrelevant thoughts of an oracle DBA — 27 November 2007 @ 21:21

  3. Nice article

    Comment by everton r — 14 July 2008 @ 22:50

RSS feed for comments on this post. TrackBack URI


ORACLE - DBA Tips Corner

Swap Space Considerations

Ensure enough swap space is available.



Configuring Shared Memory

The Oracle database uses shared memory in UNIX to allow processes to access common data structures and data. These data structures and data are placed in a shared memory segment to allow processes the fastest form of Interprocess Communications (IPC) available. The speed is primarily a result of processes not needing to copy data between each other to share common data and structures - relieving the kernel from having to get involved.

Oracle uses shared memory in UNIX to hold its Shared Global Area (SGA). This is an area of memory within the Oracle instance that is shared by all Oracle backup and foreground processes. It is important to size the SGA to efficiently hold the database buffer cache, shared pool, redo log buffer as well as other shared Oracle memory structures. Inadequate sizing of the SGA can have a dramatic decrease in performance of the database.

To determine all shared memory limits you can use the ipcs command. The following example shows the values of my shared memory limits on a fresh RedHat Linux install using the defaults:

# ipcs -lm

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 32768
max total shared memory (kbytes) = 8388608
min seg size (bytes) = 1
Let's continue this section with an overview of the parameters that are responsible for configuring the shared memory settings in Linux.


The SHMMAX parameter is used to define the maximum size (in bytes) for a shared memory segment and should be set large enough for the largest SGA size. If the SHMMAX is set incorrectly (too low), it is possible that the Oracle SGA (which is held in shared segments) may be limited in size. An inadequate SHMMAX setting would result in the following:
ORA-27123: unable to attach to shared memory segment

You can determine the value of SHMMAX by performing the following:

# cat /proc/sys/kernel/shmmax
As you can see from the output above, the default value for SHMMAX is 32MB. This is often too small to configure the Oracle SGA. I generally set the SHMMAX parameter to 2GB.


NOTE: With a 32-bit Linux operating system, the default maximum size of the SGA is 1.7GB. This is the reason I will often set the SHMMAX parameter to 2GB since it requires a larger value for SHMMAX.

On a 32-bit Linux operating system, without Physical Address Extension (PAE), the physical memory is divided into a 3GB user space and a 1GB kernel space. It is therefore possible to create a 2.7GB SGA, but you will need make several changes at the Linux operating system level by changing the mapped base. In the case of a 2.7GB SGA, you would want to set the SHMMAX parameter to 3GB.

Keep in mind that the maximum value of the SHMMAX parameter is 4GB.

To change the value SHMMAX, you can use either of the following three methods:

  • This is method I use most often. This method sets the SHMMAX on startup by inserting the following kernel parameter in the /etc/sysctl.conf startup file:
    # echo "kernel.shmmax=2147483648" >> /etc/sysctl.conf


  • If you wanted to dynamically alter the value of SHMMAX without rebooting the machine, you can make this change directly to the /proc file system. This command can be made permanent by putting it into the /etc/rc.local startup file:
    # echo "2147483648" > /proc/sys/kernel/shmmax


  • You can also use the sysctl command to change the value of SHMMAX:
    # sysctl -w kernel.shmmax=2147483648


We now look at the SHMMNI parameters. This kernel parameter is used to set the maximum number of shared memory segments system wide. The default value for this parameter is 4096. This value is sufficient and typically does not need to be changed.

You can determine the value of SHMMNI by performing the following:

# cat /proc/sys/kernel/shmmni


Finally, we look at the SHMALL shared memory kernel parameter. This parameter controls the total amount of shared memory (in pages) that can be used at one time on the system. In short, the value of this parameter should always be at least:
The default size of SHMALL is 2097152 and can be queried using the following command:
# cat /proc/sys/kernel/shmall
From the above output, the total amount of shared memory (in bytes) that can be used at one time on the system is:
   = 2097152 * 4096
   = 8,589,934,592 bytes
The default setting for SHMALL should be adequate for our Oracle installation.
NOTE: The page size in Red Hat Linux on the i386 platform is 4096 bytes. You can, however, use bigpages which supports the configuration of larger memory page sizes.