Installation of oracle database kernel parameters under Linux

Keywords: Big Data Oracle Database less Linux

The following kernel parameters need to be configured when installing the database:

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

Quoted from: https://docs.oracle.com/cd/E11882_01/install.112/e47689/pre_install.htm#LADBI1187

Semaphores and shared memory are two distinct operating system resources. Semaphores are Oracle's system resources for inter-process communication. They occupy relatively small memory space, while shared memory is used to contain SGA and can occupy most of the physical memory.

aio-max-nr: The maximum number of events allowed in all active asynchronous I/O contexts. The default value is 65536.
file-max: The maximum number of file handles that the current kernel can open;
shmmax: specifies the maximum shared memory segment allowed by the kernel in bytes. 64-bit default value is 68719476736; 32-bit default value is 4294967295. Note: However, the value supported by the kernel is much more than that. The minimum configuration in oracle is 536870912, the maximum value of 64 bits is - 1 byte of physical memory, and the maximum value of 32 bits is less than 4 GB - 1 byte or 4294967295. It is recommended to set it to 1/2 of the size of physical memory.
shmall: specifies the total amount of shared memory that can be used in the system at a time in bytes. 64-bit default value is 4294967296; 32-bit default value is 268435456. The minimum recommended by oracle is 2097152. When memory is small, you can use a value less than 2097152. When memory is large (more than 8G), you need to plan through the following formula: formula 1:memtotal/pagesize. Formula 2: (SHMMAX/get PageSize ()* (SHMMNI/16)).
shmmni: The maximum number of shared memory segments in the system. Default values in 64-bit and 32-bit architecture machines are 4096
 Sem: abbreviated as semaphores. There are four corresponding values, and oracle's recommended value is kernel.sem = 250,32000,100,128, which corresponds to:
SEMMSL | maximum number of semaphores in a semphore set | 250 | defines the maximum number of semaphores per Oracle database. | Value range 1-65536
 SEMMNS | maximum number of semphores in the system | 32000 | defines the maximum semaphore on the system. | Value range 1-2147483647  
SEMOPM | maximum number of operations per semop (P) call | 100 | defines the maximum operands per semop call. | Value range 100
 SEMMNI | maximum number of semaphore sets in system | 128 | Defines the maximum number of semaphore sets in the whole system | Value range 1 - 32768
 Rules:
SEMMNI * SEMMSL > = SEMMNS, SEMMNS = the sum of process+10 for each instance in the system + 2*max(process)

The Corresponding Relation between Operating System and kernel.sem Parameters in sysctl

$ ipcs -ls

------ Semaphore Limits --------
max number of arrays = 128      // SEMMNI
max semaphores per array = 250      // SEMMSL
max semaphores system wide = 32000     // SEMMNS
max ops per semop call = 100    // SEMOP
semaphore max value = 32767

Issues related to semaphores:
Question 1:

SQL> startup nomount
ORA-27154: post/wait create failed
ORA-27300: OS system dependent operation:semget failed with status: 28
ORA-27301: OS failure message: No space left on device
ORA-27302: failure occurred at: sskgpcreates

[root@prodb linux]# ipcs -s

------ Semaphore Arrays --------
key        semid      owner      perms      nsems     
0x00000000 0          root       600        1         
0x00000000 65537      root       600        1         
0x9a31ff94 1507331    oracle     640        154 
//In this case, 154 > max number of arrays = 128 needs to adjust the SEMMNI value to 200 or more.

Question 2:

Getting ORA-600 [OSDEP_INTERNAL] errors while starting up the database:

ORA-00600: internal error code, arguments: [OSDEP_INTERNAL],
[], [], [], [], [], [], []
ORA-27302: failure occurred at: skgpwreset1
ORA-27303: additional information: invalid shared ctx
ORA-27146: post/wait initialization failed
ORA-27300: OS system dependent operation:semget failed with status: 28
ORA-27301: OS failure message: No space left on device
ORA-27302: failure occurred at: sskgpsemsper

semmns The value is too small to be changed to: kernel.sem = 256 32768 100 228

Semaphore deletion

Semaphore or shared memory errors occur mainly at instance startup (especially in the'startup nomount'phase). This is the only time Oracle tries to get the semaphore of the instance and the shared memory. During normal database operations, there are few errors associated with semaphores or shared memory. The most common occurrence of these errors is during the creation of a new database. However, sometimes when an Oracle instance crashes, the operating system may not be able to release the shared memory segment. This limits the total amount of shared memory that instances can use to restart. In this case, you need to delete these segments manually.

[oracle@prodb ~]$ $ORACLE_HOME/bin/sysresv

IPC Resources for ORACLE_SID "PROD3" :
Shared Memory:
ID              KEY
1966083         0x00000000
1998852         0x00000000
2031621         0x4db7973c
Semaphores:
ID              KEY
1507331         0x9a31ff94
Oracle Instance alive for sid "PROD3"

Linux: 
% ipcrm shm 2031621 1998852 1966083

Other Unix: 
% ipcrm -m 12189717

Posted by leszczu on Wed, 28 Aug 2019 08:14:45 -0700