Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2007
    Location
    Tallahassee, FL
    Posts
    10

    Unanswered: auto start oracle listener in AIX at system startup

    My initial goal was to auto start/stop the oracle database and listener on AIX. Oracle suggested the following for starting and stopping the database (not the listener):

    1. Create a file called dbora in the /etc directory.
    2. chgrp dba /etc/dbora (change the group for the file permissions)
    3. chmod 750 /etc/dbora (change the permissions of the file.)
    4. add the following lines in the dbora file:

    #! /bin/sh -x
    #
    # Change the value of ORACLE_HOME to specify the correct Oracle home
    # directory for your installation.

    ORACLE_HOME=/u01/app/oracle/product/ora10g
    #
    # Change the value of ORACLE to the login name of the
    # oracle owner at your site.
    #
    ORACLE=oracle

    PATH=${PATH}:$ORACLE_HOME/bin
    HOST=`hostname`
    PLATFORM=`uname`
    export ORACLE_HOME PATH
    #
    if [ ! "$2" = "ORA_DB" ] ; then
    if [ "$PLATFORM" = "HP-UX" ] ; then
    remsh $HOST -l $ORACLE -n "$0 $1 ORA_DB"
    exit
    else
    rsh $HOST -l $ORACLE $0 $1 ORA_DB
    exit
    fi
    fi
    #
    case $1 in
    'start')
    $ORACLE_HOME/bin/dbstart $ORACLE_HOME &
    ;;
    'stop')
    $ORACLE_HOME/bin/dbshut $ORACLE_HOME &
    ;;
    *)
    echo "usage: $0 {start|stop}"
    exit
    ;;
    esac
    #
    exit

    5. Now that we have the dbora file with the correct oracle user and oracle home, we simply create the soft links as follows:

    # ln -s /etc/dbora /etc/rc.d/rc2.d/S99dbora
    # ln -s /etc/dbora /etc/rc.d/rc2.d/K01dbora

    6. You then have to edit the /etc/hosts.equiv file with the following entry:

    host root (where the host is the name of the server)

    My database now will auto start and stop when the AIX system is rebooted.

    I tried doing the same thing for the listener with the following changes:

    I created a dblsn file with the following changes in the script:

    case $1 in
    'start')
    $ORACLE_HOME/bin/lsnstart $ORACLE_HOME &
    ;;
    'stop')
    $ORACLE_HOME/bin/lsnstop $ORACLE_HOME &
    ;;
    *)
    echo "usage: $0 {start|stop}"
    exit
    ;;
    esac
    #
    exit

    The lsnstart script works when I run it from the user Oracle or root. It is as follows:

    #
    # Startup the oracle listener
    #
    export PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:
    export ORACLE_BASE=/u01/app/oracle
    export ORACLE_HOME=/u01/app/oracle/product/ora10g
    export ORACLE_SID=orasql
    export AGENT_HOME=/u01/app/oracle/product/agent10g

    /bin/su oracle -c /u01/app/oracle/product/ora10g/bin/lsnrctl start

    For the /etc/dblsn file, I implemented the following soft links:

    # ln -s /etc/dbora /etc/rc.d/rc2.d/S97dbora
    # ln -s /etc/dbora /etc/rc.d/rc2.d/K03dbora

    If it worked for the database, I thought it should work for the listener. When it didn't, I tried a different method for auto starting the listener:

    1. I copied the lsnstart script above to the /etc directory and renamed it to rc.lsnstart
    2. I then added the script to the inittab by using the following:

    #/usr/sbin/mkitab "rclsnstart:2:wait:/etc/rc.lsnstart > /dev/console 2>&1"

    If I do a telinit q, it should reread the inittab file and start the listener. It doesn't work.

    So, I've tried two methods to automajically starting the oracle listener in an AIX environment with no luck. Any suggestions would be appreciated.
    Last edited by joy32327; 03-27-07 at 14:54.

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Talking Easy does it...

    Quote Originally Posted by joy32327 View Post
    My initial goal was to auto start/stop the oracle database and listener on AIX. Oracle suggested the following for starting and stopping the database (not the listener):
    ... Etc ...
    If you are using Oracle version 10+ or 11+, the dbstart/dbshut scripts will start/stop the listener for you.
    Therefore all you need to do is use this script:
    Code:
    #!/bin/sh -x
    # dbora.sh - Start/Stop Oracle
    #
    # Copy this script to /etc/init.d
    # Create the following symbolic links:
    #     /etc/rc0.d/K10dbora -> /etc/init.d/dbora.sh
    #     /etc/rc3.d/S80dbora -> /etc/init.d/dbora.sh
    #
    # Following is the Oracle Home for the listener:
    #
    ORACLE_HOME=/opt/app/oracle/product/11.2.0; export ORACLE_HOME
    
    if [ "$1" = "start" ] ; then
        su - oracle -c "$ORACLE_HOME/bin/dbstart" >> /opt/app/oracle/logs/startup.log 2>&1
        exit
    fi
    if [ "$1" = "stop" ] ; then
        su - oracle -c "$ORACLE_HOME/bin/lsnrctl stop" >> /opt/app/oracle/logs/shutdown.log 2>&1
        exit
    fi
    echo "Usage: $0 [start|stop]"
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •