Chinaunix首页 | 论坛 | 博客
  • 博客访问: 173971
  • 博文数量: 168
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 10
  • 用 户 组: 普通用户
  • 注册时间: 2016-01-18 19:34
文章分类

全部博文(168)

文章存档

2016年(168)

我的朋友

分类: Oracle

2016-01-18 20:34:42

原文地址: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

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