One of the errors that defeats a lot of new users who install the Oracle Database on the Windows operating system is a two-step event. The first step occurs when you try to connect to the database and it raises the following error:
SQL*Plus: Release 18.0.0.0.0 - Production on Fri Jan 7 21:00:42 2022 Version 18.4.0.0.0 Copyright (c) 1982, 2018, Oracle. All rights reserved. ERROR: ORA-12541: TNS:no listener
The second step may occur after you get the “no listener” error when you try to start the Oracle listener and it fails to start. The Oracle listener control command is:
When it returns the following error:
LSNRCTL FOR 64-bit Windows: Version 18.0.0.0.0 - Production ON 07-JAN-2022 21:02:20 Copyright (c) 1991, 2018, Oracle. ALL rights reserved. Starting tnslsnr: please wait... Unable TO OpenSCManager: err=5 TNS-12560: TNS:protocol adapter error TNS-00530: Protocol adapter error
The problem is generally in two configuration files. They are the listener.ora and tnsnames.ora files. This typically occurs when the developer fails to set the localhost in the Windows operating system hosts configuration file. The chain of events that causes these errors can be avoided when the user puts the following two lines:
127.0.0.1 localhost ::1 localhost
in the following hosts file:
C:Windowssystem32driversetchosts
You can typically avoid these errors when you configure the hosts configuration file correctly before installing the Oracle Database. That’s because the Oracle database installation will use localhost keyword instead of the current, and typically DHCP assigned, IP address.
The loss of connectivity errors typically occur when the IP address changes after the installation. DHCP IP addresses often change as machines disconnect and reconnect to a network.
You can fix a DHCP IP installation of an Oracle database by editing the listener.ora and tnsnames.ora files. You replace the IP addresses with the localhost keyword.
The listener.ora and tnsnames.ora files look like the following for an Oracle Database 21c Express Edition (provided you installed them in a C:appusername directory:
listener.ora
# listener.ora Network Configuration File: C:appusernameproduct21.0.0dbhomeXENETWORKADMINlistener.ora # Generated by Oracle configuration tools. DEFAULT_SERVICE_LISTENER = XE SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = CLRExtProc) (ORACLE_HOME = C:appusernameproduct21.0.0dbhomeXE) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:C:appusernameproduct21.0.0dbhomeXEbinoraclr21.dll") ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) )
tnsnames.ora
# tnsnames.ora Network Configuration File: C:appmclaughlinmproduct21.0.0dbhomeXENETWORKADMINtnsnames.ora # Generated by Oracle configuration tools. XE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE) ) ) LISTENER_XE = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) ORACLR_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) (CONNECT_DATA = (SID = CLRExtProc) (PRESENTATION = RO) ) )
As always, I hope this helps those looking for a solution to something that can take more time than it should to fix.
Fiddling around with new software on my Windows 8 machine, I tried to start the listener service but got the following response in a command window:
c:> lsnrctl start
LSNRCTL for 64-bit Windows: Version 12.1.0.2.0 – Production on 07-DEC-2015 10:29:14
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Starting tnslsnr: please wait..
Unable to OpenSCManager: err=5
TNS-12560: TNS:protocol adapter error
TNS-00530: Protocol adapter error
The workaround for this, and/or the cause, is that your not the owner for the Oracle Windows software. Because the new software install magically removed my Listener Windows Service, I also couldn’t start the Listener process via the Windows Service Manager program. To get it back, that is start the listener and create the appropriate correct Listener service where the ownership matches the oracle software (& database instances), you will have to create a command (.cmd) or batch (.bat) file with something along the lines of…
lsnrctl start
pause
After executing this file via “Run as Administrator“, you will be asked the password for the user that owns the software, in my case “oracledb”
C:Windowssystem32>lsnrctl start
LSNRCTL for 64-bit Windows: Version 12.1.0.2.0 – Production on 07-DEC-2015 10:34:01
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Starting tnslsnr: please wait…
Enter oracledb’s password :
TNSLSNR for 64-bit Windows: Version 12.1.0.2.0 – Production
Log messages written to C:Oracledatabasediagtnslsnr8s98y52listeneralertlog.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=8s98y52)(PORT=1521)))Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 12.1.0.2.0 – Production
Start Date 07-DEC-2015 10:34:13
Uptime 0 days 0 hr. 0 min. 8 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File C:Oracledatabasediagtnslsnr8s98y52listeneralertlog.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=8s98y52)(PORT=1521)))
The listener supports no services
The command completed successfullyC:Windowssystem32>pause
Press any key to continue . . .
If you check, the listener service will be created.
My Windows Service panel showed afterwards
HTH/M
I am getting the following errors while from the lsnrctl status
command:
C:Userspna105>lsnrctl stat
LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 08-OCT-2014 17:53
:55
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
64-bit Windows Error: 2: No such file or directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
64-bit Windows Error: 61: Unknown error
It was working fine before restart but now it is not working and I also can’t access my Oracle homepage.
My tnsnames.ora
is:
ORACLE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = Localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORACLE)
)
)
LISTENER_ORACLE =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
My listener.ora
is: (Here were error due to brackets misplaced adding few spaces resolved the problem TNS-12518)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = ORACLE)
(ORACLE_HOME = C:appPNA105product11.2.0dbhome_1)
)
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:appPNA105product11.2.0dbhome_1)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:appPNA105product11.2.0dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:appPNA105product11.2.0dbhome_1binoraclr11.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
ADR_BASE_LISTENER = C:appPNA105
Following is the output of lsnrctl start
command
C:Userspna105>lsnrctl start
LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 08-OCT-2014 18:26
:22
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Starting tnslsnr: please wait...
TNS-12560: TNS:protocol adapter error
TNS-00530: Protocol adapter error
Following is the Last entry needed from log file.
Started with pid=14784
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\.pipeEXTPROC1521ipc)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Listener completed notification to CRS on start
09-OCT-2014 15:46:01 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=__jdbc__)(USER=INL007306$))
(SERVICE_NAME=oracle)) * (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=57389)) *
establish * oracle * 12518
TNS-12518: TNS:listener could not hand off client connection
TNS-12560: TNS:protocol adapter error
TNS-00530: Protocol adapter error
64-bit Windows Error: 203: Unknown error
Dynamic address is already listened on (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)
(HOST=127.0.0.1)(PORT=1521)))
09-OCT-2014 15:46:06 * service_register * oracle * 0
Thu Oct 09 15:46:11 2014
09-OCT-2014 15:46:11 * service_update * oracle * 0
09-OCT-2014 15:46:12 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=__jdbc__)(USER=INL007306$))
(SERVICE_NAME=oracle)) * (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=57393)) *
establish * oracle * 0
09-OCT-2014 15:46:12 * service_update * oracle * 0
09-OCT-2014 15:46:13 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=__jdbc__)(USER=INL007306$))
(SERVICE_NAME=oracle)) * (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=57394)) *
establish * oracle * 0
Tried to resolve TNS-12518 and listener started but still not able to access
Oracle home page
output of lnsrctl stat
C:Userspna105>lsnrctl stat
LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 09-OCT-2014 17:16
:56
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Produ
ction
Start Date 09-OCT-2014 15:45:58
Uptime 0 days 1 hr. 30 min. 58 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File C:appPNA105product11.2.0dbhome_1networkadminli
stener.ora
Listener Log File c:apppna105diagtnslsnrINL007306listeneralertlo
g.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\.pipeEXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "ORACLE" has 2 instance(s).
Instance "ORACLE", status UNKNOWN, has 1 handler(s) for this service...
Instance "oracle", status READY, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "oracleXDB" has 1 instance(s).
Instance "oracle", status READY, has 1 handler(s) for this service...
T he command completed successfully
Fiddling around with new software on my Windows 8 machine, I tried to start the listener service but got the following response in a command window:
c:> lsnrctl start
LSNRCTL for 64-bit Windows: Version 12.1.0.2.0 – Production on 07-DEC-2015 10:29:14
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Starting tnslsnr: please wait..
Unable to OpenSCManager: err=5
TNS-12560: TNS:protocol adapter error
TNS-00530: Protocol adapter error
The workaround for this, and/or the cause, is that your not the owner for the Oracle Windows software. Because the new software install magically removed my Listener Windows Service, I also couldn’t start the Listener process via the Windows Service Manager program. To get it back, that is start the listener and create the appropriate correct Listener service where the ownership matches the oracle software (& database instances), you will have to create a command (.cmd) or batch (.bat) file with something along the lines of…
lsnrctl start
pause
After executing this file via “Run as Administrator“, you will be asked the password for the user that owns the software, in my case “oracledb”
C:Windowssystem32>lsnrctl start
LSNRCTL for 64-bit Windows: Version 12.1.0.2.0 – Production on 07-DEC-2015 10:34:01
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Starting tnslsnr: please wait…
Enter oracledb’s password :
TNSLSNR for 64-bit Windows: Version 12.1.0.2.0 – Production
Log messages written to C:Oracledatabasediagtnslsnr8s98y52listeneralertlog.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=8s98y52)(PORT=1521)))Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 12.1.0.2.0 – Production
Start Date 07-DEC-2015 10:34:13
Uptime 0 days 0 hr. 0 min. 8 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File C:Oracledatabasediagtnslsnr8s98y52listeneralertlog.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=8s98y52)(PORT=1521)))
The listener supports no services
The command completed successfullyC:Windowssystem32>pause
Press any key to continue . . .
If you check, the listener service will be created.