Calculate required kernel parameters for running Oracle 11g Release 2 on Linux

The following is a short guide on how to calculate the required kernel parameters for running Oracle 11g Release 2 database on Linux.

In addition to that i add some parameters recommended by myself.

Note that for running Oracle Grid Infrastrucure (aka “Clusterware”) some additional parameters might be required.

Values required by Oracle according to the documentation

The following tables list the required MINIMUM values according to the oracle documentation.

Parameter name in /etc/sysctl.confDescriptionMINIMUM value
kernel.sem"semmsl semmns semopm semmni"
kernel.sem:semmsltotal semaphores for each set250
kernel.sem:semmnstotal number of semaphores systemwide32000
kernel.sem:semopmMaximum number of operations for semop call100
kernel.sem:semmnitotal semaphore sets 128
kernel.shmalltotal number of shared memory pages that can be used system wide2097152
kernel.shmmaxthe maximum size of a single shared memory segment in bytes that a linux process can allocateEither 4 GB - 1 byte, or half the size of physical memory (in bytes), whichever is lower.

Default: 536870912
kernel.shmmnisystem wide number of shared memory segments4096
fs.file-maxmaximum number of open files system-wide6815744
fs.aio-max-nrconcurrent outstanding i/o requests1048576
net.ip_local_port_rangeminimum and maximum ports for use Minimum: 9000

Maximum: 65500
net.rmem_defaultthe default size in bytes of the receive buffer262144
net.rmem_maxthe maximum size in bytes of the receive buffer4194304
net.wmem_defaultthe default size in bytes of the send buffer262144
net.wmem_maxthe maximum size in bytes of the send buffer1048576
.

Shell Limits for Oracle User
in /etc/security/limit.conf
DescriptionHard Limit
nofilenumber of open files65536
nprocnumber of processes16384
stackstack size in kb10240

/dev/shm file systemlargest value of MEMORY_MAX_TARGET or MEMORY_TARGET of all instances

Calculate the required values

The following table shows calculation formulas for setting the required kernel parameters for running oracle 11g release 2 on Linux.

Parameter name in /etc/sysctl.confDescriptionMINIMUM valueCalculation
kernel.sem"semmsl semmns semopm semmni"
kernel.sem:semmsltotal semaphores for each set256set fixed to 256
kernel.sem:semmnstotal number of semaphores systemwide320002 * sum (process parameters of all database instances on the system)
+ overhead for background processes
+ system and other application requirements
kernel.sem:semopmMaximum number of operations for semop call100set fixed to 100
kernel.sem:semmnitotal semaphore sets 128semmns divided by semmsl, rounded UP to nearest multiple to 1024
kernel.shmalltotal number of shared memory pages that can be used system wide2097152ceil(shmmax/PAGE_SIZE).

(PAGE_SIZE is usually 4096 bytes unless Big/Huge Pages used)

get PAGESIZE by doing:
"getconf PAGESIZE"
kernel.shmmaxthe maximum size of a single shared memory segment in bytes that a linux process can allocateEither 4 GB - 1 byte, or half the size of physical memory (in bytes), whichever is lower.

Default: 536870912
largest value of SGA_MAX_SIZE, SGA_TARGET,MEMORY_MAX_SIZE or MEMORY_TARGET of all instances
kernel.shmmnisystem wide number of shared memory segments4096set fixed to 4096...did not find any formula
fs.file-maxmaximum number of open files system-wide6815744>= 6815744 (dont know why this large....but should be enough for most databases)
fs.aio-max-nrconcurrent outstanding i/o requests1048576no adjustment; set fix to 1048576
net.ip_local_port_rangeminimum and maximum ports for useMinimum: 9000
Maximum: 65500
no adjustment, fixed
net.rmem_defaultthe default size in bytes of the receive buffer262144>= 262144
net.rmem_maxthe maximum size in bytes of the receive buffer4194304>= 4194304
net.wmem_defaultthe default size in bytes of the send buffer262144>= 262144
net.wmem_maxthe maximum size in bytes of the send buffer1048576>= 1048576

The default page size needed for some calculations can be obtained by doing:

getconf PAGESIZE

The output states the default (not huge page size) in bytes.



The shell limits shown above should be enough initially. However if you have many data files (> 1000) i would increase the number of open files by doubling the value. All other parameters are sized big enough for almost every environment.

For using the new Automatic Memory Management Feature which automatically sized SGA and PGA Oracle uses a pseudo file system /dev/shm. If activating this feature by setting MEMORY_MAX_SIZE or MEMORY_TARGET in your init.ora you have to size /dev/shm appropriately. The following table outlines how to do it:

/dev/shm file systemlargest value of MEMORY_MAX_TARGET or MEMORY_TARGET of all instances

You can make this change permanent by editing your /etc/fstab. For instance the following change will set /dev/shm to a size of 13 GB:

...
shmfs /dev/shm   tmpfs   size=13g 0
...

Addition values recommended by Ronny Egner

Note: The values mentioned there are values set from experience. Set them at your own risk!

ValueDescriptionRecommended Value
vm.swappiness ( in /etc/sysctl.conf)adjusts the swap affinity. Range from 0 to 100. Lower values mean pages remain longer in memory before swapping them out to disk. Larger values swap out infrequently used memory pages faster. The default value is “60″.5

This entry was posted in Oracle 11g Release 2, Oracle in general. Bookmark the permalink.

4 Responses to Calculate required kernel parameters for running Oracle 11g Release 2 on Linux

  1. Chris Tuttle says:

    Setting the kernel.shmmax value greater then 4GB -1 has the following disadvantage: If Oracle segfaults it will not be able to write a coredump file. This value represents the max size of a single shared memory segment, if your SGA(s) is larger than this value than multiple shared memory segments will be used. From metalink Doc ID:567506.1

  2. Pingback: maximum connections semaphore check « Talipkorkmaz's Blog

  3. Sarathi says:

    This is Usefull post and easy to understand.Great job.
    Regards sarathi

  4. rajesh says:

    Pretty neat and useful

Leave a Reply

Your email address will not be published. Required fields are marked *