Oracle 開機自動啟動設置


步驟:

1:查看ORACLE_HOME是否設置

$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/dbhome_1

 

2:執行dbstart 數據庫自帶啟動腳本

[oracle@njdzjkdb ~]$ cd $ORACLE_HOME
[oracle@njdzjkdb dbhome_1]$ cd bin/
[oracle@njdzjkdb bin]$ dbstart
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener Usage: /u01/app/oracle/product/11.2.0/db_1/bin/dbstart ORACLE_HOME
錯誤提示:ORACLE_HOME_LISTNER 沒有設置

[oracle@njdzjkdb bin]$ ll | grep dbs
-rwxr-x---. 1 oracle oinstall 6088 1月 1 2000 dbshut
-rwxr-x---. 1 oracle oinstall 13892 12月 11 16:01 dbstart

編輯 dbstart,將ORACLE_HOME_LISTNER=$1修改成 ORACLE_HOME_LISTNER=$ORACLE_HOME 前提是$ORACLE_HOME環境設置正確

[oracle@njdzjkdb bin]$ vi dbstart 

ORACLE_HOME_LISTNER=/u01/app/oracle/product/11.2.0/dbhome_1

 

3:編輯/etc/oratab文件

dbca建庫時都會自動創建/etc/oratab文件
將orcl:/u01/app/oracle/product/11.2.0/dbhome_1:N
修改成 orcl:/u01/app/oracle/product/11.2.0/dbhome_1:Y

 

4:編輯/etc/rc.d/rc.local啟動文件,添加數據庫啟動腳本dbstart

[root@njdzjkdb ~]# vi /etc/rc.d/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
su oracle -lc "/u01/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start"
su oracle -lc /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbstart

 

5:重啟主機,查看數據庫和監聽是自啟動

 

6:查看數據庫是否處於open狀態

select status from v$instance

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM