Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Sartup server at bootup

Re: Sartup server at bootup

From: Tore Skogly <tore.skogly_at_c2i.net>
Date: Thu, 24 Apr 2003 23:48:44 +0200
Message-ID: <1051220924.839351@gurney>


Chr2k04 wrote:

> 
> How do I get linux to start it up when I boot the computer?
> 

You have to add a startup script, and then add links to that script for the runlevels you want to start/stop Oracle. Here is a my startup script located in /etc/rc.d/init.d (I'm running Redhat9 - directories might be slightly different in other distributions).

# cd /etc/rc.d/init.d
# vi oracle

(create a script like this):


#!/bin/bash
#

# Source function library.

. /etc/rc.d/init.d/functions

# Source networking configuration.

. /etc/sysconfig/network

ORACLE_HOME=/database/app/oracle/product/9.2 RETVAL=0 start() {

        # Start daemons.
        echo -n "Starting ORACLE: "
        su oracle -c "export ORACLE_HOME=$ORACLE_HOME;
                      $ORACLE_HOME/bin/dbstart;\
                      $ORACLE_HOME/bin/lsnrctl start"
        
        RETVAL=$?
        if [ "$RETVAL" != "0" ]; then
          echo_failure
        else
          echo_success
        fi      
        echo
        return $RETVAL

}

stop() {

        # Stop daemons.
        echo -n "Shutting down ORACLE: "
        su oracle -c "export ORACLE_HOME=$ORACLE_HOME;\
                      $ORACLE_HOME/bin/dbshut;\
                      $ORACLE_HOME/bin/lsnrctl stop"
        RETVAL=$?
        if [ "$RETVAL" != "0" ]; then
          echo_failure
        else
          echo_success
        fi                                                                      
        echo
        return $RETVAL

}

# See how we were called.

case "$1" in

        start)
                start
                ;;
        stop)
                stop
                ;;
        *)
                echo "Usage: oracle {start|stop}"
                exit 1

esac

exit $?



Then

# chmod 755 oracle
# cd /etc/rc.d/rc5.d
# ln -s ../init.d/oracle K04oracle
# ln -s ../init.d/oracle S98oracle
# /etc/rc.d/init.d/oracle start or - as in Redhat -
# service oracle start

I have never used Mandrake, so things might be slightly different.

-- 
regards,
Tore Skogly
Received on Thu Apr 24 2003 - 16:48:44 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US