手机版
你好,游客 登录 注册
背景:
阅读新闻

Oracle 11g在Linux系统下开机自启动设置

[日期:2015-10-27] 来源:Linux社区  作者:mchdba [字体: ]

Oracle服务器一般来说最好是手动启动,这样碰到问题的话,可以现场解决,但是也担心有时候机器故障,自动重启后,为了快速恢复应用,需要自动开机启动Oracle,而且发现在不同的os下,启动的设置都不太一样

1,CentOS操作系统下,可以这样设置
直接在rc.local里面添加

[root@localhost ~]# vim /etc/rc.local
touch /var/lock/subsys/local
su - oracle < lsnrctl start
sqlplus / as sysdba
startup
quit
EOF
su - oracle < export ORACLE_SID=pddev1
sqlplus / as sysdba
startup
quit
EOF

重启后生效,PS:但是在RedHat系统下失效

2,redhat操作系统下面,用dbstart的方式
2.1,测试
[oracle@localhost ~]$ /oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart ORACLE_HOME
[oracle@localhost ~]$
有报错信息,提示ORACLE_HOME不识别,如下解决方案,修改dbstart和dbstut,有的版本dbstut找不到不存在,可以忽略。
vim /oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart
vim /oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstut


ORACLE_HOME_LISTNER =$1

改成
ORACLE_HOME_LISTNER=$ORACLE_HOME

2.2,[root@localhost ~]# vim /etc/oratab
powerdes:/oracle/app/oracle/product/11.2.0/dbhome_1:Y

2.3 在rc.local里面设置开机自启动
[root@localhost bin]# vim /etc/rc.local

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
su - oracle -lc "/oracle/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start"
su - oracle -c "/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart"db"

服务器重启生效。

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

本文永久更新链接地址http://www.linuxidc.com/Linux/2015-10/124587.htm

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款