Lsnrctl (Listener control) is a sql*net tool for controlling the database Listener, which provides commands to control the start, stop, and view Listener status of Listener. Change the configuration parameters of listener and so on.
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 modifiers or extended commands with an asterisk (*): Start stop statusservices version reloadsave_config Trace change_passwordquit exit set*show*
Here 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 of the control center;
3) Status: Provides listener state information, including startup time, run time, and trace level;
4) Services: print all available services;
5) Version: print the listener 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 the changes to the current version;
8) Trace: Set 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 of any parameter;
Show: Prints the settings for the current parameter.
LSNRCTL Application Examples
Here are a few examples of lsnrctl usage.
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
At this point you can 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 Tnslsnr for 32-bit windows:version 10.2.0.1.0-production Start date 2 June-September-2014 09:33:40 uptime 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. Routine "Plsextproc", State UNKNOWN, contains 1 handlers for this service ... Command execution succeeded
Here, listener started successfully.
Trace file
The Listener trace file provides us with listener work process information to 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
The following is an explanation of the parameters:
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 Execution succeeded
View Listener Status:
LSNRCTL > Status is connected to (description= (address= (protocol=tcp) (host=10.74.216.39) (port=1521)) LISTENER STATUS------------------------alias Listener version Tnslsnr for 32-bit windows:version 10.2.0.1.0-production Start date 2 June-September-2014 10:35:06 uptime 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.
You can query the trace file name by using 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 as LISTENER.TRC command executed 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 parameters " Trc_level "Set as support command to execute successfully
To modify the 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" is set to LYLISTENER.TRC command execution succeeded
Note After you modify the trace file name, the trace is closed and needs to be reset (using the Set setting and the same effect as with trace):
Lsnrctl> set trc_level user is connecting to (description= (address= (protocol=tcp) (host=10.74.216.39) (port=1521)) LISTENER parameters "Trc_level" is set to successful execution of the user command
Check the listener status again below:
Lsnrctl> status is connected to (description= (address= (protocol=tcp) (host=10.74.216.39) (port=1521)) LISTENER STATUS------------------------alias listener version Tnslsnr for 32-bit windows:version 10.2.0.1.0-production start date 2 June-September-2014 10:35:06 uptime 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 execution succeeded
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, set the password mainly to prevent:
1) Other users of this machine close listener;
2) remotely shut down the listener.
The following are the specific methods.
Lsnrctl> change_passwordold password:< Enter original password >new password:< enter new password >reenter new password:< password confirmation >
After successful execution you see:
Connecting to (Description= (address= (protocol=tcp) (host=10.74.216.39) (port=1521)) Listener Password changed command execution succeeded
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 parameter 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 Execution succeeded
This will set the password protection for your listener.
Oracle Listener Lsnrctl