- Error code
- ORA-12541
- Product
- Oracle Database
- Versions
- Oracle Database 19c, 21c, 23ai and 26ai (wording differs: see below)
- Category
- Connectivity & Listener
- Last reviewed
- 24 October 2026
On this page
What it means
ORA-12541 means the client reached the host in the connect string, but no Oracle listener was accepting connections on that port (or, for IPC, on that key), so the connection was refused straight away.
An Oracle connection starts at the listener, a separate process (usually on TCP port 1521) that hands new connections to the database. ORA-12541 says there was nobody there: the listener is not running, it listens on a different port or address, or the connect string points at the wrong host. Because the attempt is refused rather than left waiting, the error appears at once; a connection that hangs and then fails is ORA-12170 instead.
Current releases print the host and port the client tried, which you can compare directly with the listener's configuration. Oracle's reference adds two less obvious sources: an IPC connection with no listener for the given key on the local machine, and PL/SQL code using UTL packages whose external server is not listening on the address it was given. The database itself may be perfectly healthy: a running instance does not help if its listener is down.
Common causes
- The listener is not running, for example after a server restart where it was not started automatically, or after someone stopped it.
- The port in the connect string differs from the one the listener uses (for example 1521 against a listener on 1522).
- The connect string names the wrong host, such as localhost from inside a container or a machine that runs no Oracle listener.
- The listener listens only on a different address of the server than the one the client uses.
- An IPC connection uses a KEY that no local listener has configured.
- PL/SQL code using UTL packages connects to an external server that is not listening on that address.
Diagnose it
Read-only These queries only read the data dictionary (USER_, ALL_ and DBA_ views) and dynamic performance views (V$). They do not change data, privileges or settings, so they are safe to run first. DBA_ and V$ views need the matching privileges.
Is the listener running, and where does it listen?
Run on the database server. Add the listener name if it is not the default LISTENER.
lsnrctl status
# a named listener from listener.ora
lsnrctl status LISTENER_SALES A running listener prints its "Listening Endpoints Summary", for example (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sales-server)(PORT=1521))). If it is not running, lsnrctl itself reports a no-listener error stack (TNS-12541 with TNS-00511).
Which address does the client actually use?
tnsping SALESDB "Attempting to contact (DESCRIPTION = ... (HOST = ...)(PORT = ...))" shows the host and port taken from tnsnames.ora. If they do not match an endpoint of lsnrctl status, fix the client entry or the listener.
Check the listener configuration file
listener.ora lives in the TNS_ADMIN directory or ORACLE_HOME/network/admin of the listener's Oracle home; lsnrctl status prints its path as "Listener Parameter File".
cat $ORACLE_HOME/network/admin/listener.ora An entry such as LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = sales-server)(PORT = 1521)))). No file at all means the default listener on port 1521.
Test the TCP port from the client
Oracle's troubleshooting guide asks you to verify basic network connectivity first. A refused port and a timed-out port are different problems.
# Windows PowerShell
Test-NetConnection -ComputerName sales-server -Port 1521
# Linux and macOS
nc -vz sales-server 1521 Refused (TcpTestSucceeded False straight away, or "Connection refused") matches ORA-12541: the host answered but nothing listens on the port. A long wait points to a firewall and ORA-12170.
How to fix it
Each fix is labelled with what it changes. Try read-only checks and the least invasive fix first, and test changes outside production.
Start the listener
Changes database stateStart it as the Oracle software owner on the database server. Once it runs, the database registers its services with it automatically (or immediately after ALTER SYSTEM REGISTER).
Caution: On a server with several Oracle homes, use the lsnrctl of the home that owns the listener. Make sure it starts automatically after a reboot (on Windows the listener is a Windows service).
lsnrctl start
# a named listener from listener.ora
lsnrctl start LISTENER_SALES
Correct the host or port on the client
Client or network sideMake the address in tnsnames.ora or in the Easy Connect string match an endpoint from lsnrctl status.
# tnsnames.ora
SALESDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = sales-server)(PORT = 1522))
(CONNECT_DATA = (SERVICE_NAME = salespdb.example.com))
)
# or Easy Connect
sqlplus shop@//sales-server:1522/salespdb.example.com
Make the listener listen on the address clients use
Changes configurationEdit the ADDRESS in listener.ora so it uses the host name or address that clients connect to, then restart the listener (lsnrctl stop, lsnrctl start). If the port is not 1521, also set LOCAL_LISTENER on the database so it registers with this listener.
Caution: While the listener is down, new connections to every service it handles fail until it is back and the services have registered again; plan the restart for a quiet moment.
Examples
Connecting after a reboot that did not start the listener
Not reproduced here: no Oracle Database is installed for this site. The result shows the message format documented in Oracle's error reference for current releases; the way the host and port are filled in is illustrative. Oracle Database 19c and 21c print "ORA-12541: TNS:no listener".
sqlplus shop@//sales-server:1521/salespdb.example.com
ORA-12541: Cannot connect. No listener at host 192.0.2.56 port 1521.
tnsping finds the alias but no listener behind it
Not reproduced here: no Oracle Database is installed for this site. The output follows Oracle's own example in the Net Services Administrator's Guide (19c), "Checking Valid Net Service Name but No Listener with TNSPING", shortened to the relevant lines. The name resolved, so the problem is the listener, not tnsnames.ora.
tnsping sales
Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = sales-server)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = sales.us.example.com))) TNS-12541: TNS:no listener
How to prevent it
Configure the listener to start with the server (an Oracle Restart or Grid Infrastructure resource, a systemd unit, or an automatic Windows service) and check it with lsnrctl status after every reboot or patch. Monitor the listener port, not only the database.
Keep one documented host name and port per database and use it in every client. If you change the listener port, change LOCAL_LISTENER on the database and the client connect strings in the same change.
Common questions
How do I fix ORA-12541 no listener?
On the database server run lsnrctl status. If the listener is not running, start it with lsnrctl start. If it is running, compare its listening endpoints with the host and port in your connect string and correct whichever is wrong.
The database is up, so why is there no listener?
The listener is a separate process from the database instance. The instance can be open while the listener is stopped, and local connections such as sqlplus / as sysdba still work because they do not use the listener.
What is the difference between ORA-12541 and ORA-12514?
ORA-12541 means nothing is listening at that host and port. ORA-12514 means a listener answered but does not know the service name you asked for, so the address is right and the service is the problem.
Learn more on CodeWithSQL
Official documentation
- ORA-12541 (Oracle Database Error Messages)
- Configuring and administering Oracle Net Listener (Net Services Administrator's Guide 19c)
- Testing connections (Net Services Administrator's Guide 19c)
- Listener Control utility (Net Services Reference 19c)
Last technically reviewed 24 October 2026; examples and diagnostics run on Oracle Database Error Messages reference (26ai, 21c and 19c); not run locally. Messages and explanations follow Oracle's Database Error Messages reference; no Oracle Database was available, so the examples were not run locally.