Friday, April 11, 2014

You should manage shared memory carefully if you are running multiple oracle instances on the same server

The ipcs command on LINUX/UNIX systems can help you to monitor the ORACLE SGA by displaying the size of each shared memory segment of the SGA.
If an oracle instance crashes abruptly, it may be possible that some shared memory segments are not released, if this happen you can use the ipcrm command to remove these segments.
The SHMMAX system setting allows you to increase the maximum size of a single shared memory segment.

To see how many oracle shared memory segments are used on your system

[oracle@dbbckp ~]$ ipcs

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status      
0x00000000 77266945   oracle     640        4096       0                       
0x00000000 77299714   oracle     640        4096       0                       
0xc8f5d818 77332483   oracle     640        4096       0                       
0x00000000 77004804   oracle     640        4096       0                       
0x00000000 77037573   oracle     640        4096       0                       
0x4975d098 77070342   oracle     640        4096       0                       

------ Semaphore Arrays --------
key        semid      owner      perms      nsems     
0x56565656 688142     root       666        3         
0x0000041e 786449     root       644        1         
0x000003d4 819218     root       644        1         
0x0000033d 851987     root       644        1         
0xe5873228 233832468  oracle     640        125       
0xe5873229 233865237  oracle     640        125       
0xe587322a 233898006  oracle     640        125       
0xe587322b 233930775  oracle     640        125       
0xe587322c 233963544  oracle     640        125       
0xe587322d 233996313  oracle     640        125       
0xe587322e 234029082  oracle     640        125       
0xe587322f 234061851  oracle     640        125       
0xe5873230 234094620  oracle     640        125       
0x66d899d4 233046045  oracle     640        125       

------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages    
0x000004d2 65537      root       666        0            0 

But if your are running multiple oracle instances on the same server, this output doesn't tell you which  instance is using which segments.
You can use the oracle sysresv utility to identify segments used by an instance (ORACLE_SID = DRTEST)

[oracle@dbbckp ~]$ sysresv

IPC Resources for ORACLE_SID "DRTEST" :
Shared Memory:
ID              KEY
77004804        0x00000000
77037573        0x00000000
77070342        0x4975d098
Semaphores:
ID              KEY
233046045       0x66d899d4
233078814       0x66d899d5
233111583       0x66d899d6
233144352       0x66d899d7
233177121       0x66d899d8
233209890       0x66d899d9
233242659       0x66d899da
233275428       0x66d899db
233308197       0x66d899dc
Oracle Instance alive for sid "DRTEST"

Now you can use the ipcrm command to remove these segments

ipcrm -s <ID> for Semaphores
ipcrm -m <ID> for Shared Memory

No comments:

Post a Comment