Oracle LSNRCTL – Listener Shutdown and Startup Procedures

by Ramesh Natarajan on May 18, 2009

Oracle 11g lsnrctl CommandStarting up and shutting down the oracle listener is a routine task for a database administrator. However a Linux system administrator or programmer may end-up doing some basic DBA operations on development database. It is critical for non-DBAs to understand the basic database admin activities.

In this article, let us review how to start, stop, check status of an oracle listener using Oracle listener control utility LSNRCTL.

Also refer to our earlier article about how to start and stop the Oracle database

How To Start, Stop and Restart Oracle Listener

1. Display Oracle Listener Status

Before starting, stopping or restarting make sure to execute lsnrctl status command to check the oracle listener status as shown below. Apart from letting us know whether the listener is up or down, you can also find the following valuable information from the lsnrctl status command output.

  • Listner Start Date and Time.
  • Uptime of listner – How long the listener has been up and running.
  • Listener Parameter File – Location of the listener.ora file. Typically located under $ORACLE_HOME/network/admin
  • Listener Log File – Location of the listener log file. i.e log.xml


If the Oracle listener is not running, you’ll get the following message.

$ lsnrctl status

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:27:39

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 2: No such file or directory


If the Oracle listener is running, you’ll get the following message.

$ lsnrctl status

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:27:02

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.1.0.6.0 - Production
Start Date                29-APR-2009 18:43:13
Uptime                    6 days 21 hr. 43 min. 49 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.1.0/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/devdb/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.2)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Services Summary...
Service "devdb" has 1 instance(s).
  Instance "devdb", status UNKNOWN, has 1 handler(s) for this service...
Service "devdb.thegeekstuff.com" has 1 instance(s).
  Instance "devdb", status READY, has 1 handler(s) for this service...
Service "devdbXDB.thegeekstuff.com" has 1 instance(s).
  Instance "devdb", status READY, has 1 handler(s) for this service...
Service "devdb_XPT.thegeekstuff.com" has 1 instance(s).
  Instance "devdb", status READY, has 1 handler(s) for this service...
The command completed successfully

2. Start Oracle Listener

If the Oracle listener is not running, start the listener as shown below. This will start all the listeners. If you want to start a specific listener, specify the listener name next to start. i.e lsnrctl start [listener-name]

$ lsnrctl start

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:27:42

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/11.1.0/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.1.0.6.0 - Production
System parameter file is /u01/app/oracle/product/11.1.0/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/devdb/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.2)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.1.0.6.0 - Production
Start Date                04-APR-2009 16:27:42
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.1.0/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/devdb/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.2)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Services Summary...
Service "devdb" has 1 instance(s).
  Instance "devdb", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

3. Stop Oracle Listener

If the Oracle listener is running, stop the listener as shown below. This will stop all the listeners. If you want to stop a specific listener, specify the listener name next to stop. i.e lsnrctl stop [listener-name]

$ lsnrctl stop

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:27:37

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521)))
The command completed successfully

4. Restart Oracle Listener

To restart the listener use lsnrctl reload as shown below instead of lsnrctl stop and lsnrctl start. realod will read the listener.ora file for new setting without stop and start of the Oracle listener.

$ lsnrctl reload

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 17:03:31

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521)))
The command completed successfully

Oracle Listener Help

1. View Available Listener Commands

lsnrctl help command will display all available listener commands. In Oracle 11g following are the available listener commands.

  • start - Start the Oracle listener
  • stop - Stop the Oracle listener
  • status - Display the current status of the Oracle listener
  • services - Retrieve the listener services information
  • version - Display the oracle listener version information
  • reload - This will reload the oracle listener SID and parameter files. This is equivalent to lsnrctl stop and lsnrctl start.
  • save_config – This will save the current settings to the listener.ora file and also take a backup of the listener.ora file before overwriting it. If there are no changes, it will display the message “No changes to save for LISTENER”
  • trace - Enable the tracing at the listener level. The available options are ‘trace OFF’, ‘trace USER’, ‘trace ADMIN’ or ‘trace SUPPORT’
  • spawn - Spawns a new with the program with the spawn_alias mentioned in the listener.ora file
  • change_password – Set the new password to the oracle listener (or) change the existing listener password.
  • show - Display log files and other relevant listener information.
$ lsnrctl help

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:12:09

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

The following operations are available
An asterisk (*) denotes a modifier or extended command:

start               stop                status
services            version             reload
save_config         trace               spawn
change_password     quit                exit
set*                show*

2. Get More help on Specific Listener Command

You can get detailed help on a specific oracle listener command as shown below. In the following example, it gives all the available arguments/parameters that can be passed to the lsnrctl show command.

$ lsnrctl help show

LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 04-APR-2009 16:22:28

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

The following operations are available after show
An asterisk (*) denotes a modifier or extended command:

rawmode                     displaymode
rules                       trc_file
trc_directory               trc_level
log_file                    log_directory
log_status                  current_listener
inbound_connect_timeout     startup_waittime
snmp_visible                save_config_on_stop
dynamic_registration

Linux Sysadmin Course Linux provides several powerful administrative tools and utilities which will help you to manage your systems effectively. If you don’t know what these tools are and how to use them, you could be spending lot of time trying to perform even the basic administrative tasks. The focus of this course is to help you understand system administration tools, which will help you to become an effective Linux system administrator.
Get the Linux Sysadmin Course Now!

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

{ 16 comments… read them below or add one }

1 syed June 27, 2011 at 1:00 pm

Thank you very much for the informative notes. It helps everyone of us.

2 Anonymous April 4, 2012 at 1:14 pm

very nice… and more clarity…….keep rocking….

3 Madhura April 4, 2012 at 11:47 pm

Very nice and concept is made clear.
Thanks a lot.

4 Subodh April 11, 2012 at 1:30 pm

Thanks a lot man, it helped a lot.

5 Danial Noori April 17, 2012 at 12:14 am

Thank you so much very usefull and so clear

6 RajeshKumar June 18, 2012 at 5:12 am

Thank you…
it’s very helpful, clear and nice.

7 shahnawaz Pagarkar August 26, 2012 at 1:12 pm

hello There
I am Shahnawaz Pagarkar
I installed 11g and tryed to start the OEM .
BUt my OEM is not gettin started;
I checked the LISTENER STATUS Lsnrctl status
I stopped the LITENER and then Again i started the LISTENER
I GOT THE MESSAGE BELOW when i tryed to START THE OEM with the help of emctl start dbconsole . Kindly help

C:\Users\user>emctl start dbconsole
Can’t locate CompEMdbconsole.pm in @INC (@INC contains: %s_javapOracleHome%/sysm
an/admin/scripts %s_javapOracleHome%/bin D:\app\user\product\11.2.0\dbhome_3\\pe
rl\bin D:\app\user\product\11.2.0\dbhome_3\perl\lib D:\app\user\product\11.2.0\d
bhome_3\perl\lib\site_perl D:\app\user\product\11.2.0\dbhome_3\perl\site\lib D:\
app\user\product\11.2.0\dbhome_3\sysman\admin\scripts D:\app\user\product\11.2.0
\dbhome_3\sysman\admin\scripts\Net-DNS-0.48\lib D:\app\user\product\11.2.0\dbhom
e_3\bin D:/app/user/product/11.2.0/dbhome_3/perl/lib D:/app/user/product/11.2.0/
dbhome_3/perl/site/lib .) at D:\app\user\product\11.2.0\dbhome_3\bin/EmctlCommon

I am sure that there is some LISTENER problem , but i cannot unfortunately cannot figure it ! At the moment my PORT no is 2484 n hostname is user-PC
https://user-PC:2482/em
when i had created a new database at last i got a message which said that i need to configure the LISTNER (something related to LISTENER )and then run the emclt script .
Regards
Shahnawaz Pagarkar
ORACLE CORE DBA 9i , 10g, 11g

8 Naresh February 16, 2013 at 8:38 am

I installed oracle 11g in fedora 16 .when i typed ‘lsnrctl’ i m getting ‘command not found’ i m getting the same for ‘lsnrctl status’ and ‘lsnrctl start’ for the command ‘which listner’ the output is [oracle@ras root]$ which lsnrctl
/usr/bin/which: no lsnrctl in (/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/yalamanchili/.local/bin:/home/yalamanchili/bin)
i set ORACLE_SID,ORACLE_HOME,ORACLE_BASE. please help me

9 vikas March 4, 2013 at 4:44 am

$ lsnrctl start

LSNRCTL for HPUX: Version 2.3.4.0.0 – Production on 04-MAR-13 04:08:31

Copyright (c) Oracle Corporation 1994. All rights reserved.
Please help to resolve it…
Starting /opt/tools/oracle/bin/tnslsnr: please wait…

TNSLSNR for HPUX: Version 2.3.4.0.0 – Production
System parameter file is /opt/tools/oracle/network/admin/listener.ora
Log messages written to /opt/tools/oracle/network/log/listener.log
TNS-01151: Missing listener name, LISTENER, in LISTENER.ORA

10 Raymand March 27, 2013 at 12:50 am

German: Vielen Dank!
English: Thank You very much!

:D

11 spencer April 2, 2013 at 6:46 am

I installed oracle 10g on centos6.4(X86_64).I meet the question about the Listener.Can you help me

TNSLSNR for Linux: Version 10.2.0.1.0 – Production
System parameter file is /usr/local/oracle/product/10201/network/admin/listener.ora
Log messages written to /usr/local/oracle/product/10201/network/log/listev.log
TNS-01151: Missing listener name, Listev, in LISTENER.ORA

Listener failed to start. See the error message(s) above…

12 Tim lfeobu July 12, 2013 at 7:35 am

Great help.

13 robin August 12, 2013 at 6:19 pm

My Savior !!
you are cool!!!
thanks man!!! \m/ you rocks\m/

14 Rahul More December 6, 2013 at 11:42 pm

Very helpful information.

15 Joan February 9, 2014 at 12:09 am

Thank you so much as you saved my day. Very helpful information.

16 rishabh March 21, 2014 at 1:25 am

hi,

i m getting this error while trying to start the TNS Listener
LSNRCTL> start
Starting /siebelapp/oracle_client32/product/11.1.0/client_1/bin/tnslsnr: please wait…

TNS-12545: Connect failed because target host or object does not exist
TNS-12560: TNS:protocol adapter error
TNS-00515: Connect failed because target host or object does not exist
HPUX Error: 2: No such file or directory
LSNRCTL>

Leave a Comment

Previous post:

Next post: