Home  >  Article  >  Database  >  [Summary] Reasons and solutions for the oracle monitoring service to fail to start

[Summary] Reasons and solutions for the oracle monitoring service to fail to start

PHPz
PHPzOriginal
2023-04-04 09:25:3913163browse

In recent years, with the rapid development of Internet technology, the application of databases has become more and more widespread. The Oracle database is a widely used database. However, during the use of the Oracle database, various problems will also be encountered. One of the most common problems is that the listening service that starts Oracle cannot be started. This article will detail the causes and solutions to this problem.

1. Cause of the problem

The listening service of Oracle database is a very important component. It is the bridge between the Oracle database instance and the client. If the listening service cannot be started, it will result in the inability to connect to the Oracle database instance. So what is the cause of this problem?

  1. The status of the listening service is wrong: In the Oracle database, the status of the listening service is divided into the following types: starting, stopping and hanging. If the status of the listening service is incorrect, the listening service may fail to start.
  2. Port occupation: The default port used by the Oracle listening service is 1521. If this port is occupied, the Oracle listening service will not start.
  3. TNS name resolution error: TNS is a naming method in Oracle database, which is used to define the address where the client connects to the database. If TNS name resolution is incorrect, the listening service may fail to start.
  4. Listening service configuration error: If there is an error in the configuration file of the listening service, it may also cause the listening service to fail to start.

2. Solution to the problem

After determining the cause of the problem, we need to take corresponding solutions. Below, we will introduce several ways to solve this problem.

Method 1: Check the status of the listening service

First, we need to check the status of the listening service. Under the Windows operating system, you can check the status of the listening service through the following steps:

  1. Open the "Command Prompt" window.
  2. Enter the "lsnrctl status" command and press the "Enter" key.

If you see output similar to the following information, the listening service has been started:

LSNRCTL for 64-bit Windows: Version 11.2.0.2.0 - Production on 08-JAN -2022 22:16:29
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT= 1521)))

STATUS of the LISTENER

Alias ​​LISTENER_VERSION_1
Version TNSLSNR for 64-bit Windows: Version 11.2.0.2.0 - Production
Start Date 28-DEC- 2021 20:18:39
Uptime 11 days 1 hr. 57 min. 50 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File C:\app \oracle\product\11.2.0\dbhome_2\network\admin\listener.ora
Listener Log File C:\app\oracle\diag\tnslsnr\DESKTOP\Test\alert\log.xml
Listening Endpoints Summary ...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Services Summary...
Service "ORCL" has 1 instance( s).
Instance "ORCL", status READY, has 1 handler(s) for this service...
Service "ORCLXDB" has 1 instance(s).
Instance "ORCL", status READY , has 1 handler(s) for this service...
Service "testdb" has 1 instance(s).
Instance "testdb", status READY, has 1 handler(s) for this service...
Service "testxdb" has 1 instance(s).
Instance "testdb", status READY, has 1 handler(s) for this service...
The command completed successfully.

If you see output similar to the following information, the listening service has not been started:

LSNRCTL for 64-bit Windows: Version 11.2.0.2.0 - Production on 08-JAN-2022 22:17:43
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))
TNS -12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
64-bit Windows Error: 61: Unknown error
Solution: If the listening service The status is startup, no operation is required. If the status of the listening service is stopped or suspended, you need to start the listening service.

Under the Windows operating system, you can start the Oracle listening service through the following steps:

  1. Open the "Command Prompt" window.
  2. Enter the "lsnrctl start" command and press the "Enter" key.

Method 2: Check the port occupancy

If the Oracle listening service cannot be started, it may be because the port is occupied. You can check the port occupancy through the following steps:

  1. Open the "Command Prompt" window.
  2. Enter the "netstat -an" command and press the "Enter" key.
  3. Look for the line with port number 1521 in the output information:

TCP 127.0.0.1:1521 0.0.0.0:0           LISTENING

If you see something similar to The above output information indicates that the port is occupied.

Solution: You can release the port through the following steps:

  1. Open the "Command Prompt" window.
  2. Enter the "taskkill /pid [PID] /f" command and press the "Enter" key, where [PID] is the process ID occupying the port. For example, if the process ID is 1234, you can enter the following command:

taskkill /pid 1234 /f

  1. Check the port occupancy again to ensure that the port has been released.

Method 3: Check TNS name resolution

If you see the following output when running the "lsnrctl status" command:

LSNRCTL for 64-bit Windows: Version 11.2.0.2.0 - Production on 08-JAN-2022 22:17:43
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL= TCP)(HOST=127.0.0.1)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
64-bit Windows Error: 61: Unknown error

This may be caused by a TNS name resolution error.

Solution: You can check TNS name resolution by following these steps:

  1. Open the "tnsnames.ora" file of the Oracle client.
  2. Ensure that TNS name resolution is correct. For example, for the following TNS name resolution:

ORCL =
(DESCRIPTION =

(ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
  (SERVER = DEDICATED)
  (SERVICE_NAME = orcl)
)

)

The TNS name here is "ORCL".

Method 4: Check the listening service configuration

If none of the above methods solve the problem, it may be caused by an incorrect configuration of the listening service. You can check the listening service configuration through the following steps:

  1. Open the configuration file of the Oracle listening service (listener.ora file).
  2. Check whether the syntax of the configuration file is correct.
  3. If necessary, the configuration file can be restored from the backup file.

Summary

It is a common problem that the listening service of Oracle cannot be started. There are many reasons for this problem, which may be caused by incorrect status of the listening service, port occupation, TNS name resolution error, or incorrect configuration of the listening service. To solve this problem, you can check the status of the listening service, check the port occupancy, check TNS name resolution, and check the configuration of the listening service. When solving this problem, different approaches are required depending on the specific situation. Through the introduction of this article, I believe that readers can better solve the problem of unable to start the listening service of Oracle.

The above is the detailed content of [Summary] Reasons and solutions for the oracle monitoring service to fail to start. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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