# Oracle database in ORA_HOME.
ORA_HOME=/home/oracle/OraHome_1
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/dbstart
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
;;
'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/lsnrctl stop"
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
;;
'restart')
$0 stop
$0 start
;;
esac
赋予执行权限
chown root.root /etc/rc.d/init.d/dbora
chmod 750 /etc/init.d/dbora
Initialize new service:
chkconfig dbora reset
chkconfig --list dbora
dbora 0:off 1:off 2:off 3:on 4:off 5:on 6:off
注意:当系统不在 runlevels 3 and 5时,使用
service dbora start 启动服务
service dbora stop 停止服务.
作成以下链接:
ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora
ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora
执行以下命令:
chkconfig --level 345 dbora on
2.vi $ORACLE_HOME/bin/dbstart
# Set this to bring up Oracle Net Listener
ORACLE_HOME_LISTNER=$ORACLE_HOME
如果没有ASM(自动存储),就把那一节内容删除,ASM要在加载实例前,先加载.
3.重新启动计算机 ,就可以了,启动会比较慢,因为要自动启动em,database,listener,agent
这样就OK了。下次开关机的时候,Oracle也会随之启动/停止。