Chinaunix首页 | 论坛 | 博客
  • 博客访问: 169634
  • 博文数量: 134
  • 博客积分: 1215
  • 博客等级: 少尉
  • 技术积分: 564
  • 用 户 组: 普通用户
  • 注册时间: 2012-04-20 11:04
文章分类

全部博文(134)

文章存档

2017年(88)

2012年(46)

我的朋友

分类: Oracle

2017-04-14 10:28:14

原文地址:oracle自启动脚本 作者:鸟哥のlinux

设置oracle自动启动与关闭

做一个启动脚本 /etc/init.d/oracle,如下所示:
#!/bin/sh
# description: Oracle auto start-stop script.
  

# chkconfig: - 20 80
#
# 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/product/10.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:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
;;
'stop')
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
;;
'restart')
$0 stop
$0 start
;;
esac


赋予执行权限
chmod 750 /etc/init.d/oracle
作成以下链接:
ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora
ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora
执行以下命令:
chkconfig --level 345 oracle on

阅读(1016) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~