Category - LINUX

Use of SYSRESV for DBA

SYSRESV Details
==================

This provide facility to get details of mapped shared memory with oracle instances.

This utility can be used to both identify which shared memory segments belong to which instances and eliminate any DBA guess work or difficult correlation via alternative mechanism.

sysresv is the utility provided by oracle to manage the shared memory and semaphores used by the oracle SID by that users.

==> Location of SYSRESV executables.

[oracle@ace2oracledb bin]$ pwd
/oracle_home/app/19c/oracle/bin
[oracle@ace2oracledb bin]$
[oracle@ace2oracledb bin]$

[oracle@ace2oracledb bin]$ sysresv

IPC Resources for ORACLE_SID "STDB" :
Maximum shared memory segment size (shmmax): 4398046511104 bytes
Total system shared memory (shmall): 4398046511104 bytes
Total system shared memory count (shmmni): 4096
*********************** Dumping ipcs output ********************

------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages    

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status      
0x00000000 262144     grid       777        16384      1          dest      --------------->>>> dest means " Need to be destroyed"    
0x00000000 294913     grid       777        7602176    2          dest         
0x0d3effb0 1900546    grid       600        28672      27                      
0x00000000 524291     grid       777        7602176    2          dest         
0x00000000 491524     grid       600        524288     2          dest         
0x00000000 1114117    grid       600        524288     2          dest         
0x00000000 655366     grid       600        524288     2          dest         
0x00000000 1015815    grid       600        16777216   2          dest         
0x00000000 2981896    oracle     600        8904704    111                     
0x00000000 1179657    grid       777        7127040    2          dest         
0x00000000 3014666    oracle     600        3372220416 56                      
0x00000000 3047435    oracle     600        7872512    56                      
0x8e70e24c 3080204    oracle     600        20480      56                      
0x00000000 2686990    grid       777        7127040    2          dest         
0x00000000 2654223    grid       600        524288     2          dest         

------ Semaphore Arrays --------
key        semid      owner      perms      nsems     
0xf297b4a4 753664     grid       600        124       
0xdc546154 1310721    oracle     600        250       
0xdc546155 1343490    oracle     600        250       

*********************** End of ipcs command dump **************
 

***************** Dumping Resource Limits(s/h) *****************
core file size                         0 KB/UNLIMITED         
data seg size                     UNLIMITED/UNLIMITED         
scheduling priority                    0 KB/0 KB              
file size                         UNLIMITED/UNLIMITED         
pending signals                       34 KB/34 KB             
max locked memory                    128 GB/128 GB            
max memory size                   UNLIMITED/UNLIMITED         
open files                            64 KB/64 KB             
POSIX message queues                 800 KB/800 KB            
real-time priority                     0 KB/0 KB              
stack size                            32 MB/32 MB             
cpu time                          UNLIMITED/UNLIMITED         
max user processes                    16 KB/16 KB             
virtual memory                    UNLIMITED/UNLIMITED         
file locks                        UNLIMITED/UNLIMITED         

***************** End of Resource Limits Dump ******************
Maximum map count configured per process:  65530
Total /dev/shm size: 3906871296 bytes, used: 671608832 bytes
Shared Memory:                                                              >>>>>>>>>>>> Shared memory details
ID        KEY
3014666     0x00000000
3047435     0x00000000
2981896     0x00000000
3080204     0x8e70e24c
Semaphores:                                                                 >>>>>>>>>>>> Semaphores Details
ID        KEY
1310721     0xdc546154
1343490     0xdc546155
Oracle Instance alive for sid "STDB"
[oracle@ace2oracledb bin]$
[oracle@ace2oracledb bin]$


=====>>>>

[oracle@ace2oracledb bin]$ sysresv -help
sysresv: invalid option -- 'h'
usage    : sysresv [-if] [-d ] [-l sid1 ...]
      -i : Prompt before removing ipc resources for each sid
      -f : Remove ipc resources silently, oevrrides -i option
      -d : List ipc resources for each sid if on
      -l sid1 .. : apply sysresv to each sid
Default    : sysresv -d on -l $ORACLE_SID
Note    : ipc resources will be attempted to be deleted for a
      sid only if there is no currently running instance
      with that sid.
[oracle@ace2oracledb bin]$


====>>>>>

Examples:
---------

o  Instance is not running:

   /u02/app/oracle/product/8.1.7> sysresv

   IPC Resources for ORACLE_SID "R817" :
   Shared Memory
   ID              KEY
   No shared memory segments used
   Semaphores:
   ID              KEY
   No semaphore resources used
   Oracle Instance not alive for sid "R817"


o  Instance is running:

   /u03/app/oracle/product/8.1.6> sysresv

   IPC Resources for ORACLE_SID "ORCL" :
   Shared Memory:
   ID              KEY
   16437           0xe4efa8dc
   Semaphores:
   ID              KEY
   12320802        0x09d48346
   Oracle Instance alive for sid "ORCL"


o  Attempting to remove memory and semphores using sysresv when Oracle
   detects an instance is running:

   /u03/app/oracle/product/8.1.6> sysresv -f

   IPC Resources for ORACLE_SID "ORCL" :
   Shared Memory:
   ID              KEY
   16437           0xe4efa8dc
   Semaphores:
   ID              KEY
   12320802        0x09d48346
   Oracle Instance alive for sid "ORCL"
   SYSRESV-005: Warning
           Instance maybe alive - aborting remove for sid "ORCL"


o  Removing IPC resources:

   [Sysresv shows memory and semaphores exist but Oracle determines the
    instance is not alive.  Cleanup is needed.]

   /u03/app/oracle/product/8.1.6> sysresv

   IPC Resources for ORACLE_SID "ORCL" :
   Shared Memory:
   ID              KEY
   16837           0xe4efa8dc
   Semaphores:
   ID              KEY
   12714018        0x09d48346
   Oracle Instance not alive for sid "ORCL"
 

o  Removing IPC resources using sysresv:

   /u03/app/oracle/product/8.1.6> sysresv -i

   IPC Resources for ORACLE_SID "ORCL" :
   Shared Memory
   ID              KEY
   No shared memory segments used
   Semaphores:
   ID              KEY
   No semaphore resources used
   Oracle Instance not alive for sid "ORCL"
   Remove ipc resources for sid "ORCL" (y/n)?y
   Done removing ipc resources for sid "ORCL"
   /u03/app/oracle/product/8.1.6


   Verify the resources were removed:

   /u03/app/oracle/product/8.1.6> sysresv

   IPC Resources for ORACLE_SID "ORCL" :
   Shared Memory
   ID              KEY
   No shared memory segments used
   Semaphores:
   ID              KEY
   No semaphore resources used
   Oracle Instance not alive for sid "ORCL"  

     
o  If you need to remove memory segments, and Oracle detects the
   instance is alive through sysresv:

   % ipcrm -m

   Where is the memory id shown in the sysresv output.

   Example:
   % ipcrm -m 16437

   If you need to remove semaphores, and Oracle detects the
   instance is alive through sysresv:

   % ipcrm -s

   where is the semaphore id shown in the sysresv output.

   Example:
   % ipcrm -s 12320802


References:
===========

Note:115235.1 Resolving ORA-7279 or ORA-27146 errors when starting instance.
Bug:566223
Bug Number 1588021