Created
November 7, 2012 12:26
-
-
Save sytkov/4031302 to your computer and use it in GitHub Desktop.
/etc/init.d/oracle
This file contains 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/sh | |
# description: Starts and stops the Oracle database and listeners | |
# processname: oracle | |
# chkconfig: 2345 20 80 | |
export ORACLE_BASE=/opt/oracle/app/oracle | |
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1 | |
export ORACLE_SID=vo2 | |
export PATH=$ORACLE_HOME/bin:$PATH | |
case $1 in | |
start) | |
echo -n "Starting Oracle Databases: " | |
echo "----------------------------------------------" >> /var/log/oracle | |
date +"! %T %a %D : Starting Oracle Databases." >> /var/log/oracle | |
echo "----------------------------------------------" >> /var/log/oracle | |
su - oracle -c dbstart >> /var/log/oracle | |
echo "Done." | |
echo -n "Starting Oracle Listeners: " | |
su - oracle -c "lsnrctl start" >> /var/log/oracle | |
echo "Done." | |
echo "" | |
echo "----------------------------------------------" >> /var/log/oracle | |
date +"! %T %a %D : Finished." >> /var/log/oracle | |
echo "----------------------------------------------" >> /var/log/oracle | |
touch /var/lock/subsys/oracle | |
;; | |
stop) | |
echo -n "Shutting Down Oracle Listeners: " | |
echo "----------------------------------------------" >> /var/log/oracle | |
date +"! %T %a %D : Shutting Down Oracle Databases." >> /var/log/oracle | |
echo "----------------------------------------------" >> /var/log/oracle | |
su - oracle -c "lsnrctl stop" >> /var/log/oracle | |
echo "Done." | |
rm -f /var/lock/subsys/oracle | |
echo -n "Shutting Down Oracle Databases: " | |
su - oracle -c dbshut >> /var/log/oracle | |
echo "Done." | |
echo "" | |
echo "----------------------------------------------" >> /var/log/oracle | |
date +"! %T %a %D : Finished." >> /var/log/oracle | |
echo "----------------------------------------------" >> /var/log/oracle | |
;; | |
restart) | |
echo -n "Restarting Oracle Databases: " | |
echo "----------------------------------------------" >> /var/log/oracle | |
date +"! %T %a %D : Restarting Oracle Databases." >> /var/log/oracle | |
echo "----------------------------------------------" >> /var/log/oracle | |
su - oracle -c dbstop >> /var/log/oracle | |
su - oracle -c dbstart >> /var/log/oracle | |
echo "Done." | |
echo -n "Restarting Oracle Listeners: " | |
su - oracle -c "lsnrctl stop" >> /var/log/oracle | |
su - oracle -c "lsnrctl start" >> /var/log/oracle | |
echo "Done." | |
echo "----------------------------------------------" >> /var/log/oracle | |
date +"! %T %a %D : Finished." >> /var/log/oracle | |
echo "----------------------------------------------" >> /var/log/oracle | |
touch /var/lock/subsys/oracle | |
;; | |
*) | |
echo "Usage: oracle {start|stop|restart}" | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment