Semaphores – Oracle OS parameters

SYSTEM SETTINGS

semaphores Oracle uses shared memory and semaphores to communicate between processes and the SGA (System Global Area). Oracle uses semaphores to control concurrency between all the background processes (PMON, SMON, DBWn, LGWR, and oracle shadows). ipcs -sb will show semaphores currently allocated to the system at the moment. This will display all the semaphore sets allocated, their identifying number, the owner, the number of semaphores in each set, and more.
Occasionally, unexpected termination of Oracle processes will leave semaphore resources locked. If database is not running, but ipcs -sb shows that semaphore sets owned by oracle are still in use, then these will need to be deallocated (freed). Freeing semaphore sets is done with the ipcrm command. For each set that oracle has allocated, type ipcrm -s ID where ID is the set number you see from the ipcs output. Semaphores can also be freed by rebooting the system.
semmns The number of semaphores in the system. kernel parameter controlling maximum number of semphores in the system. Related parameter: processes.
To set the kernel parameter for SEMMNS, use this formula: For example, consider a server has three instances with processes set to:
instance A has processes=100
instance B has processes=100
instance C has processes=200
The value of SEMMNS is calculated as follows: SEMMNS = ((A=100) + (B=100)) + ((C=200) * 2) + ((# of instances=3) * 10) = 630
or
SEMMS = (total number of processes * 2) + (number of instances * 10)
semmni Maximum number of semaphores identifiers in the system. Determines the number of semaphore sets that can be created at any one time. kernel parameter controlling maximum number of semaphore sets. Semphores in Unix are allocated in sets of 1 to SEMMSL.
semmsl The maximum number of sempahores that can be in one semaphore set. Kernel parameter controlling maximum number of semaphores in a semphore set. It should be same size as maximum number of processes for all instances on the server. Related parameter: processes.
shmmhi Kernel parameter controlling maximum number of shared memory segments in the system.
shmmax The maximum size(in bytes) of a single shared memory segment. Kernel parameter controlling maximum size of one shared memory segment.
Related parameters: shared_pool_size, db_cache_size, log_buffer, large_pool_size, db_block_buffers
shmmin The minimum size(in bytes) of a single shared memory segment. Kernel parameter controlling minimum size of one shared memory segment
shmmni The number of shared memory identifiers.
shmseg The maximum number of shared memory segments that can be attached by a process. Kernel parameter controlling maximum number of shared memory segments a process can attach
shmlba kernel parameter controlling alignment of shared memory segments. All segments must be attached at multiples of this value
maxfiles Soft file limit per process. Related parameter: db_files. Also see maxdatafiles.
nfile Maximum number of simultaneously open files systemwide at any given time. Also see maxdatafiles.
nproc Maximum number of processes that can exist simultaneously in the system. Related parameter: processes.
plimit To find the file size limit for server: plimit $$
ulimit To find the file size limit per current session: ulimit -Sa

——————————————————————————–

Current settings ( unix) :
/u01/app/oracle: /etc/sysdef|grep -i semm
1000 semaphore identifiers (SEMMNI)
20000 semaphores in system (SEMMNS)
800 undo structures in system (SEMMNU)
512 max semaphores per id (SEMMSL)
/u01/app/oracle:

Settings which go into effect after next server bounce:
/u01/app/oracle: grep semm /etc/system
set semsys:seminfo_semmap=100
set semsys:seminfo_semmni=1000
set semsys:seminfo_semmns=20000
set semsys:seminfo_semmnu=800
set semsys:seminfo_semmsl=512
/u01/app/oracle:

——————————————————————————–

Current settings ( linux) :
/u01/app/oracle: ipcs -ls

—— Semaphore Limits ——–
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 100
semaphore max value = 32767

/u01/app/oracle:

Determine the maximum number of file handles for the entire system:
/u01/app/oracle/local/bin: cat /proc/sys/fs/file-max
209708
/u01/app/oracle/local/bin:

Show the current usage of file handles using:
/u01/app/oracle: cat /proc/sys/fs/file-nr
5476 4456 209708

In the above example output, here is an explanation of the three values from the file-nr command:
Total number of allocated file handles.
Total number of file handles currently being used.
Maximum number of file handles that can be allocated.

This is essentially the value of file-max – (see above).

——————————————————————————–

Recommended Semaphore and Shared Memory Parameters

Operating System Shared Memory Parameters Semaphore
—————- ———————— ———
Sun OS SHMSIZE = 32768 SEMMNS = 200
SHMMNI = 50 SEMMNI = 50

Solaris SHMMAX = 8388608 (or larger than max SGA) SEMMNS = 200
SHMSEG = 20 SEMMSL = 50
SHMMNI = 100 SEMMNI = 70

——————————————————————————–

ipcs -ma — shows semaphores and memory in use.
psCpu — equals = ps -eo pid,pcpu,vsz,rss,stime,comm|sort -nr -k2|head’
/etc/sysdef|grep -i semm — semaphore settings
ipcs -b |grep oracle — if is running, find out how many semaphores (semmns) are being used by typing:
kstat -m vmem -n semaphore
vmstat — virtual memory statistics

/etc/sysdef|grep -i shm — shared memory settings
ipcs | grep oracle — will list all semaphores and shared memory segments belonging to oracle.
ipcs -ma — shows semaphores and memory in use.
/usr/sbin/prtconf | grep size — show RAM on the system
top — shows the the real memory used by that process plus the shared memory being used by the SGA
psMem — tells you the top 10 memory-using processes. If there are more than 4 over 1.5GB, you have problems

svrmgrl> oradebug ipc
pmap
ipcs -b — Prints information on biggest allowable size: maximum number of bytes
in messages on queue for message queues, size of segments for shared memory,
and number of semaphores in each set for semaphores.
showrev -p — show operating system Patch info
file descriptors???

——————————————————————————–

ORA-27146 post/wait initialization failed — Post/Wait errors are normally due to lack of semaphores,
as Oracle takes all the semaphores at startup time.

——————————————————————————–

The ora-3113 might result if the system has run out of semaphores.

Use “ipcs -b” to see how many semaphores and semaphore sets are currently in use.
Check the /etc/system file for kernel settings :
(SEMMNI) maximum number of semaphore identifiers in the system
(SEMMSL) maximum number of semaphores in a set
(SEMMNS) maximum number of semaphores in the system
(SEMOPM) maximum number of operations per semop call
(SEMVMX) semaphore maximum value
Modify the /etc/system file and set the kernel parameters for semaphores, then reboot the system.

Check if your SEMMNS parameter in /etc/system
satisfy this formula :
==================================================================

ORACLE_SID=A, PROCESSES=100
ORACLE_SID=B, PROCESSES=100
ORACLE_SID=C, PROCESSES=200
The value of SEMMNS is calculated as follows:

SEMMNS = [(A=100) + (B=100)] + [(C=200) * 2] + [(# of instances=3) * 10] =630
or
SEMMNS = (total number of processes * 2) + (number of instances * 10)
===================================================================

Advertisements

One Response

  1. Hurrah, that’s what I was looking for, what a material! present here at this blog, thanks admin of this site.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: