Loading....

The Oracle supplied dbstart and dbstop scripts seem to be having a limitation when it comes to starting and stopping listeners which are not named the standard listener name which is ‘listener’.

The reason being the script has the listener name hard coded as ‘listener’ and any other listener will not be handled by the startup and shutdown scripts.

Even if we do have a listener called listener, but have multiple Oracle Home’s with different listeners, the scripts will not work as they can only handle one listener.

We have overcome this limitation by creating a configuration file similar to the oratab file which has the listener names and Oracle Home’s they operate from and then make a few changes to the dbstart and dbstop scripts as shown below.

For example on one of the AIX machines, we have three listeners that are running as shown below

[DEV] ofsad2:/u01/oracle/product/10.2/ofsad2/bin > ps -ef |grep tns

rapmd2 241824 1 0 Jul 08 – 0:08 /u01/oracle/product/10.2/rapmd2/bin/tnslsnr LISTENER -inherit
ofsad2 1601784 1 0 09:04:57 pts/1 0:00 /u01/oracle/product/10.2/ofsad2/bin/tnslsnr primary -inherit
ofsad2 1605790 1 0 09:04:57 pts/1 0:00 /u01/oracle/product/11.0/bin/tnslsnr listener_11gtest -inherit

We have created a file called lsnrtab which has the following lines

/u01/oracle/product/11.0:listener_11gtest:Y
/u01/oracle/product/10.2/ofsad2:primary:Y

The dbstart and dbstop files have been edited accordingly to read this file and obtain the listener name as well as the Oracle Home location. Note that the original lines have been commented out.

dbstop

# Stop Oracle Net Listener
#if [ -f $ORACLE_HOME_LISTNER/bin/tnslsnr ] ; then
# echo “$0: Stoping Oracle Net Listener” >> $LOG 2>&1
# $ORACLE_HOME_LISTNER/bin/lsnrctl stop >> $LOG 2>&1 &
#else
# echo “Failed to auto-stop Oracle Net Listener using $ORACLE_HOME_LISTNER/bin/tnslsnr”
#fi

LSNRTAB=/u01/local/bwdba/scripts/lsnrtab_`whoami`

cat $LSNRTAB | while read LINE
do
LSNRHOME=`echo $LINE | awk -F: ‘{print $1}’`;export LSNRHOME
LSNRNAME=`echo $LINE | awk -F: ‘{print $2}’`;export LSNRNAME
export TNS_ADMIN=$LSNRHOME/network/admin
export ORACLE_HOME=$LSNRHOME
$ORACLE_HOME/bin/lsnrctl stop $LSNRNAME >> $LOG 2>&1 &
done

dbstart

# Start Oracle Net Listener
#if [ -x $ORACLE_HOME_LISTNER/bin/tnslsnr ] ; then
# echo “$0: Starting Oracle Net Listener” >> $LOG 2>&1
# $ORACLE_HOME_LISTNER/bin/lsnrctl start >> $LOG 2>&1 &
# export VER10LIST=`$ORACLE_HOME_LISTNER/bin/lsnrctl version | grep “LSNRCTL for ” | cut -d’ ‘ -f5 | cut -d’.’ -f1`
#else
# echo “Failed to auto-start Oracle Net Listener using $ORACLE_HOME_LISTNER/bin/tnslsnr”
#fi

LSNRTAB=/u01/local/bwdba/scripts/lsnrtab_`whoami`

cat $LSNRTAB | while read LINE
do
LSNRHOME=`echo $LINE | awk -F: ‘{print $1}’`;export LSNRHOME
LSNRNAME=`echo $LINE | awk -F: ‘{print $2}’`;export LSNRNAME
export TNS_ADMIN=$LSNRHOME/network/admin
export ORACLE_HOME=$LSNRHOME
$ORACLE_HOME/bin/lsnrctl start $LSNRNAME >> $LOG 2>&1 &
done

Please follow and like us:

Last Update: July 13, 2009  

July 13, 2009 268 Gavin Soorma
Total 0 Votes:
0

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Add A Knowledge Base Question !

You will receive an email when your question will be answered.

+ = Verify Human or Spambot ?

, , , ,

One thought on “Customizing the dbstart and dbstop scripts to deal with non standard listener names

Leave a Comment

Your email address will not be published. Required fields are marked *

*
*

Social media & sharing icons powered by UltimatelySocial
Back To Top

Add A Knowledge Base Question !

You will receive an email when your question will be answered.

+ = Verify Human or Spambot ?