oracle开机启动脚本,加入/etc/init.d,并使用chkconfig命令设置开机启动
- #!/bin/bash
- #
- # chkconfig: 2345 80 05
- # description: Oracle 10g Server
- #
- # Run-level Startup script for the Oracle Instance, Listener, and
- # Web Interface
- export ORACLE_BASE=/export/dbhome/oracle
- export ORACLE_HOME=$ORACLE_BASE/10gr2
- export ORACLE_SID=bgiora01
- export PATH=$PATH:$ORACLE_HOME/bin
- ORA_OWNR=”oracle”
- # if the executables do not exist — display error
- if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
- then
- echo “Oracle startup: cannot start”
- exit 1
- fi
- # depending on parameter — startup, shutdown, restart
- # of the instance and listener or usage display
- case “$1″ in
- start)
- # Oracle listener and instance startup
- echo -n “Starting Oracle: “
- # su $ORA_OWNR -c “$ORACLE_HOME/bin/lsnrctl start”
- su $ORA_OWNR -c $ORACLE_HOME/bin/dbstart
- touch /var/lock/oracle
- su $ORA_OWNR -c “$ORACLE_HOME/bin/emctl start dbconsole”
- su $ORA_OWNR -c “$ORACLE_HOME/bin/isqlplusctl start”
- echo “OK”
- ;;
- stop)
- # Oracle listener and instance shutdown
- echo -n “Shutdown Oracle: “
- # su $ORA_OWNR -c “$ORACLE_HOME/bin/lsnrctl stop”
- su $ORA_OWNR -c $ORACLE_HOME/bin/dbshut
- rm -f /var/lock/oracle
- su $ORA_OWNR -c “$ORACLE_HOME/bin/emctl stop dbconsole”
- su $ORA_OWNR -c “$ORACLE_HOME/bin/isqlplusctl stop”
- echo “OK”
- ;;
- reload|restart)
- $0 stop
- $0 start
- ;;
- *)
- echo “Usage: `basename $0` start|stop|restart|reload”
- exit 1
- esac
- exit 0
转载于:https://blog.51cto.com/itianjing/1017752