linux开机启动oracle
第一步:新建?/etc/init.d/oralce?文件(文件名就是服务名)。文件里的内容如下:
#!/bin/sh# Comments to support chkconfig on RedHat Linux# chkconfig: 2345 64 36# description: oracle database engine.# Comments to support LSB init script conventions### BEGIN INIT INFO# Provides: oracle# Required-Start: $local_fs $network $remote_fs# Should-Start: ypbind nscd ldap ntpd xntpd# Required-Stop: $local_fs $network $remote_fs# Default-Start: 2 3 4 5# Default-Stop: 0 1 6# Short-Description: start and stop oracle# Description: oracle database engine.### END INIT INFO # source function library.. /etc/rc.d/init.d/functionsNAME=oracleDESC="$NAME daemon"if [ -z "$ORACLE_HOME" ]; thensource /home/oracle/.bash_profilefido_start() {if [ "$USER" = "oracle" ]; thendbstart $ORACLE_HOME || echo -n "$NAME already running"elsesu oracle -c "dbstart $ORACLE_HOME" || echo -n "$NAME already running"fi}do_stop() {if [ "$USER" = "oracle" ]; thendbshut $ORACLE_HOME || echo -n "$NAME not running"elsesu oracle -c "dbshut $ORACLE_HOME" || echo -n "$NAME not running"fi}case "$1" instart) echo -n "Starting $DESC: $NAME"do_startecho ".";;stop)echo -n "Stopping $DESC: $NAME"do_stopecho ".";;restart)echo -n "Restarting $DESC: $NAME"do_stopdo_startecho ".";;*)echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2exit 3;;esacexit 0
?第二步:设置开机启动,在终端执行以下命令:
?
chkconfig --add oraclechkconfig oracle on
?
service oracle start
?
service oracle stop
?如果要关闭开机启动,在终端执行以下命令:
chkconfig oracle off
?