General / Documentos / Soporte Técnico / Servicios / Tilsor
 
 

DETERMINING WHICH INSTANCE OWNS WHICH SHARED MEMORY & SEMAPHORE SEGMENTS

Creation Date: 03-FEB-1999
Last Revision Date: 08-JUN-2000


Purpose
=======

This article describes how to identify which shared memory and semaphore
segments are owned by a particular instance, in Oracle v7.x and v8.0.


Scope & Application
===================

This is helpful when in recovery situations where the instance may not have
released the shared memory or semaphores on database shutdown.


How To Determine Which Instance Owns Which Shared memory And Semaphore Segments
============================================

You have several instances running and one instance crashes and leaves
"sgadef<sid>.dbf" file, shared memory and semaphore segments running. As there are many
instances running, you are unsure which segments to kill and when to do an
ipcs. You may see several shared memory and semaphore segments.

This is an example of what you may see:

% ipcs -b (this command will return something similar to the following output)


IPC status from /dev/kmem as of Wed Apr 8 16:12:18 1998
T ID KEY MODE OWNER GROUP QBYTES
Message Queues:
m 2 0x4e0c0002 --rw-rw-rw- root root 31008
m 3 0x41200207 --rw-rw-rw- root root 8192
m 45060 0x5fa4f34e --rw-r----- osupport dba 4526080
m 8709 0x5fa5b36c --rw-r----- osupport dba 4640768
m 12806 0x00000000 D-rw-r----- osupport dba 4640768
m 4615 0x6aac51e2 --rw-r----- osupport dba 5140480
m 6664 0x5aac503f --rw-r----- osupport dba 4392968
m 6665 0x5fa37342 --rw-r----- osupport dba 6422528
m 17418 0x5fa2b2b1 --rw-r----- osupport dba 4640768
m 523 0x5fa23296 --rw-r----- osupport dba 4591616
m 1036 0x52aea224 --rw-r----- usupport dba 4521984
Semaphores:
s 0 0x2f180002 --ra-ra-ra- root sys 6
s 1 0x411c02f9 --ra-ra-ra- root root 1
s 2 0x4e0c0002 --ra-ra-ra- root root 2
s 3 0x41200207 --ra-ra-ra- root root 2
s 4 0x00446f6e --ra-r--r-- root root 1
s 5 0x00446f6d --ra-r--r-- root root 1
s 6 0x01090522 --ra-r--r-- root root 1
s 11271 0x00000000 --ra-r----- osupport dba 50
s 4360 0x00000000 --ra-r----- osupport dba 50
s 2828 0x00000000 --ra-r----- osupport dba 50


You can determine which shared memory and semaphore segments NOT to kill.

*NOTE: It is very hard to guess, and very dangerous to those
instances still running.

First, set your "ORACLE_SID" and "ORACLE_HOME", then log into each individual
instance you have up and 'running'.

The following is an example of how to proceed:

SVRMGR> connect internal
Connected.

SVRMGR> oradebug ipc

-------------- Shared memory --------------
Seg Id Address Size
6665 c4c94000 6422528
Total: # of segments = 1, size = 6422528
-------------- Semaphores ----------------
Total number of semaphores = 50
Number of semaphores per set = 50
Number of semaphore sets = 1
Semaphore identifiers:
2828

The following output shows the shared memory segment and semaphore segment:

Seg Id Address Size
6665 c4c94000 6422528
Semaphore identifiers:
2828

Then look to verify this is running with the following command

% ipcs -b

m 6665 0x5fa37342 --rw-r----- osupport dba 6422528
s 2828 0x00000000 --ra-r----- osupport dba 50

You now know these are valid segments on a running database. Using this
process of elimination you can identify the idle segments from a crashed
instance. You can then kill them using "ipcrm -m" and "ipcrm -s" respectfully.

The command syntax to remove the shared memory segments or semaphores is as
follows:

% ipcrm -m <shared memory id>

% ipcrm -s <semaphore id>


Search Words:
=============

ORA-07307, segment, shmmax, semmns, semaphores, oradebug, ipc