Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # Run-level Startup script for the Oracle Instance and Listener
- #
- # chkconfig: 345 99 01
- # description: Startup/Shutdown Oracle listener and instance
- ORA_HOME=/u01/app/oracle/product/10.2.0/db_1
- if [ ! -f $ORA_HOME/bin/sqlplus ]
- then
- echo "Oracle sqlplus not found."
- exit 1
- fi
- case "$1" in
- start)
- # Oracle listener and instance startup
- echo -n "Starting Oracle: "
- su - oracle -c 'export NLS_LANG="" && echo "startup;" | sqlplus "/ as sysdba"' >> /var/log/dbora.log 2>&1
- su - oracle -c "export NLS_LANG='' && $ORA_HOME/bin/lsnrctl start" >> /var/log/dbora.log 2>&1
- touch /var/lock/subsys/dbora
- echo "Start OK `date`" >> /var/log/dbora.log 2>&1
- echo "OK"
- ;;
- stop)
- # Oracle listener and instance shutdown
- echo -n "Shutdown Oracle: "
- su - oracle -c 'export NLS_LANG="" && echo "shutdown immediate;" | sqlplus "/ as sysdba"' >> /var/log/dbora.log 2>&1
- su - oracle -c "export NLS_LANG='' && $ORA_HOME/bin/lsnrctl stop" >> /var/log/dbora.log 2>&1
- rm -f /var/lock/subsys/oracle
- echo "Stop OK `date`" >> /var/log/dbora.log
- echo "OK"
- ;;
- restart)
- $0 stop
- $0 start
- ;;
- *)
- echo "Usage: $0 start|stop|restart"
- exit 1
- esac
Advertisement
Add Comment
Please, Sign In to add comment