#!/bin/sh ### BEGIN INIT INFO # Provides: oracle # Required-Start: $local_fs # Required-Stop: $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description:oracle database init script # Description: starts and stops oracle database and listeners ### END INIT INFO set -e ORACLE_HOME="/var/oracle/product/10.2.0/db_1" ORACLE_OWNER="oracle" do_start() { echo "starting oracle databases..." su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME" >> /var/log/oracle touch /var/lock/oracle echo "ok" } do_stop() { echo "Stopping oracle databases..." su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME" >> /var/log/oracle rm -f /var/lock/oracle echo "ok" } status() { if [ -f /var/lock/oracle ]; then echo "oracle database is running." else echo "oracle database is not running." fi } case "$1" in start) do_start ;; stop) do_stop ;; restart) do_stop do_start ;; reload) ;; force-reload) ;; status) status ;; *) echo "$0 {start|stop|restart|reload|force-reload|status}" esac exit 0
编辑/etc/init.d/rc.local
增加/etc/init.d/oracle start