Linux下Oracle开机自启动与oratab,dbstart脚本说明(六)

2014-11-24 12:36:51 · 作者: · 浏览: 2
= 5 ] ; then
# 5 tries with 60 sec interval=> 5 minutes timeout
$LOGMSG "Error: Timed outwaiting on CRS to start ASM instance $ORACLE_SID"
exit $COUNT
fi
$LOGMSG "Waiting for Oracle CRS service to start ASM instance$ORACLE_SID"
$LOGMSG "Wait $COUNT."
sleep 60
RNODE=`srvctl status asm -n $NODE | grep "$ORACLE_SID isrunning"`
RC=$
done
else
$LOGMSG "Error: \"${W_ORACLE_SID}\" has dependency on ASMinstance \"${ORACLE_SID}\""
$LOGMSG "Error: Need $ORACLE_HOME/bin/srvctl to check thisdependency"
fi
fi # asm instance
;;
esac
done # innner while
fi
;;
esac
done # outer while

# by now all the ASM instances have come upand we can proceed to bring up
# DB instance with 'W' wait status

cat $ORATAB | while read LINE
do
case $LINE in
\#*) ;; #comment-line in oratab
*)
ORACLE_SID=`echo $LINE | awk -F: '{print $1}' -`
if[ "$ORACLE_SID" = '*' ] ; then
#same as NULL SID - ignore this entry
ORACLE_SID=""
continue
fi
#Proceed only if last field is 'W'.
if[ "`echo $LINE | awk -F: '{print $NF}' -`" = "W" ] ; then
INST="Database instance"
if [ `echo $ORACLE_SID | cut -b 1` = '+' ]; then
$LOGMSG "Error: ${INST} \"${ORACLE_SID}\" NOTstarted"
$LOGMSG "Error: incorrect usage: 'W' not allowed for ASMinstances"
continue
fi
ORACLE_HOME=`echo $LINE | awk -F: '{print $2}' -`
#Called scripts use same home directory
export ORACLE_HOME
#file for logging script's output
LOG=$ORACLE_HOME/startup.log
touch $LOG
chmod a+r $LOG
echo "Processing $INST \"$ORACLE_SID\": log file$ORACLE_HOME/startup.log"
startinst >> $LOG 2>&1
fi
;;
esac
done
gg1:/u01/app/oracle/product/11.2.0.3/db_1/bin>


2.2 dbshut 脚本

gg1:/u01/app/oracle/product/11.2.0.3/db_1/bin>cat dbshut
#!/bin/sh
#
# $Id: dbshut.sh 22-may-2008.05:19:31arogers Exp $
# Copyright (c) 1991, 2008, Oracle. Allrights reserved.
#

###################################
#
# usage: dbshut $ORACLE_HOME
#
# This script is used to shutdown ORACLEfrom /etc/rc(.local).
# It should ONLY be executed as part of thesystem boot procedure.
#
# This script will shutdown all databaseslisted in the oratab file
# whose third field is a "Y" or"W". If the third field is setto "Y" and
# there is no ORACLE_SID for an entry (thefirst field is a *),
# then this script will ignore that entry.
#
# This script requires that ASMORACLE_SID's start with a +, and
# that non-ASM instance ORACLE_SID's do notstart with a +.
#
# Note:
# Use ORACLE_TRACE=T for tracing this script.
# Oracle Net Listener is also shutdownusing this script.
#
# The progress log for each instanceshutdown is logged in file
# $ORACLE_HOME/shutdown.log.
#
# On all UNIX platforms except SOLARIS
# ORATAB=/etc/oratab
#
# To configure, update ORATAB withInstances that need to be shutdown
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME::
# An example entry:
# main:/usr/lib/oracle/emagent_10g:Y
#
#####################################

trap 'exit' 1 2 3
case $ORACLE_TRACE in
T) set-x ;;
esac

# Set path if path not set (if called from/etc/rc)
SAVE_PATH=/bin:/usr/bin:/etc:${PATH} ;export PATH
S