Configuring a listener in Oracle requires the following steps: Check for existing listeners (use the lsnrctl status command). Create the listener if it does not exist. Start the listener (using the lsnrctl start command). Check the listener status (again, use the lsnrctl status command). Configure the tnsnames.ora file on the client.
How to configure a listener in Oracle
Step 1: Check for existing listeners
lsnrctl status
command to view the currently running listening program. -n
option to specify the name of the listener to check. Step 2: Create the listener (if it does not exist)
listener.ora
, and add the following content: <code>SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = orcl) (ORACLE_HOME = /u01/app/oracle/product/19.0.0.0/dbhome_1) (PROGRAM = *)))</code>
where, orcl
is the SID of the database, /u01/app/oracle/product/19.0.0.0/dbhome_1
Is the Oracle home directory, *
allows all programs to access the listener.
/etc/oracle/<version>/network/admin
. Step 3: Start the listening program
<code>lsnrctl start <listener_name></code>
Where, <listener_name>
is the name of the listener program.
Step 4: Check the status of the listener program
lsnrctl status
command to check the status of the listener program again. <code>LSNRCTL for Linux: Version 12.2.0.1.0 - Production on Wed Apr 20 16:51:32 2023 Copyright (c) 1991, 2017, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version 12.2.0.1.0 Start Date Wed Apr 20 16:51:32 2023 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Default Service orclXDB</code>
Step 5: Configure the client
tnsnames.ora
file (usually located at $ORACLE_HOME/network/admin
). <code><listener_name> = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = <hostname>)(PORT = <port>)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = <service_name>) ) )</code>
Where, <listener_name>
is the name of the listener, <hostname>
is the listener The name of the computer where the program is located, <port>
is the port of the listening program, <service_name>
is the name of the database service to be connected.
The above is the detailed content of How to configure the listening program in oracle. For more information, please follow other related articles on the PHP Chinese website!