非 RAC/ASM 環境(RAC 由 Clusterware 管理)。適用 Oracle 9iR2+。
/etc/oratab,將實例重啟旗標設為 Y:
ORCL:/u01/app/oracle/product/11.2.0:Y
/etc/init.d/dbora(需 root 權限):
#!/bin/sh
# chkconfig: 345 99 10
# description: Oracle auto start-stop script
ORA_HOME=/u01/app/oracle/product/11.2.0
ORA_OWNER=oracle
if [ ! -f $ORA_HOME/bin/dbstart ]; then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start')
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart"
;;
'stop')
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut"
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
;;
esac
chmod +x /etc/init.d/dbora
chkconfig --add dbora
chkconfig dbora on
dbstart/dbshut 讀取 /etc/oratab 中旗標為 Y 的實例su - oracle 確保環境變數正確載入