Cleanup of IPC segments under Sun Solaris and Oracle 9iR2

OCPdba.Net

Using the following steps you can identify and cleanup the appropriate IPC segments on a machine running multiple databases.
  • List the core database processes
  • 
         dbbox bash-2.03$ ps -ef|grep _TESTDB
         oracle   718   707  0 16:25:52 pts/1    0:00 grep _TESTDB
         oracle   326     1  0   Jan 10 ?        0:00 ora_pmon_TESTDB
         oracle   328     1  0   Jan 10 ?        0:00 ora_dbw0_TESTDB
         oracle   330     1  0   Jan 10 ?        0:00 ora_dbw1_TESTDB
         oracle   332     1  0   Jan 10 ?        0:01 ora_lgwr_TESTDB
         oracle   334     1  0   Jan 10 ?        0:33 ora_ckpt_TESTDB
         oracle   336     1  0   Jan 10 ?        0:36 ora_smon_TESTDB
         oracle   338     1  0   Jan 10 ?        0:00 ora_reco_TESTDB
         oracle   340     1  0   Jan 10 ?        0:00 ora_cjq0_TESTDB
    
             
  • Connect to the database, using the process id of the ora_pmon_TESTDB process (326), trace the process
  • 
    
       dbbox bash-2.03$ export ORACLE_SID=TESTDB
       dbbox bash-2.03$ sqlplus "/ as sysdba"
    
       Connected to:
       Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
       With the Partitioning, OLAP and Oracle Data Mining options
       JServer Release 9.2.0.1.0 - Production
       
       SQL> oradebug ipc
       ORA-00074: no process has been specified
       SQL> oradebug setospid 326
       Oracle pid: 2, Unix process pid: 326, image: oracle@dbbox (PMON)
       SQL> oradebug ipc
       Information written to trace file.
       SQL>
    
       SQL> quit
       Disconnected from Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
       With the Partitioning, OLAP and Oracle Data Mining options
       JServer Release 9.2.0.1.0 - Production
       dbbox bash-2.03$ cd $ORACLE_HOME/admin/TESTDB/bdump/
    
             
  • Look in the background_dump_dest directory for the trace file, in this case $ORACLE_HOME/admin/TESTDB/bdump/testdb_pmon_326.trc
  • 
       dbbox bash-2.03$ ls -alrt /u01/oracle/OraHome3/admin/TESTDB/bdump
       total 174
       drwxr-xr-x   5 oracle   dba          512 Oct  3 16:38 ..
       -rw-r-----   1 oracle   dba          539 Jan 10 17:06 testdb_lgwr_522.trc
       -rw-r--r--   1 oracle   dba        65403 Jan 10 17:10 alert_TESTDB.log
       -rw-r-----   1 oracle   dba         5889 Jan 13 17:14 testdb_pmon_326.trc
       drwxr-xr-x   2 oracle   dba          512 Jan 14 08:52 .
       
             
  • Here are the relevant parts of the file.
  • 
         #
         #  First the shared memory segment id is found
         #  Note the Shmid parameter value (101) this is the Shared Memory segment id
         #
    
        32  Dump of unix-generic realm handle `/u01/oracle/OraHome3TESTING', flags = 00000000
        33   Area #0 `Fixed Size' containing Subareas 0-0
        34    Total size 000000000006f1b8 Minimum Subarea size 00000000
        35     Area  Subarea    Shmid      Stable Addr      Actual Addr
        36        0        0      101 0000000020000000 0000000020000000
        37                                Subarea size     Segment size
        38                            0000000000070000 000000001e400000
    
         #
         #  Now, the semaphore id is obtained
         #  The line following line 124 "Semaphore List=" shows the actual semaphore ID for this database
         #  The listing shows the Semaphores for more than one database running, the key line is 125
         #  which shows the ID for the current database.
         #
         #  In this example the Semaphore ID is 196608
         #
    
       124  Semaphore List=
       125  196608
       126  -------------- system semaphore information -------------
       127  IPC status from  as of Mon Jan 13 17:14:42 CST 2003
       128  T         ID      KEY        MODE        OWNER    GROUP  CREATOR   CGROUP NSEMS   OTIME    CTIME
       129  Semaphores:
       130  s     196608   0x98b25d60 --ra-r-----   oracle      dba   oracle      dba   154 17:12:30 17:09:53
       131  s     720897   0xe02ffb54 --ra-r-----   oracle      dba   oracle      dba   154  9:15:00 20:46:19
    
       
             
  • Cleanup the processes
  • 
       dbbox bash-2.03$ ipcs
       IPC status from  as of Tue Jan 14 09:32:08 CST 2003
       Message Queue facility inactive.
       T         ID      KEY        MODE        OWNER    GROUP
       Shared Memory:
       m          0   0x5007801c --rw-r--r--     root     root
       m        101   0x753d6cc  --rw-r-----   oracle      dba
       Semaphores:
       s     196608   0x98b25d60 --ra-r-----   oracle      dba
       s     720897   0xe02ffb54 --ra-r-----   oracle      dba   
    
       #
       # DO NOT ACTUALLY DO THIS UNLESS YOU WANT TO CLEANUP AFTER A CRASHED DATABASE!
       #
    
       #
       # Remove the shared memory segment
       #
       ipcrm -m 101
    
       #
       # Remove the semaphore
       #
       ipcrm -s 196608
       
    
             

    OCPdba.Net