Oracle 開機自動啓動設置

有時候會例行進行防火牆及機器斷電應急演練,有些數據庫沒有設置自動開機啓動,帶來麻煩。

步驟:

1:查看ORACLE_HOME是否設置

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

3:編輯/etc/oratab文件

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

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

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

[oracle@oracle10g bin]$ dbstart
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /u01/app/oracle/product/10.2.0/db_1/bin/dbstart ORACLE_HOME
錯誤提示:ORACLE_HOME_LISTNER 沒有設置
[oracle@oracle10g bin]$ cd /u01/app/oracle/product/10.2.0/db_1/bin/
[oracle@oracle10g bin]$ ll | grep dbs
-rwxr-x--- 1 oracle oinstall      6582 Jan  1  2000 dbshut
-rwxr-x--- 1 oracle oinstall     14088 Jan  1  2000 dbstart
編輯 dbstart,將ORACLE_HOME_LISTNER=$1修改成
ORACLE_HOME_LISTNER=$ORACLE_HOME
前提是$ORACLE_HOME環境設置正確

編輯oratab

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

添加啓動腳本:

編輯/etc/rc.d/rc.local啓動文件,添加數據庫啓動腳本dbstart
該文件必須使用root用戶編輯
[root@oracle10g ~]# vi  /etc/rc.d/rc.local
[root@oracle10g ~]# cat /etc/rc.d/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 /u01/app/oracle/product/10.2.0/db_1/bin/dbstart
su - oracle -lc "/u01/app/oracle/product/10.2.0/db_1/bin/lsnrctl start"
發佈了75 篇原創文章 · 獲贊 15 · 訪問量 14萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章