Guest User

dbora

a guest
Jun 22nd, 2011
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.31 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # Run-level Startup script for the Oracle Instance and Listener
  4. #
  5. # chkconfig: 345 99 01
  6. # description: Startup/Shutdown Oracle listener and instance
  7.  
  8. ORA_HOME=/u01/app/oracle/product/10.2.0/db_1
  9.  
  10. if [ ! -f $ORA_HOME/bin/sqlplus ]
  11.    then
  12.         echo "Oracle sqlplus not found."
  13.    exit 1
  14. fi
  15.  
  16. case "$1" in
  17.  
  18. start)
  19.         # Oracle listener and instance startup
  20.         echo -n "Starting Oracle: "
  21.         su - oracle -c 'export NLS_LANG="" && echo "startup;" | sqlplus "/ as sysdba"' >> /var/log/dbora.log 2>&1
  22.         su - oracle -c "export NLS_LANG='' && $ORA_HOME/bin/lsnrctl start" >> /var/log/dbora.log 2>&1
  23.         touch /var/lock/subsys/dbora
  24.         echo "Start OK `date`" >> /var/log/dbora.log 2>&1
  25.         echo "OK"
  26.         ;;
  27.  
  28. stop)
  29.         # Oracle listener and instance shutdown
  30.         echo -n "Shutdown Oracle: "
  31.         su - oracle -c 'export NLS_LANG="" && echo "shutdown immediate;" | sqlplus "/ as sysdba"' >> /var/log/dbora.log 2>&1
  32.         su - oracle -c "export NLS_LANG='' && $ORA_HOME/bin/lsnrctl stop" >> /var/log/dbora.log 2>&1
  33.         rm -f /var/lock/subsys/oracle
  34.         echo "Stop OK `date`" >> /var/log/dbora.log
  35.         echo "OK"
  36.         ;;
  37.  
  38. restart)
  39.         $0 stop
  40.         $0 start
  41.         ;;
  42. *)
  43.  
  44. echo "Usage: $0 start|stop|restart"
  45. exit 1
  46. esac
Advertisement
Add Comment
Please, Sign In to add comment