1、vi /etc/oratab
orcl:/u01/oracle/product/11.2.0/db_home:Y
2、vi $ORACLE/bin/dbstart $ORACLE/bin/dbshut
将ORACLE_HOME_LISTNER=$1改为ORACLE_HOME_LISTNER=$ORACLE_HOME
3、vi /etc/rc.d/init.d/oracl
#!/bin/bash# oracle: Start/Stop Oracle Database 11g R2## chkconfig: 345 90 10# description: The Oracle Database is an Object-Relational Database Management System.## processname: oracle. /etc/rc.d/init.d/functionsLOCKFILE=/var/lock/oracleORACLE_HOME=/u01/oracle/product/11.2.0/db_home/ORACLE_USER=oraclecase "$1" in'start')if [ -f $LOCKFILE ]; thenecho $0 already running.exit 1fiecho -n $"Starting Oracle Database:"su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start"su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl start dbconsole"touch $LOCKFILE;;'stop')if [ ! -f $LOCKFILE ]; thenecho $0 already stopping.exit 1fiecho -n $"Stopping Oracle Database:"su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut"su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole"rm -f $LOCKFILE;;'restart')$0 stop$0 start;;'status')if [ -f $LOCKFILE ]; thenecho $0 started.elseecho $0 stopped.fi;;*)echo "Usage: $0 [start|stop|status]"exit 1esacexit 0
4、设置为系统服务
chmod 755 /etc/rc.d/init.d/oraclechkconfig --add oraclechkconfig oracle on