Lsnrctl (Listener control) is a sql*net tool for controlling database Listener, which provides control of command Listener start, stop, view Listener status, change Listener configuration parameters.
Lsnrctl Introduction
Enter LSNRCTL on the command line and you will get:
C:\Documents and Settings\administrator>lsnrctllsnrctl for 32-bit windows:version 10.2.0.1.0-production on 2 June-September-20 08:44:15copyright (c) 1991, 2005, Oracle. All rights reserved. Welcome to LSNRCTL, please type "help" for information. Lsnrctl>
Using the Help command, you will see all the available commands:
Lsnrctl> help the following actions can be used to indicate a modifier or an extension command: Start stop statusservices version reloadsave_config Trace change_passwordquit exit set*show*
The following is a brief description of these commands:
1) Start: Start listener with the specified listener name, otherwise the Listerner will start.
In the Windows system, listener can also be launched in the service of the control center;
2) Stop: Stop listener.
Windows systems can also be stopped from the service in the control center.
3) Status: Provides listener state information, including startup time, execution time, and trace level;
4) Services: print all available services;
5) Version: Prints the listener's revision number information.
6) Reload: Do not stop and start the listener case to forcibly read the configuration file to obtain a new configuration;
7) Save_config: Create a backup for the current Listener.ora file. and save changes to the current version number;
8) Trace: Sets the trace level. Available values: Off,user,admin and support.
9) Dbsnmp_start: Start DBSNMP Deputy Agent.
Dbsnmp_stop: Stop DBSNMP deputy agent;
One) Dbsnmp_status: Print the status of Dbsnmp deputy agent;
Change_password: Set a new password for listener.
Quit or exit: Exit;
Set: Change the value regardless of the number of parameters;
Show: Print the settings for the current number of parameters.
LSNRCTL Application Examples
Several examples of lsnrctl are described below.
Start listener
When listener is stopped, connecting to the DB instance will result in an ORA-12541 exception, and the view listener status will be:
Lsnrctl> status is connected to (description= (address= (protocol=tcp) (host=10.74.216.39) (port=1521)) (Connect_data= (SID= Lytest) (server=dedicated)) Tns-12541:tns: No listener tns-12560:tns: Protocol Adapter error TNS-00511: No listener 32-bit Windows Error : 61:unknown Error
You can then start listener:
lsnrctl> start Tnslsnr: Please wait ... Tnslsnr for 32-bit windows:version 10.2.0.1.0-production system parameter file is E:\oracle\product\10.2.0\db_1\network\admin\ Listener.ora Write E:\oracle\product\10.2.0\db_1\network\log\listener.log log information listener: (Description= (address= (protocol= TCP) (host=10.74.216.39) (port=1521))) Monitor: (Description= (Address= (PROTOCOL=IPC) (PIPENAME=\\.\PIPE\EXTPROC0IPC))) Connecting to (Description= (address= (protocol=tcp) (host=10.74.216.39) (port=1521)) LISTENER STATUS------------------------Alias Listener version number Tnslsnr for 32-bit windows:version 10.2.0.1.0-production Start date 2 June-September-2014 09:33:40 Normal execution time 0 days 0 hours 0 minutes 4 seconds trace level Off security on:local OS authenticationsnmp off listener parameter file E:\oracle\product\10 .2.0\db_1\network\admin\listener.ora Listener log file E:\oracle\product\10.2.0\db_1\network\log\listener.log Listener Endpoint Summary ... (Description= (address= (protocol=tcp) (host=10.74.216.39) (port=1521))) (Description= (address= (PROTOCOL=IPC) (PIPENAME=\\.\PIPE\EXTPROC0IPC)) Service Summary: The service "Plsextproc" consists of 1 routines. Routines "Plsextproc", State UNKNOWN, including 1 handlers for this service ... Command runs successfully
to here. Listener started successfully.
Trace file
The Listener trace file provides us with listener work-process information. Help us locate the listener fault. The following is the group information that LSNRCTL provides for trace:
lsnrctl> Help Tracetrace OFF | USER | ADMIN | support [<listener_name>]: Set tracing to the specified level
Here is an explanation of the number of references:
1) off:no trace output;
2) User:user trace information.
3) admin:administration trace information;
4) support:oracle support Services Trace Information
The following turns on tracing:
Lsnrctl> Trace support is connecting to (description= (address= (protocol=tcp) (host=10.74.216.39)) Open trace file: port=1521 ORACLE\PRODUCT\10.2.0\DB_1\NETWORK\TRACE\LISTENER.TRC Command runs successfully
View Listener Status:
LSNRCTL > Status is connected to (description= (address= (protocol=tcp) (host=10.74.216.39) (port=1521)) LISTENER STATUS------------------------Alias Listener version number Tnslsnr for 32-bit windows:version 10.2.0.1.0-production Start date 2 June-September-2014 10:35:06 Normal execution time 0 days 0 hours 31 minutes 26 seconds trace level Support security On:password or Local OS authenticationsnmp off listener parameter file E: \oracle\product\10.2.0\db_1\network\admin\listener.ora Listener log File E:\oracle\product\10.2.0\db_1\network\log\ Listener.log Listener trace File E:\ORACLE\PRODUCT\10.2.0\DB_1\NETWORK\TRACE\LISTENER.TRC Listener Endpoint profile ... (Description= (address= (protocol=tcp) (host=10.74.216.39) (port=1521))) (Description= (address= (PROTOCOL=IPC) (PIPENAME=\\.\PIPE\EXTPROC0IPC)) ...
You can see trace file path information in the Listener trace file: E:\oracle\product\10.2.0\db_1\network\trace\listener.trc.
The trace file name can be queried by the following command:
Lsnrctl> show Trc_file is connected to (description= (address= (protocol=tcp) (host=10.74.216.39) (port=1521)) LISTENER parameters "TRC _file "set to LISTENER.TRC command to run successfully
To view the trace level:
Lsnrctl> show Trc_level is connected to (description= (address= (protocol=tcp) (host=10.74.216.39) (port=1521)) LISTENER references " Trc_level "Set as support command to run successfully
Change trace file name:
Lsnrctl> set Trc_file ' Lylistener.trc ' is connected (description= (address= (protocol=tcp) (host=10.74.216.39) (PORT=1521)) LISTENER parameter "Trc_file" set to LYLISTENER.TRC command to run successfully
Note After you change the tracking file name, the trace is closed and needs to be set again (set setting is used here.) and use the same effect as trace):
Lsnrctl> set Trc_level user is connected to (description= (address= (protocol=tcp) (host=10.74.216.39)) port=1521 parameters "Trc_level" is set to the user command to run successfully
Check the Listener status again:
Lsnrctl> status is connected to (description= (address= (protocol=tcp) (host=10.74.216.39) (port=1521)) LISTENER STATUS------------------------alias listener version number Tnslsnr for 32-bit windows:version 10.2.0.1.0-production start date 2 June-September-2014 10:35:06 Normal execution time 2 days 0 hours 8 minutes 3 seconds trace level user security On:password or Local OS authenticationsnmp O FF Listener parameter file E:\oracle\product\10.2.0\db_1\network\admin\listener.ora listener log file E:\oracle\product\10.2.0\ Db_1\network\log\listener.log Listener trace file E:\ORACLE\PRODUCT\10.2.0\DB_1\NETWORK\TRACE\LYLISTENER.TRC Listener Endpoint profile ... (description= (address= (protocol=tcp) (host=10.74.216.39) (port=1521))) (Description= (address= (PROTOCOL=IPC) (PIPENAME=\\.\PIPE\EXTPROC0IPC)) ... Command runs successfully
You can see that the trace file name has changed.
Set password protection for listener
Oracle 10g, Oracle Local user shutdown listener is not required password. The password is set primarily to prevent:
1) Other users of this machine close listener;
2) remotely shut down the listener.
The following is a detailed approach.
Lsnrctl> change_passwordold password:< Enter original password >new password:< enter new password >reenter new password:< password confirmation >
After running successfully you see:
Connecting to (Description= (address= (protocol=tcp) (host=10.74.216.39) (port=1521)) Listener Password changed command ran successfully
Next. You need to save the configuration:
lsnrctl> Save_config is connecting to (description= (address= (protocol=tcp) (host=10.74.216.39) (port=1521)) saved listener configuration parameters. Listener Reference file E:\oracle\product\10.2.0\db_1\network\admin\listener.ora old parameter file E:\oracle\product\10.2.0\db_1\ Network\admin\listener.bak Command Run Achievements
This is your listener configuration password warranty.
Copyright notice: This article Bo Master original article. Blog, not reproduced without consent.
Oracle Listener Lsnrctl