阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Oracle启动脚本及开机自启动设置

251次阅读
没有评论

共计 2943 个字符,预计需要花费 8 分钟才能阅读完成。

将以下内容添加到 /etc/init.d/Oracle 中并添加可执行权限,chkconfig –add oracle 添加到服务启动列表,chkconfig oracle on 设置成开机启动

#!/bin/sh
# chkconfig: 35 80 10
# description: Oracle auto start-stop script.

#
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.
ORA_HOME=/oracle/11.2.0
ORA_OWNER=oracle
if [! -f $ORA_HOME/bin/dbstart]
then
    echo “Oracle startup: cannot start”
    exit
fi
case “$1” in
‘start’)
# Start the Oracle databases:
echo “Starting Oracle Databases … “
echo “————————————————-” >> /var/log/oracle
date +” %T %a %D : Starting Oracle Databases as part of system up.” >> /var/log/oracle
echo “————————————————-” >> /var/log/oracle
su – $ORA_OWNER -c “$ORA_HOME/bin/dbstart” >>/var/log/oracle
echo “Done”

# Start the Listener:
echo “Starting Oracle Listeners … “
echo “————————————————-” >> /var/log/oracle
date +” %T %a %D : Starting Oracle Listeners as part of system up.” >> /var/log/oracle
echo “————————————————-” >> /var/log/oracle
su – $ORA_OWNER -c “$ORA_HOME/bin/lsnrctl start” >>/var/log/oracle
echo “Done.”
echo “————————————————-” >> /var/log/oracle
date +” %T %a %D : Finished.” >> /var/log/oracle
echo “————————————————-” >> /var/log/oracle
touch /var/lock/subsys/oracle
;;

‘stop’)
# Stop the Oracle Listener:
echo “Stoping Oracle Listeners … “
echo “————————————————-” >> /var/log/oracle
date +” %T %a %D : Starting Oracle Listeners as part of system up.” >> /var/log/oracle
echo “————————————————-” >> /var/log/oracle
su – $ORA_OWNER -c “$ORA_HOME/bin/lsnrctl start” >>/var/log/oracle
echo “Done.”
echo “————————————————-” >> /var/log/oracle
date +” %T %a %D : Finished.” >> /var/log/oracle
echo “————————————————-” >> /var/log/oracle
touch /var/lock/subsys/oracle
;;

‘stop’)
# Stop the Oracle Listener:
echo “Stoping Oracle Listeners … “
echo “————————————————-” >> /var/log/oracle
date +” %T %a %D : Stoping Oracle Listener as part of system down.” >> /var/log/oracle
echo “————————————————-” >> /var/log/oracle
su – $ORA_OWNER -c “$ORA_HOME/bin/lsnrctl stop” >>/var/log/oracle
echo “Done.”
rm -f /var/lock/subsys/oracle

# Stop the Oracle Database:
echo “Stoping Oracle Databases … “
echo “————————————————-” >> /var/log/oracle
date +” %T %a %D : Stoping Oracle Databases as part of system down.” >> /var/log/oracle
echo “————————————————-” >> /var/log/oracle
su – $ORA_OWNER -c “$ORA_HOME/bin/dbshut” >>/var/log/oracle
echo “Done.”
echo “”
echo “————————————————-” >> /var/log/oracle
date +” %T %a %D : Finished.” >> /var/log/oracle
echo “————————————————-” >> /var/log/oracle
;;

‘restart’)
$0 stop
$0 start
;;
esac

更多 Oracle 相关信息见 Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2017-01/139998.htm

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计2943字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中