Re: starting the database

  • From: "Michael McMullen" <ganstadba@xxxxxxxxxxx>
  • To: <fred_fred_1@xxxxxxxxxxx>, <oracle-l@xxxxxxxxxxxxx>
  • Date: Mon, 1 May 2006 12:06:23 -0400

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@xxxxxxxx"

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
--
//www.freelists.org/webpage/oracle-l


Other related posts: