Home > Database > Oracle > How to configure the listening program in oracle

How to configure the listening program in oracle

下次还敢
Release: 2024-04-18 22:42:21
Original
617 people have browsed it

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 the listening program in oracle

How to configure a listener in Oracle

Step 1: Check for existing listeners

  • Use the lsnrctl status command to view the currently running listening program.
  • If there are multiple listeners, use the -n option to specify the name of the listener to check.

Step 2: Create the listener (if it does not exist)

  • Create a text file, such as 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>
Copy after login

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.

  • Save the file and copy it to the listener configuration file directory, typically /etc/oracle/<version>/network/admin.

Step 3: Start the listening program

  • Use the following command to start the listening program:
<code>lsnrctl start <listener_name></code>
Copy after login

Where, <listener_name> is the name of the listener program.

Step 4: Check the status of the listener program

  • Use the lsnrctl status command to check the status of the listener program again.
  • If the listener starts successfully, you will see output similar to the following:
<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>
Copy after login

Step 5: Configure the client

  • On the client computer, edit the tnsnames.ora file (usually located at $ORACLE_HOME/network/admin).
  • Add the following entries:
<code><listener_name> =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = <hostname>)(PORT = <port>))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = <service_name>)
    )
  )</code>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template