#!/bin/sh
export ORACLE_BASE=/opt/app/oracle;
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1;
export PATH=$PATH:$ORACLE_HOME/bin;
export ORACLE_SID=dzjg;
ORACLE_USER=oracle;
start(){
su - "$ORACLE_USER"<<EOO
lsnrctl start
sqlplus / as sysdba <<EOS
startup
EOS
EOO
}
stop(){
su - "$ORACLE_USER"<<EOO
lsnrctl stop
sqlplus / as sysdba <<EOS
shutdown immediate
EOS
EOO
}
status(){
su - "$ORACLE_USER"<<EOO
lsnrctl status
EOO
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status oracle
;;
restart)
stop
sleep 3
start
;;
*)
echo "$0 {start|stop|status|restart}"
;;
esac