Linux下oracle开机自动启动与oratab、dbstart脚本说明1


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 ‘
/\*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}\” alreadystarted.”
fi

if[ $STATUS -eq -1 ] ; then
$LOGMSG “Warning: ${INST} \”${ORACLE_SID}\” possibly leftrunning when system went down (system crash?).”
$LOGMSG “Action: Notify Database Administrator.”
case $VERSION in
“6”) sqldba”command=shutdown abort” ;;
“internal”) $SQLDBA$args connect internal
shutdown abort
EOF
;;
*) $SQLDBA $args connect / as sysdba
shutdown abort
quit
EOF
;;
esac

if [ $? -eq 0 ] ; then
STATUS=1
else
$LOGMSG “Error: ${INST} \”${ORACLE_SID}\” NOTstarted.”
fi
fi

if[ $STATUS -eq 1 ] ; then
if [ -e $SPFILE -o -e $SPFILE1 -o -e $PFILE ] ; then
case $VERSION in
“6”) sqldbacommand=startup ;;
“internal”) $SQLDBAconnect internal
startup
EOF
;;
*) $SQLDBA connect / as sysdba
startup
quit
EOF
;;
esac

if [ $? -eq 0 ] ; then
echo “”
echo “$0: ${INST}\”${ORACLE_SID}\” warm started.”
else
$LOGMSG “”
$LOGMSG “Error: ${INST} \”${ORACLE_SID}\” NOTstarted.”
fi
else
$LOGMSG “”
$LOGMSG “No init file found for ${INST}\”${ORACLE_SID}\”.”
$LOGMSG “Error: ${INST} \”${ORACLE_SID}\” NOTstarted.”
fi
fi
}

# Starts an ASM Instance
startasminst() {
#Called programs use same database ID
export ORACLE_SID
ORACLE_HOME=`echo $LINE | awk -F: ‘{print $2}' -`
#Called scripts use same home directory
export ORACLE_HOME

#For ASM instances, we have a dependency on the CSS service.
#Wait here for it to become available before instance startup.

#Is the 10g install intact? Are all necessary binaries present?
if[ ! -x $ORACLE_HOME/bin/crsctl ]; then
$LOGMSG “$ORACLE_HOME/bin/crsctl not found when attempting tostart”
$LOGMSG ” ASM instance$ORACLE_SID.”

else
COUNT=0
$ORACLE_HOME/bin/crsctl check css
RC=$?
while [ “$RC” != “0” ];
do
COUNT=`expr $COUNT + 1`
if [ $COUNT = 15 ] ; then
# 15 tries with 20 sec interval => 5 minutes timeout
$LOGMSG “Timed out waiting to start ASM instance$ORACLE_SID”
$LOGMSG ” CSS service is NOTavailable.”
exit $COUNT
fi
$LOGMSG “Waiting for Oracle CSS service to be available beforestarting ”
$LOGMSG ” ASM instance $ORACLE_SID. Wait $COUNT.”
sleep 20
$ORACLE_HOME/bin/crsctl check css
RC=$?
done
fi
startinst
}

声明: 除非转自他站(如有侵权,请联系处理)外,本文采用 BY-NC-SA 协议进行授权 | 智乐兔
转载请注明:转自《Linux下oracle开机自动启动与oratab、dbstart脚本说明1
本文地址:https://www.zhiletu.com/archives-447.html
关注公众号:智乐兔

赞赏

wechat pay微信赞赏alipay pay支付宝赞赏

上一篇
下一篇

相关文章

在线留言

你必须 登录后 才能留言!

在线客服
在线客服 X

售前: 点击这里给我发消息
售后: 点击这里给我发消息

智乐兔官微