#!/bin/bash
#
#oracle: Start/Stop Oracle Database 11g R2/12c
#
# chkconfig:
# description: The Oracle Database Server is an RDBMS created by Oracle Corporation
#
# processname: oracle . /etc/rc.d/init.d/functions LOCKFILE=/var/lock/subsys/oracle
PATH=$PATH:$HOME/bin
ORACLE_USER=oracle
export PATH ORACLE_BASE=/home/oracle/Oracle_12c/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/12.1./dbhome_1
ORACLE_SID=MYORACLE
PATH=$PATH:$ORACLE_HOME/bin
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32
NLS_LANG=AMERICAN_CHINA.ZHS16GBK
export ORACLE_BASE ORACLE_HOME PATH ORACLE_SID LD_LIBRARY_PATH NLS_LANG case "$1" in
start)
if [ -f $LOCKFILE ]; then
echo $ already running.
exit
fi
echo -n $"Starting Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
touch $LOCKFILE
;;
stop)
if [ ! -f $LOCKFILE ]; then
echo $ already stopping.
exit
fi
echo -n $"Stopping Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
rm -f $LOCKFILE
;;
'restart')
$ stop
$ start
;;
'status')
if [ -f $LOCKFILE ]; then
echo $ started.
else
echo $ stopped.
fi
;;
*)
echo "Usage: $0 [start|stop|status]"
exit
esac exit