2 Replies Latest reply: Apr 25, 2014 9:00 AM by Suntrupth RSS

    automatically start oracle ...?

    891757

      hi to all,

                  i installed oracle 11gr2 successfully in redhat 6.4 on my pc. after that i want to

      make it autostart when pc starts. i used follwing script :-

       

      #!/bin/bash

      #

      # oracledb - little shell script to autostart your oracle database(s) and listener

      #

      # chkconfig: 2345 90 90

       

      # Source function library.

      . /etc/init.d/functions

       

      # Source networking configuration.

      . /etc/sysconfig/network

       

      prog=oracledb

      LOCKFILE=/var/lock/subsys/$prog

      ORACLE_HOME=/opt/oracle/app/oracle/product/11.2.0/dbhome_1

      ORACLE_USER=oracle

       

      start() {

      [ "$NETWORKING" = "no" ] && exit 1

       

      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"

           su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl start dbconsole"

         

      RETVAL=$?

      echo

      [ $RETVAL -eq 0 ] && touch $LOCKFILE

      return $RETVAL

      }

       

      stop() {

      if [ ! -f $LOCKFILE ]; then

              echo $0 already stopped

              exit 1

      fi

           echo -n $"Stoping oracle database"

           su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"

           su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"

           su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole"

         

       

      RETVAL=$?

      echo

      [ $RETVAL -eq 0 ] && rm -f $LOCKFILE

      return $RETVAL

      }

       

      case "$1" in

        'start')

           start

           ;;

        'stop')

           stop

           ;;

        'restart')

            stop

            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

       

       

      i did like this:-

       

      # cp oracledb /etc/rc.d/init.d/oracledb

       

      # chkconfig --add oracledb

       

      # chkconfig oracledb on

       

      everything is ok except

       

      after restarting pc

      https://localhost:1158/em

      404 not found

       

      for this:-

      $sqlplus / as sysdba

       

      sql>startup;

       

      then

      "https://localhost:1158/em" works fine

       

      question is that how to make oracle database autostart and I should not need to explicitly

      start as sysdba

       

      ------------------------

      if I manually give commands

      $lsnrctl start

      successfull

       

      $dbstart $ORACLE_HOME

       

      and

       

      $dbshut $ORACLE_HOME

       

      immediately after giving command, it doesn't show any output. how can i know it is successful or not.

       

      and at last

       

      $emctl start dbconsole

       

      works fine (no error)

       

      what should I do.

       

      thanks in advance.