雙擊熱備搭建過程中,oratab缺失可能導致無法啓動 (手動可以啓動)
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.
# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
hyjzw:/opt/oracle/oracle:N
在這個註釋裏面,對這個文件講的比較清楚。/etc/oratab 由root.sh 腳本創建,在用DBCA 創建實例時也會更新這個文件。
當$ORACLE_SID:$ORACLE_HOME:<N|Y> 設置爲Y時,允許實例自啓動,當設置爲N時,則不允許自啓動。 這個文件裏的配置僅僅起一個開關的作用,其並不會具體的執行啓動和關閉,具體的操作由$ORACLE_HOME/bin/dbstart和dbshut 腳本來實現。 這2個腳本在執行時會檢查/etc/oratab 文件裏的配置,爲Y時才能繼續執行。
所以配置數據庫自啓動和關閉的步驟如下:
(1) 配置/etc/oratab
(2) 修改$ORACLE_HOME/bin/dbstart和dbshut,並將其添加到/etc/rc(.local) 文件中。
這裏是使用oracle 自帶的dbstart 和dbshut腳本,如果使用自己寫的腳本來啓動或關閉DB 就不需要關心這個文件的設置了。