Enterprise Linux 7 and Oracle-related kernel parameters
When running Oracle databases under Linux, some additional kernel parameters need to be set. Oracle lists these parameters in the appopriate documentation - e.g. for the most recent version 12c: [click me!]
Especially for Enterprise Linux 7 there is a dedicated profile for the tuned
service (RPM package tuned-profiles-oracle
). This services takes control over various system settings including kernel parameters. The most Oracle-relevant settings are matching with the values from the official documentation. During an installation recently, I had to adjust two kernel parameters:
Parameter | Explanation |
---|---|
kernel.shmall |
Amount of memory pages, that can be used system-wide |
kernel.shmmax |
Maximum size in bytes of a single shared memory page segment that can be used by a process |
Oracle explains these two settings like this in the documentation:
Parameter | Explanation |
---|---|
kernel.shmall |
40 percent of the size of physical memory in pages |
kernel.shmmax |
Half the size of physical memory in bytes |
So these settings need to be calculated based on the system's memory configuration. The value in the profile provided by the RPM package is static - so for the most systems the configuration might be inadequate.
In this case, defining overriding the values in a sysctl
configuration file underneath /etc/sysctl.d
(or in the system-wide configuration file /etc/sysctl.conf
) will not work. I spent a lot of time on troubleshooting, especially debugging file permissions and SELinux - but the problem cause was another one.
First of all: defining kernel parameters in a file underneath /etc/sysctl.d
only works if:
- the file ends with
.conf
- the SELinux context
system_conf_t
was set (if SELinux is enabled) - the file number was set wisely (e.g.
oracle-99.conf
). A high number results in a later time frame for interpreting the file - previous settings are overwritten using this.
Because I wanted to create and distribute my configuration from central source, overwriting files that are part of a RPM file was not an option - updating the operating system could result in destroying these changes if configuration files are upgraded unattendendly.
When having a deeper look at the Oracle tuned profile, I saw that this profile is based on another profile - so inheritances between tuned profiles is possible:
1$ cat /usr/lib/tuned/oracle/tuned.conf
2#
3# tuned configuration
4#
5
6[main]
7include=throughput-performance
8...
I decided to create a customized tuned profile which is based on the Oracle profile:
1# mkdir /usr/lib/tuned/oracle-custom
2# vi /usr/lib/tuned/oracle-custom/tuned.conf
3#
4# tuned configuration
5#
6
7[main]
8include=oracle
9
10[sysctl]
11
12kernel.shmall = ...
13kernel.shmmax = ...
14
15ESC ZZ
16
17# restorecon /usr/lib/tuned/oracle-custom/tuned.con
The profile just created can be set and checked using the tuned-adm
command:
1# tuned-adm profile oracle-custom
2# tuned-adm active
3Current active profile: oracle-custom
It is a good idea to put this profile in a RPM package and reference tuned-profiles-oracle
as dependency. In this case, distributing the configuration file and installing the Oracle profile if it is not already installed, is quite easy. 🙂