Oracle11g在linux系統(tǒng)下開機(jī)自啟動設(shè)置
oracle服務(wù)器一般來說***是手動啟動,這樣碰到問題的話,可以現(xiàn)場解決,但是也擔(dān)心有時候機(jī)器故障,自動重啟后,為了快速恢復(fù)應(yīng)用,需要自動開機(jī)啟動oracle,而且發(fā)現(xiàn)在不同的os下,啟動的設(shè)置都不太一樣
1,centos操作系統(tǒng)下,可以這樣設(shè)置
直接在rc.local里面添加
- <code class="hljs cs">[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</code>
重啟后生效,PS:但是在redhat系統(tǒng)下失效
2,redhat操作系統(tǒng)下面,用dbstart的方式
2.1,測試
- <code class="hljs cs">[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 ~]$
- </code>
有報錯信息,提示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里面設(shè)置開機(jī)自啟動
- <code class="hljs cs"><code class="hljs bash">[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"</code></code>
db服務(wù)器重啟生效。