#!/bin/bash # # Run-level Startup script Oracle Instance und Listener # # ### BEGIN INIT INFO # Provides: Oracle DB Start # Required-Start: # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: start and stop Oracle DB # Description: Start, stop and save Oracle DB ### END INIT INFO # # install # create file /etc/init.d/oracle # rights # chmod 777 /etc/init.d/oracle # add # chkconfig --add oracle # check # chkconfig | grep oracle ############################### # edit the oracle home and user ORACLE_HOME="/u01/app/oracle/product/10.2.0.5/dbhome_1" ORACLE_USER="oracle" ORACLE_HOME_LISTNER=$ORACLE_HOME ############################# #dbstart exists? if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ] then echo "Oracle startup: cannot start" exit 1 fi ############################# # Datenbank starten oder stoppen case "$1" in start) # Oracle listener and instance startup echo -n "Starting Oracle: " su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME_LISTNER" touch /var/lock/subsys/oracle echo "OK" ;; stop) # Oracle listener and instance shutdown echo -n "Shutdown Oracle: " su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME_LISTNER" rm -f /var/lock/subsys/oracle echo "OK" ;; reload|restart) $0 stop $0 start ;; *) echo "Usage: $0 start|stop|restart|reload" exit 1 esac exit 0