linux下單例項資料庫開機自啟動設定

wangyiou1988發表於2015-09-11
1、修改/oratab

root@org54 ~]# vi/etc/oratab --把N改為Y,如下提示

# This file is used by ORACLEutilities. It is created by root.sh

# and updated by the Database ConfigurationAssistant when creating

# a database.

# A colon, ':', is used as the fieldterminator. A new line terminates

# the entry. Lines beginning with a pound sign, '#', arecomments.

#

# Entries are of the form:

# $ORACLE_SID:$ORACLE_HOME:<N|Y>:

#

# The first and second fields are thesystem identifier and home

# directory of the databaserespectively. The third filed indicates

# to the dbstart utility that the databaseshould , "Y", or should not,

# "N", be brought up at systemboot time.

#

# Multiple entries with the same$ORACLE_SID are not allowed.

#

#

#game:/u01/app/oracle/product/10.2.0/db_1:N --dbca建立庫時註冊的預設資訊

--格式:$ORACLE_SID:$ORACLE_HOME:<N|Y>

--<N|Y>選項代表開機是否自啟動

instance_name:/u01/app/oracle/product/10.2.0/db_1:Y



2.編輯/dbstart
 

[oracle@org54 bin]$ cd$ORACLE_HOME/bin

[oracle@org54 bin]$ ls-ll |grep dbstart

-rwxr-xr-x 1 oracle oinstall 10415 Jan 1 2000 dbstart

[oracle@org54 bin]$ vi dbstart

--dbstart為開機自啟動指令碼,讓系統開機就去執行dbstart指令碼檔案,它會去讀oratab檔案,讀到Y就會把對應的例項開機自啟動

找到並修改ORACLE_HOME_LISTNER=$ORACLE_HOME根據設定的監聽調整路徑

3.編輯/rc.d/rc.local

[root@org54 ~]# vi/etc/rc.d/rc.local --新增如下兩行資訊,啟動例項、啟動監聽

#!/bin/sh

#

# This script will be executed *after* allthe other init scripts.

# You can put your own initialization stuffin here if you don't

# want to do the full Sys V style initstuff.

touch /var/lock/subsys/local

modprobe hangcheck-timer hangcheck_tick=30hangcheck_margin=180

su - oracle  -c " /u01/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start"

su - oracle  -c " /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbstart"

4.重啟驗證一下
 
 #reboot

小結:

linux下設定例項自啟動有關指令碼:

oratab:例項是否自啟動的註冊資訊

dbstart:開機啟動指令碼檔案會讀取oratab資訊

rc.local:開機後立即要做的檔案


 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25116248/viewspace-1797173/,如需轉載,請註明出處,否則將追究法律責任。

相關文章