Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2006
    Posts
    2

    Unanswered: Oracle listener process on init

    Hi all,
    I want to set the 'tnslsnr' process to run at init.
    (So I won't have to restart it everytime the system is rebooting)

    If I add the running command line to my /etc/inittab file (btw I use Solaris)
    it will run with the user root.

    Is it possible?
    how can it run with the oracle db user it usually runs under?

    Thanks ahead,
    Oren

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >how can it run with the oracle db user it usually runs under?
    $ man su
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

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

    Cool


    Here is one way to do it:
    Code:
    #!/bin/ksh
    if [ $# -eq 0 ] 
    then
            echo "%-Error, Missing Parameter: $0 {start | stop}"
            exit
    fi
    ###################################################
    # 1st time thru, su to oracle (used for boot and shutdown procedures)
    ###################################################
    if [ ! "$2" = "ORADBA" ]
    then
            su - oracle -c "/etc/init.d/db_oracle.ksh $1 ORADBA" 
            exit
    fi
     
    case $1 in
            'start')
                    /oracle/local/utl/db_startup.ksh all &
                    /oracle/dbsrvr/8.1.7/bin/lsnrctl start
                    ;;
            'stop')
                    /oracle/dbsrvr/8.1.7/bin/lsnrctl stop
                    /oracle/local/utl/db_shutdown.ksh all
                    ;;
            *)
                    echo "%-Error, Invalid Parameter: $0 {start | stop}"
                    exit
                    ;;
    esac
    exit

    Last edited by LKBrwn_DBA; 01-25-06 at 13:38.
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  4. #4
    Join Date
    Jan 2006
    Posts
    2

    Using 'su' command is good but ...

    If I will call a shell script from the inittab (which will call the command which will start the lsnr process) on this way :

    /etc/inittab:
    su::once:/usr/sbin/<su.sh> ---> calling <su.sh> from /etc/inittab

    <su.sh> , will contain this line :
    su - <user> -c <'cmd'> ----> where cmd is the actuall command to start lsnr

    It is a good solution BUT ,
    It will work only if the user which runs the command would be root
    (Because that user can 'su' without password).

    Does the commands\scripts that we call through the /etc/inittab file always run under 'root' user ?
    If yes then it kinda solve my problem ...
    Does anybody know :) ?

    Thanks in advance,
    Oren :)

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

    Cool


    You add the script I posted into /etc/init.d and all the /etc/rc?.d directories.

    Also you will have to code the "db_startup.ksh" and "db_shutdown.ksh" scripts.

    Good luck!

    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
  •