#!/bin/bash # #oracle: Start/Stop Oracle Database 11g R2/12c # # chkconfig: 345 90 10 # 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.0/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 $0 already running. exit 1 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 $0 already stopping. exit 1 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‘) $0 stop $0 start ;; ‘status‘) if [ -f $LOCKFILE ]; then echo $0 started. else echo $0 stopped. fi ;; *) echo "Usage: $0 [start|stop|status]" exit 1 esac exit 0