top of page
Writer's pictureShashi Kallae

Listener.ora and addlnctl.sh script


The listener.ora file is the configuration file for the Oracle database listener. It contains the details such as communication protocol, host IP address, and Port number of the Oracle database.


tnsnames.ora file, Image credit: Oracle Technologies inc.
tnsnames.ora file, Image credit: Oracle Technologies inc.

Set the environment variables for the Oracle Database

If you want the Oracle database environment variables to take effect during the Linux server startup, do the below

ORACLE_BASE: Oracle base directory.
ORACLE_HOME: Oracle home directory.
ORACLE_SID: Oracle database Instance ID. 
Add the following contents to the profile file on the Linux server:

vi /etc/profile

ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/19.X/db_1
ORACLE_SID=orcl
PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_PATH

Once the profile file is updated, Save the changes and close the file. See if the environment variables are in effect by executing the below commands,

echo $ORACLE_BASE 
echo $ORACLE_HOME 
echo $ORACLE_SID 
echo $PATH 
echo $LD_LIBRARY_PATH

What is a listener.ora file?

Example of a listener.ora file,

LISTENER =
  (ADDRESS_LIST =
        (ADDRESS = 
          (PROTOCOL = TCP)
          (Host = 127.0.0.1)
          (Port = 1521)
        )
  )
STARTUP_WAIT_TIME_LISTENER = 0
CONNECT_TIMEOUT_LISTENER = 10
TRACE_LEVEL_LISTENER = ADMIN
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (ORACLE_HOME = /u01/app/oracle/product/19.x/db_1)
      (SID_NAME = orcl)
    )
  )

Which listener.ora should be used to manage the database listener ?

Under $ORACLE_HOME/appsutil/scripts/<databasename>_<hostname>, the following scripts exist to manage the Oracle DB,

adautocfg.sh
adcdbctl.sh
adcdblnctl.sh
adchknls.pl
addbctl.sh
addlnctl.sh
adexecsql.pl
adpreclone.pl
adstopcdb.sql
adstopdb.sql
adstrtcdb.sql
adstrtdb.sql

listener.ora in the admin directory should be used to start/stop/restart the Oracle DB listener.

$ORACLE_HOME/network/admin/listener.ora

How adcdblnctl.sh script is used?

Location : $ORACLE_HOME/appsutil/scripts/<databasename>_<hostname>/adcdblnctl.sh
Example: adcdblnctl.sh start <CDBNAME>
         
(or)

Example: $ORACLE_HOME/appsutil/scripts/<databasename>_<hostname>/adcdblnctl.sh start <CDBNAME>

CDBNAME: Container Database Name.
PDBNAME: Pluggable Database Name.

What happens if adcdbinctl.sh is not used?

"ORA-01034: ORACLE not available, ORA-27101: shared memory realm does not exist," errors will occur if adcdbinctl.sh is not used.


The reason is '$ORACLE_HOME/network/admin/listener.ora' includes 'USE_SID_AS_SERVICE_<CDB_NAME> = ON' parameter to avoid ORA-01034 / ORA-27101 error and have AutoConfig connect to DB.


How to know which listener.ora is used?


On the DB tier, execute the lsnrctl command to confirm if $ORACLE_HOME/network/admin/listener.ora file is used from the output "Listener Parameter File."


lsnrctl status (PDB_NAME)

Execute 'lsnrctl status CDBNAME' command to look for the value of "Listener Parameter File" in the output.

Example: Listener Parameter File   
ORACLE_HOME=/u01/oracle/db/tech/19.X
$ORACLE_HOME/network/admin/listener.ora

Listener Log File: $ORACLE_HOME/network/log/listener.log

Example of using addlnctl.sh script


Source the PDB environment file on DB tier.

source $ORACLE_HOME/<DB SID>_<HOST>.env

Stop current listener using addlnctl.sh script

addlnctl.sh stop <DB_NAME>

Source the DB environment file on DB tier.

source $ORACLE_HOME/<DB SID>_<HOST>.env

Execute adcdblnctl.sh script to start listener

adcdblnctl.sh start <DB>

Execute the below status command, and make sure it shows Listener Parameter File :

lsnrctl status <DB>
$ORACLE_HOME/network/admin/listener.oraX. 

If there are any changes to be done or you found any issues, then repeat the below steps,

  • Source the DB environment file on DB tier

  • source $ORACLE_HOME/<DB SID>_<HOST>.env

  • Rerun AutoConfig

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page