Created
October 10, 2015 13:15
-
-
Save chiita/906bafd11e88bea3bdfc to your computer and use it in GitHub Desktop.
start dbora service auto, stop dbra service auto
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 | |
# chkconfig: 2345 99 10 | |
# description: starts and stops oracle instances | |
# Set ORA_HOME to be equivalent to the $ORACLE_HOME | |
# from which you wish to execute dbstart and dbshut; | |
# | |
# Set ORA_OWNER to the user id of the owner of the | |
# Oracle database in ORA_HOME. | |
export ORACLE_HOME=/oradata/app/oracle/product/11.2.0/dbhome_1 | |
ORA_OWNER=oracle | |
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]; then | |
echo "Oracle startup: cannot start" | |
exit | |
fi | |
case "$1" in | |
start) | |
# Start the Oracle databases: | |
su - $ORA_OWNER -c "$ORACLE_HOME/bin/dbstart" | |
# Start Oracle Net | |
su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl start" | |
# Start emctl | |
su - $ORA_OWNER -c "$ORACLE_HOME/bin/emctl start dbconsole" | |
touch /var/lock/subsys/dbora | |
;; | |
stop) | |
# Stop Oracle Net | |
su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop" | |
# Stop the Oracle databases: | |
su - $ORA_OWNER -c "$ORACLE_HOME/bin/dbshut" | |
# Stop emctl | |
su - $ORA_OWNER -c "$ORACLE_HOME/bin/emctl stop dbconsole" | |
rm -f /var/lock/subsys/dbora | |
;; | |
restart) | |
$0 stop | |
$0 start | |
;; | |
status) | |
if [ -f /var/lock/subsys/dbora ]; then | |
echo $0 started. | |
else | |
echo $0 stopped. | |
fi | |
;; | |
*) | |
echo "usage: dbora {start|stop|restart|status}" | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment