Semaphores are a system resource that Oracle utilizes for interprocess communication and they occupy a relatively small memory space, while shared memory is utilized to contain the SGA and can garner a large portion of physical memory.
That is message on Oracle Doc.
Before we install Oracle, we should tune kernel parameters for Semaphores and shared memory.
System Parameters
=================
SHMMAX - kernel parameter controlling maximum size of one shared memory segment
SHMMNI - kernel parameter controlling maximum number of shared memory segments in the system
SHMSEG - kernel parameter controlling maximum number of shared memory segments a process can attach
SEMMNS - kernel parameter controlling maximum number of semphores in the system
SEMMNI - kernel parameter controlling maximum number of semaphore sets. Semphores in Unix are allocated in sets of 1 to SEMMSL.
SEMMSL - kernel parameter controlling maximum number of semaphores in a semphore set.
SHMLBA - kernel parameter controlling alignment of shared memory segments; all segments must be attached at multiples f this value.
Anyway How can I display Semaphores and shared memory ?
# $ORACLE_HOME/bin/sysresv
IPC Resources for ORACLE_SID "testdb" :
Shared Memory:
ID KEY
1108115457 0x15fb4638
Semaphores:
ID KEY
23003136 0xa6a3e088
Oracle Instance alive for sid "testdb"
"sysresv", that is commamd from oracle software:
usage : sysresv [-if] [-d
-i : Prompt before removing ipc resources for each sid
-f : Remove ipc resources silently, oevrrides -i option
-d
-l sid1
Default : sysresv -d on -l $ORACLE_SID
If you need to remove ipc resouce:
Example:
$ $ORACLE_HOME/bin/sysresv -if -l testdb
IPC Resources for ORACLE_SID "testdb" :
Shared Memory:
ID KEY
1108115457 0x15fb4638
Semaphores:
ID KEY
23003136 0xa6a3e088
Oracle Instance alive for sid "testdb"
SYSRESV-005: Warning
Instance maybe alive - aborting remove for sid "testdb"
>>>
If you need to display Semaphores and shared memory by unix command:
you can use "ipcs" command:
ipcs [ -asmq ] [ -tclup ]
ipcs [ -smq ] -i id
ipcs -h
Example:
$ ipcs -a
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x15fb4638 1108115457 oracle 660 4096 0
0x5a164a00 1100414980 oracle 660 4096 0
------ Semaphore Arrays --------
key semid owner perms nsems
0xa6a3e088 23003136 oracle 660 204
0x8d3ac6b4 14876675 oracle 660 104
>>>
$ ipcs -l
------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 67108864
max total shared memory (kbytes) = 16777216
min seg size (bytes) = 1
------ Semaphore Limits --------
max number of arrays = 100
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 128
semaphore max value = 32767
------ Messages: Limits --------
max queues system wide = 16
max size of message (bytes) = 8192
default max size of queue (bytes) = 16384
>>>
$ ipcs -m
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x15fb4638 1108115457 oracle 660 4096 0
0x5a164a00 1100414980 oracle 660 4096 0
>>>
$ ipcs -s
------ Semaphore Arrays --------
key semid owner perms nsems
0xa6a3e088 23003136 oracle 660 204
0x8d3ac6b4 14876675 oracle 660 104
And you need to remove Semaphores and shared memory (use "ipcrm")
ipcrm [ -M key -m id -Q key -q id -S key -s id ] ...
Shared Memory Segments:
$ ipcs -m
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x15fb4638 1108115457 oracle 660 4096 0
0x5a164a00 1100414980 oracle 660 4096 0
$ ipcrm -m 1100414980
$ ipcs -m
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x15fb4638 1108115457 oracle 660 4096 0
Semaphores:
$ ipcs -s
------ Semaphore Arrays --------
key semid owner perms nsems
0xa6a3e088 23003136 oracle 660 204
0x8d3ac6b4 14876675 oracle 660 104
$ ipcrm -s 14876675
$ ipcs -s
------ Semaphore Arrays --------
key semid owner perms nsems
We use "ipcrm" to remove "shared memory segment", when we shutdown Oracle database and no reallocate "shared memory segment".
Before use "ipcrm" to remove Semaphores and shared memory, we must check.... and check, Because it can make Oracle Instance DOWN!
No comments:
Post a Comment