Tuesday, June 12, 2012

Different ways to modify linux kernel parameters for Oracle installation

There are several valid techniques for changing kernel parameters beforeperforming a database installation :
  • Run sysctl

Use the sysctl command with the -w option to dynamically modify kernel parameters. The
following command changes the kernel semaphore settings in the /proc/sys/kernel/sem
virtual file:

sysctl -w kernel.sem="250 32000 100 128"

To make changes persist across system reboots, use your favorite editor (like vi) to add the
parameters to the /etc/sysctl.conf file.
  • Edit sysctl.conf

You can also directly modify the /etc/sysctl.conf file and then use the sysctl -p command
to make desired kernel parameter changes. This example uses vi to first edit the /etc/
sysctl.conf file:

vi /etc/sysctl.conf

Add changes and then exit...
After you modify the /etc/sysctl.conf file, you can use the sysctl -p command to make the
entries in the /etc/sysctl.conf file instantiated as the current values used by the Linux kernel:

sysctl -p

The previous command loads into memory the values found in the /etc/sysctl.conf file.
You can verify that the values were changed by using cat to view the corresponding virtual file.
  • Add entries with echo

You can use the echo command to write the desired output to the specified virtual file. This
example writes the values 250 32000 100 128 to the virtual /proc/sys/kernel/sem file using the
echo command:

echo 250 32000 100 128 > /proc/sys/kernel/sem

The previous command immediately changes the kernel settings for the sem (semaphores)
parameter. If you want the change to persist across system reboots, then you also need to add
an entry to the /etc/sysctl.conf file. This file is read when the system boots to determine the
settings for kernel parameters. You can edit the /etc/sysctl.conf file directly (with an editor
such as vi) and add the following line:

kernel.sem = 250 32000 100 128

Alternatively, you can use the echo command to add the desired parameters to the end of
the /etc/sysctl.conf file, as shown here:

echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf

Notice that the previous command uses >> to concatenate the desired entry to the bottom
of the /etc/sysctl.conf file. You would not want to use just a single right arrow >, because that
would overwrite the contents of /etc/sysctl.conf.
  • Add entries with cat
The technique shown here is handy for adding several entries to the /etc/sysctl.conf file at
the same time. First use the cat command to add entries to the /etc/sysctl.conf file. This
example shows how to use cat to write typical kernel parameter settings for an Oracle database:

cat >> /etc/sysctl.conf <<EOF
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
EOF


The previous command uses cat to write to the /etc/sysctl.conf file all the values encap-sulated between the two EOF markers. This allows you to add several parameters simultaneously
to the /etc/sysctl.conf file. When using cat and >> to write parameters to the /etc/sysctl.conf
file, there is no automatic checking to determine whether the parameters already exist in the file.
Using cat and >> will simply write to the bottom of the file.
After the desired changes are made, use the sysctl -p command to make the entries in the
/etc/sysctl.conf file the current values used by the Linux kernel, as shown here:
sysctl -p


No comments:

Post a Comment