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: starting the database

Re: starting the database

From: Michael McMullen <ganstadba_at_hotmail.com>
Date: Mon, 1 May 2006 12:06:23 -0400
Message-ID: <BAY103-DAV4536F336FEC648332534FA6B10@phx.gbl>


This is the most elegant one I've seen. You don't need a real oracle username/password. This has the added benefit of checking the listener. As stated by everyone else, don't have something automatically start the database. I don't even do it on a server reboot. Databases crash for a reason. This reason needs to be investigated. Just have the mailx go to a pager.

Mike

export

PATH="/bin:/usr/bin:/usr/ucb:/etc:/usr:/usr/css/bin:/usr/ccs/lib:/usr/privat
e/etc:/usr/private/etc/raddb:/usr/sbin:/opt/bin:/u01/app/oracle/product/9.2/
bin:/opt/perl5/lib/5.00503:/opt/expect/expect/expect-RUN/opt/expect/lib:/opt

/tcl-8.0/tcl/tcl-RUN/opt/tcl-8.0/lib"

export ORACLE_HOME="/u01/app/oracle/product/9.2" export SHLIB_PATH="/u01/app/oracle/product/9.2/lib:/usr/lib" export ORACLE_BASE="/u01/app/oracle"
export SHELL="/usr/bin/ksh"

MAILLIST="yourmaillisthere_at_mail.com"

if [ "$1" ]
then DBNAME=$1
else echo "\nOracle SID has not been entered." exit 16
fi

sqlplus -silent << EOF > /tmp/$$.1
whenever sqlerror exit
a/a@${DBNAME}
exit;
EOF
egrep 'ORA-121|ORA-01034' /tmp/$$.1 > /dev/null if [[ $? = 0 ]]
then

   mailx -s " ${DBNAME} is not accessible - db is down" ${MAILLIST} <
/tmp/$$.1

else

   grep 'ORA-01017' /tmp/$$.1 > /dev/null    if [[ $? = 0 ]]
   then

      exit 16
   else
   mailx -s " ${DBNAME} is not accessible - db is down" ${MAILLIST} <
/tmp/$$.1

   fi
fi

rm /tmp/$$.1

exit

--
http://www.freelists.org/webpage/oracle-l
Received on Mon May 01 2006 - 11:06:23 CDT

Original text of this message

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