LLI Wiki — My Digital Knowledge Base

Oracle on Linux: kernel parameters (sysctl) and user limits

Kernel parameters in sysctl.conf and resource limits in limits.conf to prepare a Linux server for Oracle Database, with the commands to apply and check them.

Oracle Database expects some kernel parameters and user resource limits to be raised on Linux. The values below are examples taken from a test server. Size them for your memory and check the installation guide of your Oracle release. For background, see why kernel parameters are critical for Oracle Database.

Kernel parameters (sysctl)

Parameters are set in /etc/sysctl.conf:

kernel.shmmax = 4398046511104
kernel.shmall = 4294967296
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
vm.max_map_count = 1000000
fs.aio-max-nr = 1048576
fs.file-max = 6815744

net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 16777216
net.core.wmem_default = 262144
net.core.wmem_max = 16777216
kernel.panic_on_oops = 1

# Huge pages
vm.nr_hugepages = 1003
vm.hugetlb_shm_group = 54322

# Set swappiness to 0 to avoid swapping
vm.swappiness = 0

Apply and check

# Reload /etc/sysctl.conf
sudo sysctl -p

# Read the current value of one parameter
more /proc/sys/vm/max_map_count

# Set a value immediately (lost at reboot unless it is also in a sysctl file)
sudo sysctl -w vm.max_map_count=200000

# Check the shared memory limits
ipcs -l

# Show the huge page settings
grep Huge /proc/meminfo

vm.hugetlb_shm_group takes the numeric group ID of a group that the Oracle user belongs to. Find it in /etc/group, for example:

dba:x:54322:oracle

Load order of sysctl files

# Show the files in the order they are applied
sudo sysctl --system

# Load one specific file
sudo sysctl --load=filename.conf

Temporary and persistent changes

# Temporary change, until the next reboot
echo "1" > /proc/sys/net/ipv4/ip_forward
sudo sysctl -w net.ipv4.ip_forward=1

# Persistent change: create a file in /etc/sysctl.d/
sudo vi /etc/sysctl.d/ipv4_forwarding.conf
sudo sysctl -p /etc/sysctl.d/ipv4_forwarding.conf

Resource limits (limits.conf)

Set user limits in /etc/security/limits.conf (or a file in /etc/security/limits.d/):

oracle   soft   nofile   65536
oracle   hard   nofile   65536
oracle   soft   nproc    16384
oracle   hard   nproc    16384
oracle   soft   memlock  unlimited
oracle   hard   memlock  unlimited

Each line has the form <domain> <type> <item> <value>:

Field Possible values
Domain a user name, @group for a group, * for all users, %group for the maxlogins limit
Type soft (enforced limit), hard (maximum that a user can raise to)
Item nofile (open files), nproc (processes), memlock (locked memory, KB), core, fsize, stack, cpu (minutes), as (address space, KB), locks, sigpending, msgqueue, nice, rtprio, maxlogins, priority

Check the limits of the current shell:

ulimit -a     # soft limits
ulimit -Ha    # hard limits
Mastodon LLIMastodon SocialFosstodon