Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Shutdown Abort Damages Database!

Re: Shutdown Abort Damages Database!

From: <Brian_P_MacLean_at_efunds.com>
Date: Tue, 06 Aug 2002 16:40:32 -0800
Message-ID: <F001.004AD0F3.20020806164032@fatcity.com>

In my testing a shutdown abort always cleaned up the IPC resources.

I have had situations where the database was completely hung (even svrmgrl hung) and a "kill -9" on all db processes including smon/pmon/etc. was the only resolution, therefore I had to execute the "ipcrm" commands to clean things up.

This is a little korn shell jewel called OKILL that will kill all sessions, background processes, and IPC resources selectively. I keep it as a function in my .profile file. The function requires that your Oracle environment be set and that the "OKILL -s ORACLE_SID" option passed be the same. An example run follows the function definition.

function OKILL
{
OPT_s="?"
while getopts s:h option
do
  case "${option}"
  in

     s) OPT_s="${OPTARG}";;
     h | \?) echo "usage: OKILL [-h] -s ORACLE_SID";return;;
  esac
done
if [ "${OPT_s}" = "?" ]
then
  echo "usage: OKILL [-h] -s ORACLE_SID";return elif [ "${OPT_s}" != "${ORACLE_SID}" ]
then
  echo "Passed -s database (${OPT_s}) must match your current environment database (${ORACLE_SID})"
else
  typeset -u ANS
  echo "\nAbout to kill all sessions connected to database ${OPT_s}"   read ANS?"Do you wish to continue (y/n): "   if [ "${ANS}" = "Y" ]
  then
    ps -ef | grep oracle${OPT_s} | grep -v grep | awk '{printf ("%s\n", $2) }' | while read v_PID

    do

      echo "Killing process ${v_PID}"
      kill -9 ${v_PID}

    done
    echo "All sessions are now terminated"   else
:

  fi
  echo "\nAbout to kill all background processes connected to database ${OPT_s}"
  read ANS?"Do you wish to continue (y/n): "   if [ "${ANS}" = "Y" ]
  then
    ps -ef | grep ora_...._${OPT_s} | grep -v grep | awk '{printf ("%s\n", $2) }' | while read v_PID

    do

      echo "Killing process ${v_PID}"
      kill -9 ${v_PID}

    done
    echo "All background processes are now terminated"   else
:

  fi
  echo "\nAbout to remove all IPC resources associated with database ${OPT_s}"
  read ANS?"Do you wish to continue (y/n): "   if [ "${ANS}" = "Y" ]
  then
    $ORACLE_HOME/bin/sysresv | egrep -v "^$|^ID|^IPC|^Oracle" | while read v_FIELD1 v_FIELD2

    do

      if [ "${v_FIELD1}" = "Shared" ]
      then
        SW=Shared
      elif [ "${v_FIELD1}" = "Semaphores:" ]
      then
        SW="Semaphores:"
      elif [ "${SW}" = "Shared" ]
      then
        echo "Removing Shared Memory segment ${v_FIELD1}"
        ipcrm -m ${v_FIELD1}
      elif [ "${SW}" = "Semaphores:" ]
      then
         echo "Removing Semaphore set ${v_FIELD1}"
         ipcrm -s ${v_FIELD1}
      else
        :
      fi

    done
    echo "All IPC resources are now removed"   else
:

  fi
fi
}

11066:oracle7_at_bart> psg SLXT

     UID   PID  PPID  C    STIME TTY      TIME CMD
 oracle7  1190  1189  0 17:57:54 ?        0:00 oracleSLXT (DESCRIPTION
=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
 oracle7 12716     1  0 23:02:51 ?        0:00 ora_pmon_SLXT
 oracle7 12718     1  0 23:02:51 ?        0:01 ora_dbw0_SLXT
 oracle7 12720     1  0 23:02:51 ?        0:01 ora_lgwr_SLXT
 oracle7 12722     1  0 23:02:51 ?        0:20 ora_ckpt_SLXT
 oracle7 12724     1  0 23:02:52 ?        0:05 ora_smon_SLXT
 oracle7 12726     1  0 23:02:52 ?        0:00 ora_reco_SLXT

11066:oracle7_at_bart> sysresv
IPC Resources for ORACLE_SID "SLXT" :
Shared Memory:

ID              KEY
17              0xa315f930
Semaphores:
ID              KEY
196722          0x0e1d50f5
115             0x0e1d50f6
116             0x0e1d50f7
117             0x0e1d50f8
118             0x0e1d50f9
119             0x0e1d50fa
120             0x0e1d50fb
121             0x0e1d50fc
122             0x0e1d50fd
123             0x0e1d50fe
124             0x0e1d50ff
125             0x0e1d5100

Oracle Instance alive for sid "SLXT"

11066:oracle7_at_bart> OKILL -s SLXT

About to kill all sessions connected to database SLXT Do you wish to continue (y/n): y
Killing process 1190
All sessions are now terminated

About to kill all background processes connected to database SLXT Do you wish to continue (y/n): y
Killing process 12716
Killing process 12722
Killing process 12720
Killing process 12726
Killing process 12724
Killing process 12718
All background processes are now terminated

About to remove all IPC resources associated with database SLXT Do you wish to continue (y/n): y
Removing Shared Memory segment 17
Removing Semaphore set 196722
Removing Semaphore set 115
Removing Semaphore set 116
Removing Semaphore set 117
Removing Semaphore set 118
Removing Semaphore set 119
Removing Semaphore set 120
Removing Semaphore set 121
Removing Semaphore set 122
Removing Semaphore set 123
Removing Semaphore set 124
Removing Semaphore set 125
All IPC resources are now removed
11066:oracle7_at_bart>

                                                                                                                                         
                      "Post, Ethan"                                                                                                      
                      <Ethan.Post_at_ps.ne        To:       Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>                     
                      t>                       cc:                                                                                       
                      Sent by:                 Subject:  Shutdown Abort Damages Database!                                                
                      root_at_fatcity.com                                                                                                   
                                                                                                                                         
                                                                                                                                         
                      08/06/02 03:08 PM                                                                                                  
                      Please respond to                                                                                                  
                      ORACLE-L                                                                                                           
                                                                                                                                         
                                                                                                                                         




OK, that was bait, I admit it.

So we all know that shutdown abort doesn't damage the database. However, do
we have to ever worry about any UNIX shared memory segments hanging out there? I know we do if we end up having to kill the background procs but is
this ever a case with shutdown abort?

Also does anyone have some good step by step instructions for cleaning up a UNIX box after you kill the background procs?

--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Post, Ethan
  INET: Ethan.Post_at_ps.net

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).





-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: Brian_P_MacLean_at_eFunds.Com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Tue Aug 06 2002 - 19:40:32 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US