ORA-12547:TNS:lostcontact错误处理(三)

2015-02-02 23:08:43 · 作者: · 浏览: 30
'Y'. if [ "`echo $LINE | awk -F: '{print $NF}' -`" = "Y" ] ; then # If ASM instances if [ `echo $ORACLE_SID | cut -b 1` = '+' ]; then INST="ASM instance" 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" startasminst >> $LOG 2>&1 fi fi ;; esac done # exit if there was any trouble bringing up ASM instance[s] if [ "$?" != "0" ] ; then exit 2 fi # # Following loop brings up 'Database instances' # 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 'Y'. if [ "`echo $LINE | awk -F: '{print $NF}' -`" = "Y" ] ; then # If non-ASM instances if [ `echo $ORACLE_SID | cut -b 1` != '+' ]; then INST="Database instance" 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 fi ;; esac done # # Following loop brings up 'Database instances' that have wait state 'W' # 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 W_ORACLE_SID=`echo $LINE | awk -F: '{print $1}' -` # DB instances with 'W' (wait state) have a dependency on ASM instances via CRS. # Wait here for 'all' ASM instances to become available. 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 if [ `echo $ORACLE_SID | cut -b 1` = '+' ]; then INST="ASM instance" ORACLE_HOME=`echo $LINE | awk -F: '{print $2}' -` if [ -x $ORACLE_HOME/bin/sr
vc
tl ] ; then COUNT=0 NODE=`olsnodes -l` RNODE=`srvctl status asm -n $NODE | grep "$ORACLE_SID is running"` RC=$? while [ "$RC" != "0" ]; # wait until this comes up! do COUNT=$((COUNT+1)) if [ $COUNT = 5 ] ; then # 5 tries with 60 sec interval => 5 minutes timeout $LOGMSG "Error: Timed out waiting 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 is running"` RC=$? done else $LOGMSG "Error: \"${W_ORACLE_SID}\" has dependency on ASM instance \"${ORACLE_SID}\"" $LOGMSG "Error: Need $ORACLE_HOME/bin/srvctl to check this dependency" fi fi # asm instance ;; esac done # innner while fi ;; esac done # outer while # by now all the ASM instances have come up and 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 '