Created
March 29, 2011 19:47
-
-
Save slamotte/893086 to your computer and use it in GitHub Desktop.
Script to start/stop Oracle under Unbuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Startup script for Oracle databases | |
export ORACLE_HOME=/opt/oracle/oracle/product/10.2.0/db_1 | |
export PATH=$PATH:$ORACLE_HOME/bin | |
export TZ=CST6 | |
function process_oem() { | |
egrep -v '^([:space:]*#|[:space:]*$)' /etc/oratab | egrep 'Y$' | sed "s/:.*//" | while read sid; do | |
echo "Processing Enterprise Manager for $sid" | |
export ORACLE_SID=$sid | |
su oracle -c "$ORACLE_HOME/bin/emctl $1 dbconsole > /dev/null &" | |
done | |
# Don't bother starting isqlplus, its been deprecated from 11g | |
#su oracle -c "$ORACLE_HOME/bin/isqlplusctl $1 > /dev/null &" | |
} | |
case "$1" in | |
start) | |
echo "Starting Oracle..." | |
su oracle -c $ORACLE_HOME/bin/dbstart | |
process_oem $1 | |
touch /var/lock/oracle | |
echo "Done" | |
;; | |
stop) | |
echo "Stopping Oracle..." | |
su oracle -c $ORACLE_HOME/bin/dbshut | |
process_oem $1 | |
rm -f /var/lock/oracle | |
echo "Done" | |
;; | |
*) | |
echo "Usage: '$0' start|stop" | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Save this as
/etc/init.d/oracle
and execute the following: