Welcome 微信登录
编程资源 图片资源库 蚂蚁家优选

首页 / 数据库 / MySQL / Debian 6 设置Oracle 11g R2开机自动启动

Debian 6 设置Oracle 11g R2开机自动启动以root帐户登录。第一步:修改  /etc/orataborcl:/home/oracle/oracle/product/11.2.0/db_1:Y其中orcl: 是 sid/home/oracle/oracle/product/11.2.0/db_1:是db_homeY: 是指开机启动Y(yes) or N(no);默认是N的,改成Y。第二步: /etc/init.d 目录下新建一个名为 oracle 的文件#!/bin/bash
#
# Run-level Startup script for the Oracle Instance and Listener
#
# chkconfig: 345 91 19
# description: Startup/Shutdown Oracle listener and instance
ORA_HOME="/home/oracle/oracle/product/11.2.0/db_1"
ORA_OWNR="oracle"
# if the executables do not exist -- display error
if [ ! -f $ORA_HOME/bin/dbstart -o ! -d $ORA_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi
# depending on parameter -- startup, shutdown, restart
# of the instance and listener or usage display
case "$1" in
start)
# Oracle listener and instance startup
echo -n "Starting Oracle: "
su - $ORA_OWNR -c "$ORA_HOME/bin/dbstart $ORA_HOME"
su - $ORA_OWNR -c "$ORA_HOME/bin/lsnrctl start"
#Optional : for Enterprise Manager software only
su - $ORA_OWNR -c "$ORA_HOME/bin/emctl start dbconsole"
touch /var/lock/oracle
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
#Optional : for Enterprise Manager software only
su - $ORA_OWNR -c "$ORA_HOME/bin/emctl stop dbconsole"
su - $ORA_OWNR -c "$ORA_HOME/bin/lsnrctl stop"
su - $ORA_OWNR -c "$ORA_HOME/bin/dbshut $ORA_HOME"
rm -f /var/lock/oracle
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 start|stop|restart|reload"
exit 1
esac
exit 0注意修改oracle home的目录,此处为/home/oracle/oracle/product/11.2.0/db_1并更改文件权限:chmod 755 /etc/init.d/oracle第三步:让oracle文件在系统启动时调用update-rc.d oracle defaults 99 01执行这一步时,系统提示了一个警告:insserv: warning: script "oracle" missing LSB tags and overrides先重启了一下,执行lsnrctl status ,发现实例已启动,打开Toad嘎嘎两声,连接OK。就暂时没有理会这些错误了。Oracle 10g行变列 (decode的用法)史上最好的Oracle体系架构浅析相关资讯      Debian 6  Oracle 11g R2  Oracle 11g R2开机自动启动 
  • Debian 6 LTS 将于2月29号结束支持  (02月14日)
  • Oracle Linux 5.5 (64bit)安装  (12/04/2015 08:46:12)
  • 在Red Hat Enterprise Linux 7.0   (01/05/2015 07:56:38)
  • CentOS 5.10安装Oracle 11G R2  (01月22日)
  • Oracle Linux 6.4安装Oracle 11g   (12/04/2015 08:30:35)
  • Oracle 11g R2(GI)启动过程  (10/10/2014 17:31:49)
本文评论 查看全部评论 (0)
表情: 姓名: 字数