oracle 10g 数据库集群启停脚本

oracle 10g 数据库集群启停脚本,第1张

/etc/init.d/oracle #!/bin/sh

#

# oraShell -- user start|stop script for oracle

#

LOG_EMERG=0 # system is unusable

LOG_ALERT=1 # action must be taken immediately

LOG_CRIT=2 # critical conditions

LOG_ERR=3 # error conditions

LOG_WARNING=4 # warning conditions

LOG_NOTICE=5 # normal but significant condition

LOG_INFO=6 # informational

LOG_DEBUG=7 # debug-level messages

script_name=`basename $0`

clulog()

{

log_level=$1

log_info=$2

/opt/cluster/bin/clulog -p $$ -n $script_name -s $log_level "$log_info"

}

case $1 in

start)

# start listener

su - oracle -c "lsnrctl start"

retval=$?

if [ $retval -eq 0 ]then

clulog $LOG_INFO "oraShell: lsnrctl start succeeded."

else

clulog $LOG_ERR "oraShell: lsnrctl start failed, ret=$retval."

exit 1

fi

# start oracle

su - oracle -c "sqlplus /nolog" <<EOF

connect / as sysdba

startup

quit

EOF

ps -wwwef | grep ora_pmon | grep -v grep >/dev/null 2>&1

retval=$?

if [ $retval -eq 0 ]then

clulog $LOG_INFO "oraShell: oracle database start succeeded."

else

clulog $LOG_ERR "oraShell: oracle database start failed."

exit 1

fi

stop)

# stop listener

su - oracle -c "lsnrctl stop"

retval=$?

if [ $retval -eq 0 ]then

clulog $LOG_INFO "oraShell: lsnrctl stop succeeded."

else

clulog $LOG_ERR "oraShell: lsnrctl stop failed, ret=$retval."

exit 1

fi

# stop oracle

su - oracle -c "sqlplus /nolog" <<EOF

connect / as sysdba

shutdown immediate

quit

EOF

ps -wwwef | grep ora_pmon | grep -v grep >/dev/null 2>&1

retval=$?

if [ $retval -ne 0 ]then

clulog $LOG_INFO "oraShell: oracle database stop succeeded."

else

clulog $LOG_ERR "oraShell: oracle database stop failed."

exit 1

fi

*)

echo "Usage: $0 {start|stop}"

exit 1

esac

# succeed

exit 0

关闭:

srvctl stop instance -d orcl -i orcl1

srvctl stop instance -d orcl -i orcl2

启动:

srvctl start instance -d orcl -i orcl1

srvctl start instance -d orcl -i orcl2

以上命令假设你的数据库名为orcl,实例名分别为orcl1,orcl2


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/9915570.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-03
下一篇 2023-05-03

发表评论

登录后才能评论

评论列表(0条)

保存