Listeners and TNS connections are usually the key for Oracle beginners to understand. However, if there is a problem in the actual configuration process, it will cause the Oracle connection failure. Ben
Listeners and TNS connections are usually the key for Oracle beginners to understand. However, if there is a problem in the actual configuration process, it will cause the Oracle connection failure. Ben
Oracle installation is a complex process. In Linux, AIX, and other operating system versions, the preparation process and time often exceed the installer and the database creation process. In addition, once a configuration item is incorrect, unexpected problems may occur during subsequent Oracle Installation and running.
Listeners and TNS connections are usually the key for Oracle beginners to understand. However, if there is a problem in the actual configuration process, it will cause the Oracle connection failure. This article describes a small fault that a listener cannot start to report an error to the TNS-00517.
1. Problem Description
Test the product and try to install the latest version 11.2.0.4 in the experiment environment. The operating system environment is Red Hat 6.5.
[Oracle @ SimpleLinux ~] $ Uname-r
2.6.32-431. el6.i686
[Oracle @ SimpleLinux ~] $ Cat/etc/RedHat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)
After the database is installed with dbca, no obvious error marks are reported. Check that the database instance is started normally. You can also log on to the instance by operating system verification.
[Oracle @ SimpleLinux ~] $ Ps-ef | grep pmon
Oracle 5851 1 0? 00:00:00 ora_pmon_ora11g
Oracle 11778 11747 0 00:00:00 pts/0 grep pmon
The listener status query is invalid and cannot be started.
[Oracle @ SimpleLinux ~] $ Lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0-Production on 01-APR-2014 12:56:53
Copyright (c) 1991,201 3, Oracle. All rights reserved.
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = SimpleLinux) (PORT = 1521 )))
TNS-12541: TNS: no listener
TNS-12560: TNS: protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521 )))
TNS-12541: TNS: no listener
TNS-12560: TNS: protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
Lsnrctl is a listener platform tool. The status checks the status of the listener program that is running. The listener is not started. Note: Generally, a listener is automatically started after the Oracle database is created. The latest Oracle version runs the listener in the default mode. The TNS_ADMIN directory usually does not contain tnsnames. ora, listener. ora, and sqlnet. ora files.
Start the listener and report an error.
[Oracle @ SimpleLinux ~] $ Lsnrctl start
LSNRCTL for Linux: Version 11.2.0.4.0-Production on 01-APR-2014 12:57:06
Copyright (c) 1991,201 3, Oracle. All rights reserved.
Starting/u01/app/oracle/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.4.0-Production
System parameter file is/u01/app/oracle/network/admin/listener. ora
Log messages written to/u01/app/diag/tnslsnr/SimpleLinux/listener/alert/log. xml
Listening on: (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = SimpleLinux) (PORT = 1521 )))
Listening on: (DESCRIPTION = (ADDRESS = (PROTOCOL = ipc) (KEY = EXTPROC1521 )))
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = SimpleLinux) (PORT = 1521 )))
TNS-12547: TNS: lost contact
TNS-12560: TNS: protocol adapter error
TNS-00517: Lost contact
Linux Error: 104: Connection reset by peer
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521 )))
TNS-12547: TNS: lost contact
TNS-12560: TNS: protocol adapter error
TNS-00517: Lost contact
Linux Error: 104: Connection reset by peer
2. Problem Analysis
Using netca to recreate the listener does not solve the problem. View the listener. ora file as follows:
[Oracle @ SimpleLinux admin] $ cat listener. ora
# Listener. ora Network Configuration File:/u01/app/oracle/network/admin/listener. ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = SimpleLinux) (PORT = 1521 ))
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521 ))
)
)
ADR_BASE_LISTENER =/u01/app
In my previous article "HOST parameter configuration in listener. ora listener" (), I discussed the differences between HOST parameter setting IP addresses and HOST names. If an IP address is set, the listener will only reside on the specified IP address. If the server has multiple IP addresses, other IP addresses cannot be used as listening addresses.
If the hostname is set, Oracle will resolve all IP addresses corresponding to the hostname according to the network configuration and bind them to all IP addresses for connection.
From the host parameter configuration, the most direct method for parsing the specified name SimpleLinux is the/etc/hosts file.
[Oracle @ SimpleLinux admin] $ cat/etc/hosts
127.0.0.1 SimpleLinux. localdomain localhost4 localhost4.localdomain4
: 1 SimpleLinux. localdomain localhost6 localhost6.localdomain6
192.168.0.100 SimpleLinux. localdomain
[Root @ SimpleLinux ~] # Ifconfig-
Eth0 Link encap: Ethernet HWaddr 08: 00: 27: 48: 5C: 18
Inet addr: 192.168.0.100 Bcast: 192.168.0.255 Mask: 255.255.255.0
Inet6 addr: fe80: a00: 27ff: fe48: 5c6/64 Scope: Link
Lo Link encap: Local Loopback
Inet addr: 127.0.0.1 Mask: 255.0.0.0
Inet6 addr: 1/128 Scope: Host
Intuitively, there is no problem. Both monitoring addresses are in the file. The modification of the hosts file is clearer, the path IP address resolution is no problem, and the network connection is no problem.
[Root @ SimpleLinux ~] # Vi/etc/hosts
192.168.0.100 SimpleLinux SimipleLinux. localdomain
127.0.0.1 SimpleLinux. localdomain
: 1 SimpleLinux. localdomain
[Root @ SimpleLinux ~] # Ping SimpleLinux
PING SimpleLinux (192.168.0.100) 56 (84) bytes of data.
64 bytes from SimpleLinux (192.168.0.100): icmp_seq = 1 ttl = 64 time = 0.056 MS
64 bytes from SimpleLinux (192.168.0.100): icmp_seq = 2 ttl = 64 time = 0.138 MS
64 bytes from SimpleLinux (192.168.0.100): icmp_seq = 3 ttl = 64 time = 0.132 MS
Start an attempt.
[Oracle @ SimpleLinux ~] $ Lsnrctl start
LSNRCTL for Linux: Version 11.2.0.4.0-Production on 01-APR-2014 13:09:46
Copyright (c) 1991,201 3, Oracle. All rights reserved.
Starting/u01/app/oracle/bin/tnslsnr: please wait...
(Space reasons, omitted ......)
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = SimpleLinux) (PORT = 1521 )))
TNS-12547: TNS: lost contact
TNS-12560: TNS: protocol adapter error
TNS-00517: Lost contact
Linux Error: 104: Connection reset by peer
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521 )))
TNS-12547: TNS: lost contact
TNS-12560: TNS: protocol adapter error
TNS-00517: Lost contact
Linux Error: 104: Connection reset by peer
If the problem persists, try to discard the hostname and connect directly with the IP address.
[Oracle @ SimpleLinux admin] $ cp listener. ora listener. ora. bk
[Oracle @ SimpleLinux admin] $ vi listener. ora
# Listener. ora Network Configuration File:/u01/app/oracle/network/admin/listener. ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1521 ))
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521 ))
)
)
Start the attempt and the fault persists.
[Oracle @ SimpleLinux admin] $ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.4.0-Production on 01-APR-2014 13:11:10
Copyright (c) 1991,201 3, Oracle. All rights reserved.
Starting/u01/app/oracle/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.4.0-Production
System parameter file is/u01/app/oracle/network/admin/listener. ora
Log messages written to/u01/app/diag/tnslsnr/SimpleLinux/listener/alert/log. xml
Listening on: (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = 127.0.0.1) (PORT = 1521 )))
Listening on:
TNS-12547: TNS: lost contact
TNS-12560: TNS: protocol adapter error
TNS-00517: Lost contact
Linux Error: 104: Connection reset by peer
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521 )))
TNS-12547: TNS: lost contact
TNS-12560: TNS: protocol adapter error
TNS-00517: Lost contact
Linux Error: 104: Connection reset by peer
For more details, please continue to read the highlights on the next page: