环境说明:VirturlBox 3.1.6 + CentOS 5.4 + Oracle 10gR2 修改dbstartsu - oracle vi $ORACLE_HOME/bin/dbstart #ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle ORACLE_HOME_LISTNER=$ORACLE_HOME 增加启动脚本cd /etc/rc.d/init.d vi oraserver chmod 755 oraserver 写入以下内容#!/bin/bash # chkconfig: 2345 99 01 # description: Oracle10g Server # processname: oraserver # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network RETVAL=0 prog="oraserver" ORACLE_HOME=/app/oracle/product/10.2.0/db_1 if [ ! -f $ORACLE_HOME/bin/dbstart ] then echo "Oracle10g cannot start:Cannot find dbstart..." exit fi start() { echo "Starting Oracle10g Server..." su - oracle -c "$ORACLE_HOME/bin/dbstart" RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog su - oracle -c "$ORACLE_HOME/bin/emctl start dbconsole" return $RETVAL } stop() { su - oracle -c "$ORACLE_HOME/bin/emctl stop dbconsole" echo "Stoping Oracle10g Server..." su - oracle -c "$ORACLE_HOME/bin/dbshut" RETVAL=$? [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog return $RETVAL } restart() { echo "Restart Oracle10g Server" stop start echo } case "$1" in start) start ;; stop) stop ;; restart|reload) stop start RETVAL=$? ;; condrestart) if [ -f /var/lock/subsys/$prog ]; then stop start RETVAL=$? fi ;; status) status $prog RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" exit 2 esac exit $RETVAL 添加服务chkconfig --add oraserver 可使用如下命令查看新增的服务chkconfig --list oraserver find /etc/rc.d -name '*oraserver' -print