Linux has been a successful platform for running Oracle databases in the data center. In the past months, Utah-based Linux vendor Novell has had some huge success stories with the global banking organization HSBC. It has also recently found success with German industrial giant Siemens, which decided to change many of its UNIX servers to SUSE Linux Enterprise Servers. Oracle is one of the most important applications used on its servers.
Oracle isn't just any application. A Linux server needs preparation in order to run it successfully. To help with this, Novell's SUSE Linux Enterprise Server includes an Oracle installation profile. Part of this profile is the orarun script, which prepares the server for Oracle installation. If you can't access the script from your distribution, it's available for download as well from ftp://ftp.novell.com/partners/oracle/sles-10.
After having installed the Oracle support packages on SUSE Linux Enterprise Server, you may add an oracle service. This service reads its configuration from the /etc/sysconfig/oracle file. In this article, I'll assume that this file exists on your server. If not, all of the parameters mentioned here can be changed from the procfs file system as well.
The orarun program takes care of several things:
- It sets up a user oracle which is needed to run Oracle databases and creates two groups with the names dba and oinstall.
- makes sure that typical Oracle environment parameters are set. These include ORACLE_BASE, ORACLE_HOME, PATH, LD_LIBRARY_PATH and others.
- It makes sure that kernel parameters are set.
Of these tasks, setting the kernel parameters is the least obvious. In some cases, these parameters need manual adjustment. So, let's have a look at what's happening.
The kernel parameters apply to four different regions: shared memory, semaphores, network and limits. Oracle uses shared memory quite often because it is the fastest way for processes to communicate between one another. This speed comes from the fact that nothing needs to be copied in the inter-process communication, but the other process can just access data as needed., Some additional tuning may be needed, especially if Oracle generates errors like "unable to attach to shared memory segment." The first parameter that needs attention is shmmax, which sets the maximum size of shared memory segments. On a default installation it's too low. The orarun service makes sure it is incremented, as are related parameters like shmmni and shmall and shm-use-bigpages. Of these, shmmax is used to set the maximum size in bytes for a shared memory segment, shmmni is the maximum number of shared memory segments, and shmall controlls the total amount of shared memory in memory pages that can be used at the same time. You can get an overview of current settings by using the ipcs -lm command.Listing 1: The ipcs -lm command is used to check current shared memory limits BTN:~ # ipcs -lm
------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 18014398509481983
max total shared memory (kbytes) = 4611686018427386880
min seg size (bytes) = 1
If you need to increase their values, you can set them in the /etc/sysconfig/oracle configuration file when using SUSE, and by using sysctl on other Linux distributions. This command writes all changes to the /etc/sysctl.conf file which is read while booting a server and thus makes sure that you always work with the optimized settings for your server. The following example commands are used to make default shared memory assignments when using orarun; change them as needed from the sysctl.conf file if using non-SUSE, or from /etc/sysconfig/oracle on SUSE.sysctl -w kernel.shmmax=3294967296
sysctl -w kernel.shmmni=4096
sysctl -w kernel.shmall=2097152
The second part of the Oracle optimization is related to semaphores. Semaphores are counters that decide who can access any given region in shared memory and the related settings in /etc/sysconfig/oracle (or /proc/sys/kernel) need to be increased in order to run Oracle succesfully. You can see the current semaphore settings by using the ipcs -ls command.
Listing 2: The ipcs -ls command shows current semaphore-related settings. BTN: ~ # ipcs -ls
------ Semaphore Limits -------
max number of arrays = 1024
max semaphores per array = 250
max semaphores system wide = 256000
max ops per semop call = 32
semaphore max value = 32767
The first of the semaphore settings that you probably will need to change is the smmsl setting. This sets the maximal amount of semaphores per id, which is related to the amount of threads that can be created per process. Orarun sets this value to 1250, and you can increase it to a maximum of 8000.
The second parameter which is related to semaphores is the SEMMNS setting. This sets the maximum amount of semaphores that you can have system-wide. You can use the init.ora configuration file in Oracle to determine the optimal parameter for your server, which is the sum of the PROCESSES parameter for each Oracle database, adding the largest one twice and then adding another 10 for each database. To stay on the safe side, the value set by orarun, 32000, makes sure that most databases will run.
The last two settings are SEMOPM and SEMMNI. SEMOPN is the number of semaphore operations that can be performed per semop system call. Oracle recommends setting this to 100 (with a maximal value of 1000). SEMMNI is the maximal number of semaphore identifiers. This parameter should also be set to a minimum of 100 (with a maximal setting of 32768).
The last two categories of settings that may be changed are related to network settings.
However, these are used by RAC only, and its default settings applied by orarun are fine. Finally, there are some ulimit settings that relate to the maximum amount of open files, maximum processes, maximum core-file size and the vm_mapped_ratio. These settings also work fine with the default orarun settings and rarely need to be changed; check the documentation in /etc/sysconfig/oracle for more information.
For most organizations using it, Oracle is a core application. If you use it, it is essential to configure it in an appropriate way. In this article you've learned how to configure SUSE Linux Enterprise Linux to run Oracle as well as possible.
This was first published in April 2008