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

2015-02-02 23:08:43 · 作者: · 浏览: 33
_HOME_LISTNER/bin/lsnrctl version | grep "LSNRCTL for " | cut -d' ' -f5 | cut -d'.' -f1` export VER10LIST else echo "Failed to auto-start Oracle Net Listener using $ORACLE_HOME_LISTNER/bin/tnslsnr" fi fi # Set this in accordance with the platform ORATAB=/etc/oratab if [ ! $ORATAB ] ; then echo "$ORATAB not found" exit 1; fi # Checks Version Mismatch between Listener and Database Instance. # A version 10 listener is required for an Oracle Database 10g database. # Previous versions of the listener are not supported for use with an Oracle # Database 10g database. However, it is possible to use a version 10 listener # with previous versions of the Oracle database. checkversionmismatch() { if [ $VER10LIST ] ; then VER10INST=`sqlplus -V | grep "Release " | cut -d' ' -f3 | cut -d'.' -f1` if [ $VER10LIST -lt $VER10INST ] ; then $LOGMSG "Listener version $VER10LIST NOT supported with Database version $VER10INST" $LOGMSG "Restart Oracle Net Listener using an alternate ORACLE_HOME_LISTNER:" $LOGMSG "lsnrctl start" fi fi } # Starts a Database Instance startinst() { # Called programs use same database ID export ORACLE_SID # Put $ORACLE_HOME/bin into PATH and export. PATH=$ORACLE_HOME/bin:${SAVE_PATH} ; export PATH # add for bug # 652997 LD_LIBRARY_PATH=${ORACLE_HOME}/lib:${SAVE_LLP} ; export LD_LIBRARY_PATH PFILE=${ORACLE_HOME}/dbs/init${ORACLE_SID}.ora SPFILE=${ORACLE_HOME}/dbs/spfile${ORACLE_SID}.ora SPFILE1=${ORACLE_HOME}/dbs/spfile.ora echo "" echo "$0: Starting up database \"$ORACLE_SID\"" date echo "" checkversionmismatch # See if it is a V6 or V7 database VERSION=undef if [ -f $ORACLE_HOME/bin/sqldba ] ; then SQLDBA=sqldba VERSION=`$ORACLE_HOME/bin/sqldba command=exit | awk ' /SQL\*DBA: (Release|Version)/ {split($3, V, ".") ; print V[1]}'` case $VERSION in "6") ;; *) VERSION="internal" ;; esac else if [ -f $ORACLE_HOME/bin/svrmgrl ] ; then SQLDBA=svrmgrl VERSION="internal" else SQLDBA="sqlplus /nolog" fi fi STATUS=1 if [ -f $ORACLE_HOME/dbs/sgadef${ORACLE_SID}.dbf ] ; then STATUS="-1" fi if [ -f $ORACLE_HOME/dbs/sgadef${ORACLE_SID}.ora ] ; then STATUS="-1" fi pmon=`ps -ef | grep -w "ora_pmon_$ORACLE_SID" | grep -v grep` if [ "$pmon" != "" ] ; then STATUS="-1" $LOGMSG "Warning: ${INST} \"${ORACLE_SID}\" already started." fi if [ $STATUS -eq -1 ] ; then $LOGMSG "Warning: ${INST} \"${ORACLE_SID}\" possibly left running when system went down (system crash?)." $LOGMSG "Action: Notify Database Administrator." case $VERSION in "6") sqldba "command=shutdown abort" ;; "internal") $SQLDBA $args <
5 minutes timeout $LOGMSG "Timed out waiting to start ASM instance $ORACLE_SID" $LOGMSG " CSS service is NOT available." exit $COUNT fi $LOGMSG "Waiting for Oracle CSS service to be available before starting " $LOGMSG " ASM instance $ORACLE_SID. Wait $COUNT." sleep 20 $ORACLE_HOME/bin/crsctl check css RC=$? done fi startinst } # Start of dbstartup script # # Loop for every entry in oratab file and and try to start # that ORACLE. # # ASM instances need to be started before 'Database instances' # ASM instance is identified with '+' prefix in ORACLE_SID # Following loop brings up ASM instance[s] 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