AIX下自動啟動/停止Oracle資料庫1:修改/etc/oratab,將“N”改為“Y”,使之支援開機啟動。$ vi /etc/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.
#
#
orcl:/home/oracle/product/10.2.0:Y2.建立指令碼並賦予相關許可權 2.1建立啟動指令碼1)、在/home/oracle目錄下,建立start_db.sh //此路徑非特定
$ su - oracle
$ vi start_db.sh#!/bin/sh
ORACLE_HOME=/home/oracle/product/10.2.0
ORACLE_BASE=/home/oracle
ORACLE_SID=orcl
PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/oracle/bin:/usr/bin/X11:/sbin:/home/oracle/product/10.2.0/bin:.
export ORACLE_HOME ;
export ORACLE_BASE ;
export ORACLE_SID ;
export PATH ;
echo "######################################################"
echo "# Starting the Listener #"
echo "######################################################"
lsnrctl start
echo ""
echo ""
echo ""
echo "#####################################################"
echo "# Starting the instance :$ORACLE_SID #"
echo "#####################################################"
sqlplus /nolog << EOF
connect / as sysdba
startup
exit
EOF 2)、在/etc下建立檔案rc.startdb
# vi /etc/rc.startdb //以root使用者進行建立,避免報錯
su - oracle "-c /home/oracle/dbstart.sh" #startOracleDB3)、給檔案執行許可權# chmod 777 rc.startdb 4)、添加自啟動任務至/etc/inittab$vi /etc/inittabstartdb:2:wait:/etc/rc.startdb>/home/oracle/oracle.log 2>&1註:也可以用命令 mkitab 添加 關於inittab檔案相見我部落格內的介紹2.2建立關閉指令碼# vi /etc/rc.shutdown
echo "Stop Oracle instance: orcl"
su - oracle -c dbshut
註:以上兩個指令碼均經過實際操作!
關於為什麼指令碼叫/etc/rc.shutdown,以及怎麼工作.如下註解
引用
系統管理員可以在 /etc/rc.shutdown shell 指令碼中放置本地定製的關閉過程。如果該指令碼存在,則在關閉開始時就運行。如果指令碼運行但是失敗(返回非零返回碼),則關機停止。