Tuesday, September 4, 2007

Monitoring with the lsnrctl utility in Oracle 10g

Monitoring with the lsnrctl utility in Oracle 10g

Learning objective

After completing this topic, you should be able to recognize how to monitor Oracle Net Services using the Listener Control utility.

1. The lsnrctl utility

In Oracle, you can use the Listener Control utility to control the listener by entering the lsnrctl command. Some of the actions you can perform are

  • starting and stopping the listener using the start and stop commands

LSNRCTL> command [ listener name]



LSNRCTL> help

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*



LSNRCTL>
  • monitoring listener status using the status command

LSNRCTL> command [ listenername]

  • monitoring the status of listener services using the service s command

LSNRCTL> command [ listenername]

  • changing the listener password using the change_password command

LSNRCTL> command [ listenername]

Other actions the lsnrctl command can perform include reinitializing the listener from the configuration file parameters and dynamically configuring multiple listeners.

LSNRCTL> help


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*



LSNRCTL>

LSNRCTL> command [ listener name]

The default Oracle listener is called LISTENER.

If you're issuing Listener Control commands on LISTENER, you don't have to specify the listener's name.

However, a listener with any other name must be specified.

LSNRCTL> help

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*



LSNRCTL>

LSNRCTL> command [ listener name]

Question

Identify the tasks you can perform using the Listener Control utility.

Options:

  1. Start the listener
  2. Monitor the status of listener services
  3. Monitor listener status
  4. Delete the listener

Answer

Among the tasks you can perform using the Listener Control utility are starting the listener, monitoring the status of listener services, and monitoring the status of the listener itself.

Option 1 is correct. You use the start command to do this.

Option 2 is correct. You use the service s command to do this.

Option 3 is correct. You use the status command to do this.

Option 4 is incorrect. You cannot delete the listener using the Listener Control utility.

2. lsnrctl prompt and command syntax

You can issue Listener Control utility commands using either command-line or prompt syntax. The two syntax options provide equivalent functionality.

You typically use command-line syntax if you want to execute one-off or scripted commands. And you use prompt syntax if you want to execute several commands in a row.

Prompt syntax spares you from having to type lsnrctl every time you use the tool. It's compulsory if your listener is password-protected.

[oracle@localhost oracle]$


LSNRCTL> command [ listenername]

$lsnrctl command

Question

Match the scenarios to the appropriate syntax types available for the Listener Control utility.

Options:

  1. You want to execute one-off or scripted commands
  2. Your listener is password-protected
  3. You want to execute several commands in a row

Targets:

  1. Command-line syntax
  2. Prompt syntax

Answer

You typically use command-line syntax if you want to execute one-off or scripted commands. And you typically use prompt syntax if you want to execute several commands in a row. Prompt syntax is compulsory if your listener is password-protected.

Let's say you want to start the LISTENER listener using command-line syntax.

[oracle@localhost oracle]$ lsnrctl start





LSNRCTL for Linux: Version 10.1.0.2.0 - Production on 12-AUG-2004 11:04:34





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





Starting /home/oracle/product/10.1.0/db_1/bin/tnslsnr: please wait...





TNSLSNR for Linux: Version 10.1.0.2.0 - Production


System parameter file is /home/oracle/product/10.1.0/db_1/network/admin/listener.ora


Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))


Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.5.163.56)(PORT=1521)))





Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))


STATUS of the LISTENER

------------------------

Alias LISTENER


Version TNSLSNR for Linux: Version 10.1.0.2.0 - Production


Start Date 12-AUG-2004 11:04:34


Uptime 0 days 0 hr. 0 min. 0 sec


Trace Level off


Security ON: Password or Local OS Authentication


SNMP OFF


Listener Parameter File /home/oracle/product/10.1.0/db_1/network/admin/listener.ora


Listening Endpoints Summary...


(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))


(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.5.163.56)(PORT=1521)))


Services Summary...

Service "ORCL1" has 1 instance(s).


Instance "ORCL1", status UNKNOWN, has 1 handler(s) for this service...


Service "ORCL3" has 1 instance(s).


Instance "ORCL3", status UNKNOWN, has 1 handler(s) for this service...


Service "PLSExtProc" has 1 instance(s).


Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...


The command completed successfully


To do this, you type lsnrctl start and press Enter.

The listener starts. You don't have to specify the name of the listener in this case, because you're using the default - LISTENER.

[oracle@localhost oracle]$ lsnrctl start





LSNRCTL for Linux: Version 10.1.0.2.0 - Production on 12-AUG-2004 11:04:34





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





Starting /home/oracle/product/10.1.0/db_1/bin/tnslsnr: please wait...





TNSLSNR for Linux: Version 10.1.0.2.0 - Production


System parameter file is /home/oracle/product/10.1.0/db_1/network/admin/listener.ora


Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))


Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.5.163.56)(PORT=1521)))





Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))


STATUS of the LISTENER

------------------------

Alias LISTENER


Version TNSLSNR for Linux: Version 10.1.0.2.0 - Production


Start Date 12-AUG-2004 11:04:34


Uptime 0 days 0 hr. 0 min. 0 sec


Trace Level off


Security ON: Password or Local OS Authentication


SNMP OFF


Listener Parameter File /home/oracle/product/10.1.0/db_1/network/admin/listener.ora


Listening Endpoints Summary...


(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))


(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.5.163.56)(PORT=1521)))


Services Summary...

Service "ORCL1" has 1 instance(s).


Instance "ORCL1", status UNKNOWN, has 1 handler(s) for this service...


Service "ORCL3" has 1 instance(s).


Instance "ORCL3", status UNKNOWN, has 1 handler(s) for this service...


Service "PLSExtProc" has 1 instance(s).


Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...


The command completed successfully


You can stop the listener by typing lsn r ct l stop and pressing Enter.

[oracle@localhost
oracle]$ lsnrctl stop



LSNRCTL for Linux: Version 10.1.0.2.0 - Production on 12-AUG-2004 11:05:51




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




Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))


The command completed successfully




Let's say you want to use prompt syntax to issue Listener Control commands.

[oracle@localhost oracle]$ lsnrctl




LSNRCTL for Linux: Version 10.1.0.2.0 - Production on 12-AUG-2004 11:05:57




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




Welcome to LSNRCTL, type "help" for information.




LSNRCTL>

To launch the prompt, you type lsnrctl and press Enter.

A prompt displays, and you no longer need to type lsnrctl when issuing the tool's commands.

You now need to start the listener.

LSNRCTL> start


Starting /home/oracle/product/10.1.0/db_1/bin/tnslsnr: please wait...




TNSLSNR for Linux: Version 10.1.0.2.0 - Production


System parameter file is /home/oracle/product/10.1.0/db_1/network/admin/listener.ora


Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))


Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.5.163.56)(PORT=1521)))




Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))


STATUS of the LISTENER

------------------------

Alias LISTENER


Version TNSLSNR for Linux: Version 10.1.0.2.0 - Production


Start Date 12-AUG-2004 11:06:00


Uptime 0 days 0 hr. 0 min. 0 sec


Trace Level off


Security ON: Password or Local OS Authentication


SNMP OFF


Listener Parameter File /home/oracle/product/10.1.0/db_1/network/admin/listener.ora


Listening Endpoints Summary...


(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))


(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.5.163.56)(PORT=1521)))


Services Summary...

Service "ORCL1" has 1 instance(s).


Instance "ORCL1", status UNKNOWN, has 1 handler(s) for this service...


Service "ORCL3" has 1 instance(s).


Instance "ORCL3", status UNKNOWN, has 1 handler(s) for this service...


Service "PLSExtProc" has 1 instance(s).


Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...


The command completed successfully


LSNRCTL> stop

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))


The command completed successfully


LSNRCTL>

You type start and press Enter.

The output for the start command issued using prompt syntax is identical to the output produced at the command line.

This is true for all commands.

LSNRCTL> start

Starting /home/oracle/product/10.1.0/db_1/bin/tnslsnr: please wait...




TNSLSNR for Linux: Version 10.1.0.2.0 - Production


System parameter file is /home/oracle/product/10.1.0/db_1/network/admin/listener.ora


Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))


Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.5.163.56)(PORT=1521)))




Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))


STATUS of the LISTENER

------------------------

Alias LISTENER


Version TNSLSNR for Linux: Version 10.1.0.2.0 - Production


Start Date 12-AUG-2004 11:06:00


Uptime 0 days 0 hr. 0 min. 0 sec


Trace Level off


Security ON: Password or Local OS Authentication


SNMP OFF


Listener Parameter File /home/oracle/product/10.1.0/db_1/network/admin/listener.ora


Listening Endpoints Summary...


(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))


(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.5.163.56)(PORT=1521)))


Services Summary...

Service "ORCL1" has 1 instance(s).


Instance "ORCL1", status UNKNOWN, has 1 handler(s) for this service...


Service "ORCL3" has 1 instance(s).


Instance "ORCL3", status UNKNOWN, has 1 handler(s) for this service...


Service "PLSExtProc" has 1 instance(s).


Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...


The command completed successfully


LSNRCTL> stop

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))


The command completed successfully


LSNRCTL>

Suppose you want to make a listener called BACKUP replace LISTENER as the current listener.

To do this using prompt syntax, you type set cur backup .

LSNRCTL> set cur backup


Current Listener is backup

Question

You want to issue a number of commands with the Listener Control utility.

Type the command needed to start the utility using prompt syntax.

Answer

To start the Listener Control utility using prompt syntax, you type lsnrctl.

3. lsnrctl services and lsnrctl status

The Listener Control utility's status command outputs detailed information about the listener, and summarizes services that it handles.

Suppose you want to access information about the listener using the status command.

LSNRCTL> status

Connecting to

(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.5.163.58)(PORT=1521)))


STATUS of the LISTENER

------------------------

Alias LISTENER


Version TNSLSNR for Linux: Version


10.1.0.2.0 - Production

Start Date 25-AUG-2004 09:51:07


Uptime 0 days 23 hr. 8 min. 57 sec


Trace Level off


Security ON: Local OS Authentication


SNMP OFF


Listener Parameter File

/home/oracle/product/10.1.0/db_1/network/admin/listene


Listening Endpoints Summary...




(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.5.163.58)(PORT=1521)))




(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))




(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=8080))(Presentation=


W))



(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=2100))(Presentation=


))

Services Summary...

Service "PLSExtProc" has 1 instance(s).


Instance "PLSExtProc", status UNKNOWN, has 1


handler(s) for this service...


Service "orcl" has 1 instance(s).


Instance "orcl", status READY, has 1 handler(s) for


this service...

Service "orcl4" has 1 instance(s).


Instance "orcl4", status READY, has 1 handler(s) for


this service...

Service "orcl4XDB" has 1 instance(s).


Instance "orcl4", status READY, has 1 handler(s) for


this service...

Service "orclXDB" has 1 instance(s).


Instance "orcl", status READY, has 3 handler(s) for


this service...

The command completed successfully


LSNRCTL>



To issue the command, you type status from the lsnrctl prompt and press Enter.

The output of the Listener Control status command includes

  • the listener name and version


LSNRCTL> status

Connecting to

(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.5.163.58)(PORT=1521)))


STATUS of the LISTENER

------------------------

Alias LISTENER


Version TNSLSNR for Linux: Version


10.1.0.2.0 - Production

Start Date 25-AUG-2004 09:51:07


Uptime 0 days 23 hr. 8 min. 57 sec


Trace Level off

Security ON: Local OS Authentication


SNMP OFF

Listener Parameter File

/home/oracle/product/10.1.0/db_1/network/admin/listene


Listening Endpoints Summary...




(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.5.163.58)(PORT=1521)))




(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))




(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=8080))(Presentation=


W))



(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=2100))(Presentation=


))

Services Summary...

Service "PLSExtProc" has 1 instance(s).


Instance "PLSExtProc", status UNKNOWN, has 1


handler(s) for this service...


Service "orcl" has 1 instance(s).


Instance "orcl", status READY, has 1 handler(s) for


this service...

Service "orcl4" has 1 instance(s).


Instance "orcl4", status READY, has 1 handler(s) for


this service...

Service "orcl4XDB" has 1 instance(s).


Instance "orcl4", status READY, has 1 handler(s) for


this service...

Service "orclXDB" has 1 instance(s).


Instance "orcl", status READY, has 3 handler(s) for


this service...

The command completed successfully


LSNRCTL>



  • when the listener was started and how long it has been up
  • the location of configuration and log files
  • trace level and security status information
  • listener address information, including host, port, and protocols serviced

As mentioned above, the status command output also includes summary information about each service the listener is handling.

Status information for statically registered services will display as UNKNOWN.

The services command outputs information about Oracle Net Services handled by the listener.

LSNRCTL> services

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))


Services Summary...

Service "ORCL1" has 2 instance(s).


Instance "ORCL1", status UNKNOWN, has 1 handler(s) for this service...


Handler(s):

"DEDICATED" established:36 refused:0


LOCAL SERVER

Instance "orcl1", status READY, has 1 handler(s) for this service...


Handler(s):

"DEDICATED" established:2 refused:0 state:ready


LOCAL SERVER

Service "ORCL3" has 2 instance(s).


Instance "ORCL3", status UNKNOWN, has 1 handler(s) for this service...


Handler(s):

"DEDICATED" established:1 refused:0


LOCAL SERVER

Instance "ORCL3", status READY, has 1 handler(s) for this service...


Handler(s):

"DEDICATED" established:0 refused:0 state:ready


LOCAL SERVER

Service "ORCL3XDB" has 1 instance(s).


Instance "ORCL3", status READY, has 1 handler(s) for this service...


Handler(s):

"D000" established:0 refused:0 current:0 max:972 state:ready


DISPATCHER

(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=36167))


Service "PLSExtProc" has 1 instance(s).


Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...


Handler(s):

"DEDICATED" established:0 refused:0


LOCAL SERVER

Service "orcl1XDB" has 1 instance(s).


Instance "orcl1", status READY, has 1 handler(s) for this service...


Handler(s):

"D000" established:0 refused:0 current:0 max:972 state:ready


DISPATCHER

(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=58396))


The command completed successfully


LSNRCTL>

For each service, the output tells you

  • the service name


LSNRCTL> services

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))


Services Summary...

Service "ORCL1" has 2 instance(s).


Instance "ORCL1", status UNKNOWN, has 1 handler(s) for this service...


Handler(s):

"DEDICATED" established:36 refused:0


LOCAL SERVER

Instance "orcl1", status READY, has 1 handler(s) for this service...


Handler(s):

"DEDICATED" established:2 refused:0 state:ready


LOCAL SERVER

Service "ORCL3" has 2 instance(s).


Instance "ORCL3", status UNKNOWN, has 1 handler(s) for this service...


Handler(s):

"DEDICATED" established:1 refused:0


LOCAL SERVER

Instance "ORCL3", status READY, has 1 handler(s) for this service...


Handler(s):

"DEDICATED" established:0 refused:0 state:ready


LOCAL SERVER

Service "ORCL3XDB" has 1 instance(s).


Instance "ORCL3", status READY, has 1 handler(s) for this service...


Handler(s):

"D000" established:0 refused:0 current:0 max:972 state:ready


DISPATCHER

(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=36167))


Service "PLSExtProc" has 1 instance(s).


Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...


Handler(s):

"DEDICATED" established:0 refused:0


LOCAL SERVER

Service "orcl1XDB" has 1 instance(s).


Instance "orcl1", status READY, has 1 handler(s) for this service...


Handler(s):

"D000" established:0 refused:0 current:0 max:972 state:ready


DISPATCHER

(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=58396))


The command completed successfully


LSNRCTL>

  • the status
  • the number of connections created or denied for both dedicated and shared connections

Question

You require the name and version of the default listener.

From the Listener Control prompt, type the command that will output the required information.

Answer

The status command outputs the required information.

Question

Match the lsnrctl services and lsnrctl status commands to descriptions of what they output.

Options:

  1. lsnrctl services
  2. lsnrctl status

Targets:

  1. Outputs detailed information about the listener and summarizes services handled by it
  2. Outputs information about Oracle Net Services handled by the listener

Answer

The lsnrctl status command outputs detailed information about the listener and summarizes services handled by it. And the lsnrctl services command outputs information about Oracle Net Services handled by the listener.

The outputted information includes the service name, the status of the service, and the number of connections created or denied for both dedicated and shared connections.

The output of this command includes the name and version of the listener, the location of configuration and log files, the time the listener was started and the duration elapsed since then, the trace level and security status, listener address information, and a summary of serviced listeners.

Summary

You can use the lsnrctl utility to control Oracle's listener. Actions you can perform include starting and stopping the listener, monitoring listener status, monitoring the status of listener services, reinitializing the listener from the configuration file parameters, dynamically configuring multiple listeners, and changing the listener password.

You can issue lsnrctl commands using either command-line or prompt syntax. Both syntax options provide equal functionality. You typically use command-line syntax if you want to execute one-off or scripted commands. And you typically use prompt syntax if you want to execute several commands in a row. Prompt syntax is compulsory if your listener is password protected.

The lsnrctl services command outputs information about Oracle Net Services handled by the listener. The lsnrctl status command outputs detailed information about the listener and summarizes services handled by it.

No comments: