cancel
Showing results for 
Search instead for 
Did you mean: 

Listener

Jade Bulante
Frequent Advisor

Listener

We have an Oracle database and I would like to know if there is a way to automate the starting and stopping of the listener.
4 REPLIES
Volker Borowski
Honored Contributor

Re: Listener

This is quite simple,

get a handy template from the init.d directoy, and adjust it to your needs (I took the one starting sendmail).

The commands in charge would be:

Start: su - oracle_user -c "lsnrctl start"
Stop: su - oracle_user -c "lsnrctl stop"
Restart: su - oracle_user -c "lsnrctl restart"

Create appropriate entries in then wanted runlevel directories.

Volker
Victor BERRIDGE
Honored Contributor

Re: Listener

Hi,
What do you want to automate?
the oracle scripts should do fine:
$ORACLE_HOME/bin/lsnrctl start/stop

Is it when you start/stop your database?
Then you could write a script that does both

Is it when the system is rebooted? restarted or shutdown?
Then you should put a script in /sbin/init.d with links to your specified level to start and stop, an example:
more rc.oracle
#!/usr/bin/ksh
export ORA_EXPLOIT=/opt/oracle/admin/exploit
export PATH=$PATH:/usr/bin:$ORA_EXPLOIT/proc


case "$1" in
start_msg)
echo "Start Oracle"
;;
stop_msg)
echo "Stop Oracle"
;;
start)
$ORA_EXPLOIT/proc/db_start
su - oracle -c $ORA_EXPLOIT/proc/net_start
;;
stop)
su - oracle -c $ORA_EXPLOIT/proc/net_stop
$ORA_EXPLOIT/proc/db_shut
;;
*)
echo "usage: $0 {start|stop}"
#rval=1
;;
esac

Regards
Victor
Victor BERRIDGE
Honored Contributor

Re: Listener

Hello,
Anyone there?
..
..
If you want some help, you will have to give some feed back...
(What are you looking for?)

Regards
Ed Ulfers
Frequent Advisor

Re: Listener

It is fairly common practice for the DBA's to use a supplemented /etc/oratab, with a new 4th field for the listener name. The oracle startup script then gets updated to account for this also.

Examples and variations on this basic theme can be found in http://technet.oracle.com

You can either use this or come up with your own to accomodate the need.

As a senior Oracle DBA, I like the single oracle instance configuration file and the fact that other like myself tend to do the same thing.

Good luck finding what is right for you.
-- Ed Ulfers
Put a smile on your users face, offer them a kiss (Hershey's Kiss).