Serverside Configuration   «Prev  Next»

Lesson 15 Starting the listener
Objective Start the listener using the Listener Control utility.

Starting Listener using lsnrctl

dilbert> lsnrctl start
LSNRCTL for IBM/AIX RISC System/6000: Version 2.1.6.1.0 - Production on 15-MAR-9
9 10:32:24
Copyright (c) Oracle Corporation 1994.  All rights reserved.
Starting /oracle/SAS/bin/tnslsnr: please wait...
TNSLSNR for IBM/AIX RISC System/6000: Version 2.1.6.1.0 - Production
System parameter file is /etc/listener.ora
Log messages written to /oracle/network/log/listener.log

Listening on: (DESCRIPTION=(CONNECT_TIMEOUT=10)(ADDRESS=(PROTOCOL=TCP)(HOST=dilbert)(PORT=1521)))
Listening on: (DESCRIPTION=(CONNECT_TIMEOUT=10)(ADDRESS=(PROTOCOL=TCP)(HOST=dilbert)(PORT=1522))))
Connecting to (ADDRESS=(PROTOCOL=TCP)(HOST=revsp2k)(PORT=1521))

STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for IBM/AIX RISC System/6000: Version 2.1.6.1.
0 - Production
Start Date 15-MAR-99 10:32:28
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security OFF
Listener Parameter File /etc/listener.ora
Listener Log File /oracle/network/log/listener.log
Services Summary...
tom has 1 service handlers
The command completed successfully

Now let's take a look at how to start the listener. When you issue the command lsnrctl start, Oracle invokes the $ORACLE_HOME/bin/lsnrctl utility. This utility will then go to the listener.ora file to get the start-up parameters. The LSNRCTL utility will then start a server process. View the code below to see what happens when you start a listener.
From the output of the lsnrctl start command, we see all the configuration parameters, including the database name, start time, and the locations of the trace log.
dilbert> ps -ef|grep -i list
oracle 11146 1   0   Mar 12 - 0:02 /ora7/product/8.0.5/bin/tnslsnr LISTENER –inherit

Since we just started a UNIX process, we can use the UNIX ps command to see the process: Oracle with SQL*Net version 1 uses the start command tcpctl start and will start a server process called "orasrv".
However, what do you do if you want to automate the starting of the listener? In many environments, a start-up UNIX script can be used to start the Oracle databases, and then start the listener. Following is an example:

#!/bin/ksh
ORACLE_SID=tom; export ORACLE_SID
ORACLE_HOME=/ora8/product/8.0.5;export ORACLE_HOME
# start the tom database . . . 
svrmgrl << EOT     
connect internal
shutdown abort
startup
exit
EOT
# start the jerry database
ORACLE_SID=jerry; export ORACLE_SID
svrmgrl << EOT     
connect internal
shutdown abort
startup
exit
EOT
# Now, start the listener . . . 
lsnrctl << EOT     
set password secret_password 
start
exit
EOT

Notice that this script defines a listener password and uses it to start the listener. In this case, you need to carefully set the "read" permissions (that is, 700) on this script so no one can see the password. The next lesson discusses how to stop the Oracle Net listener.

Start Oracle Listener - Exercise

Before moving on to the next lesson, click the Exercise link below to test your knowledge of the internal functions of the listener.
Start Oracle Listener - Exercise