oracle服务器一般来说最好是手动启动,这样碰到问题的话,可以现场解决,但是也担心有时候机器故障,自动重启后,为了快速恢复应用,需要自动开机启动oracle,而且发现在不同的os下,启动的设置都不太一样
1,centos操作系统下,可以这样设置直接在rc.local里面添加
[root@localhost ~]# vim /etc/rc.local touch /var/lock/subsys/localsu - oracle < lsnrctl startsqlplus / as sysdbastartupquitEOFsu - oracle < export ORACLE_SID=pddev1sqlplus / as sysdbastartupquitEOF重启后生效,PS:但是在redhat系统下失效
2,redhat操作系统下面,用dbstart的方式 2.1,测试 [oracle@localhost ~]$ /oracle/app/oracle/product/11.2.0/dbhome_1/fzdlc/dbstartORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net ListenerUsage: /oracle/app/oracle/product/11.2.0/dbhome_1/fzdlc/dbstart ORACLE_HOME[oracle@localhost ~]$有报错信息,提示ORACLE_HOME不识别,如下解决方案,修改dbstart和dbstut,有的版本dbstut找不到不存在,可以忽略。
vim /oracle/app/oracle/product/11.2.0/dbhome_1/fzdlc/dbstart
vim /oracle/app/oracle/product/11.2.0/dbhome_1/fzdlc/dbstut
将
ORACLE_HOME_LISTNER =$1
改成
ORACLE_HOME_LISTNER=$ORACLE_HOME
powerdes:/oracle/app/oracle/product/11.2.0/dbhome_1:Y
2.3 在rc.local里面设置开机自启动 [root@localhost fzdlc]# vim /etc/rc.local #!/fzdlc/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/localsu - oracle -lc "/oracle/app/oracle/product/11.2.0/dbhome_1/fzdlc/lsnrctl start"su - oracle -c "/oracle/app/oracle/product/11.2.0/dbhome_1/fzdlc/dbstart"db服务器重启生效。