If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > Oracle listener process on init

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-24-06, 04:53
kashnaraga kashnaraga is offline
Registered User
 
Join Date: Jan 2006
Posts: 2
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
Reply With Quote
  #2 (permalink)  
Old 01-24-06, 10:39
anacedent anacedent is offline
Registered User
 
Join Date: Aug 2003
Location: Where the Surf Meets the Turf @Del Mar, CA
Posts: 6,415
>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.
Reply With Quote
  #3 (permalink)  
Old 01-24-06, 13:15
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
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

__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Last edited by LKBrwn_DBA; 01-25-06 at 12:38.
Reply With Quote
  #4 (permalink)  
Old 01-25-06, 09:10
kashnaraga kashnaraga is offline
Registered User
 
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 :)
Reply With Quote
  #5 (permalink)  
Old 01-25-06, 12:41
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On