編輯 /etc/oratab
將 *:/oracle/product/9.2.0:N 改成 *:/oracle/product/9.2.0:Y 或者新增 orcl:/oracle/product/9.2.0:Y
其格式為
新增 Shell Script ,加入下列 Command 並且將此檔置於 /etc/init.d/(此為範例,檔名為 ora92):
#!/bin/sh
# description: Oracle auto start-stop script.
# chkconfig: - 90 10
ORA_HOME=/oracle/product/9.2.0
ORA_OWNER=oracle
if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart"
;;
'stop')
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut immediate"
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
;;
esac
接者將此 Script 加入啟動選項
# chkconfig --add ora92
修改開機預設啟動 runlevel
# chkconfig --list ora92
# chkconfig --level 35 ora92 on