Every DBA is so familiar with those three kernel parameters in Linux — SHMMAX, SHMMNI and SHMALL. Most of the time, the default values are used by majority clients. But sometime, those three parameters need to be reconfigured to reflect the system memory sizing and total databases SGA sizing.
What are SHMMAX SHMMNI SHMALL ?
SHMMAX : The maximum size in bytes of a single shared memory segment that a Linux process can allocate in its virtual address space.
SHMMNI: The system wide maximum number of shared memory segments.
SHMALL: The total amount of shared memory pages that can be used system wide.
How to check current SHMMAX SHMMNI SHMALL values ?
run “ipcs -lm”
$ipcs -lm ------ Shared Memory Limits -------- max number of segments = 4096 <-------------- SHMMNI max seg size (kbytes) = 273678336 <----------- SHMMAX max total shared memory (kbytes) = 371195904 <- SHMALL * PAGE_SIZE min seg size (bytes) = 1
Check the values in proc file system.
$ getconf PAGE_SIZE 4096 $ cat /proc/sys/kernel/shmall 92798976 $ cat /proc/sys/kernel/shmmax 280246616064 $ cat /proc/sys/kernel/shmmni 4096
How to change SHMMAX SHMMNI SHMALL values ?
Change them in the proc file system without reboot
# echo 92798976 > /proc/sys/kernel/shmall # echo 4096 > /proc/sys/kernel/shmmni # echo 280246616064 > /proc/sys/kernel/shmmax
Use sysctl without reboot
# sysctl -w kernel.shmall=92798976 # sysctl -w kernel.shmmni=4096 # sysctl -w kernel.shmmax=280246616064
To make the change permanent
This file is used during the boot process.
Edit /etc/sysctl.conf with below lines:
kernel.shmmni = 4096 kernel.shmall = 92798976 kernel.shmmax = 280246616064
What are the optimal values for SHMMAX SHMMNI SHMALL ?
SHMMAX : Either SGA size of any individual database or half size of the system memory, whichever is the higher.
SHMMNI: Normally default value 4096 should be sufficient.
SHMALL: The sum of all the SGAs on the system, divided by the page size. The page size can be gotton by :
$ getconf PAGE_SIZE 4096