Skip to content
ohsudo, Home
Databases

Oracle "ORA-12541: no listener": start it, or connect to the address it really uses

Fix Oracle ORA-12541 "TNS:no listener" (or "Cannot connect. No listener at host"): start it with lsnrctl, check the host and port, listener.ora, firewalls and Docker.

Beginner4 min readApplies to Oracle Database 12c+ · Oracle 19c · Oracle 23ai · SQL*Plus · SQL Developer

by OhSudo ··

Checked on real software: Oracle Database 23ai Free · November 2026How we check

Not sure this is your cause?Find it step by step: Can't connect to the database →

ORA-12541: TNS:no listener

Oracle 23 is more direct about it:

ORA-12541: Cannot connect. No listener at host 10.0.0.5 port 1521.

The listener is a separate process that accepts connections and passes them on to the database. Your client found the address, and nothing is listening on that port there. That means the database itself may be fine. It’s the same idea as “connection refused”.

  1. Clientconnects to 10.0.0.5:1521
  2. Listenernot running there(breaks here)
  3. Databasemaybe fine, never reached
The listener is a separate process that accepts connections for the database. Your client found the address, and nothing listens on that port: the database itself may be fine.

TL;DR

On the database server:

Terminal window
lsnrctl status
lsnrctl start
ss -tlnp | grep 1521

From the client, compare what you’re connecting to:

Terminal window
nc -vz 10.0.0.5 1521
tnsping MYDB

1. Is it running?

On the database server, as the oracle user, with its environment set:

Terminal window
lsnrctl status

If it says this, it just isn’t started:

TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Terminal window
lsnrctl start

On Windows, it’s a service with a name like OracleOraDB19Home1TNSListener:

Terminal window
Get-Service *TNSListener*
Start-Service OracleOraDB19Home1TNSListener

After a reboot, it may not have started by itself, so set the service to automatic. On Linux, a systemd unit or dbstart usually handles it.

2. Did it start, and did it stay up?

Run lsnrctl status again, and read two things:

Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver01)(PORT=1521)))
Services Summary...
Service "ORCLPDB1" has 1 instance(s).
Instance "ORCL", status READY, has 1 handler(s) for this service...

The endpoint shows where it listens, and that has to match what the client uses. If it won’t start, the message usually says why:

Message Means
TNS-12545 or TNS-00515 with Name or service not known The HOST in listener.ora doesn’t resolve on this machine
TNS-12542, Address already in use Something else holds the port: see Address already in use
TNS-01201: Listener cannot find executable ORACLE_HOME is wrong

3. Check listener.ora

It’s in $ORACLE_HOME/network/admin/:

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
)
)

HOST is a usual suspect. If it’s localhost or 127.0.0.1, it only accepts local connections, and if it’s an old name or address after a server move, the listener can’t bind. Use the machine’s real name or address, or 0.0.0.0. Then restart:

Terminal window
lsnrctl stop
lsnrctl start

If the name isn’t in DNS, add it to /etc/hosts.

4. Is the client connecting to the right place?

Maybe the listener’s fine, and the client’s going somewhere else. Check its address:

Terminal window
tnsping MYDB
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.0.5)(PORT = 1521)) ...)
TNS-12541: TNS:no listener

Compare HOST and PORT with what the server’s listener shows. Non-default ports are often the cause: the alias in tnsnames.ora still says 1521 while the listener moved. An easy connect string takes tnsnames.ora out of the question:

Terminal window
sqlplus app@//10.0.0.5:1521/ORCLPDB1

Connecting to the wrong machine gives this too, particularly after a failover or a move. If the alias itself can’t be found, you’d get ORA-12154 instead.

5. Is it the network?

A firewall that rejects gives this error, and one that drops gives ORA-12170: TNS:Connect timeout occurred instead. Test from the client:

Terminal window
nc -vz 10.0.0.5 1521
Terminal window
Test-NetConnection 10.0.0.5 -Port 1521

On the server, open it only to the machines that need it:

Terminal window
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.0.0.20" port port="1521" protocol="tcp" accept'
sudo firewall-cmd --reload

In the cloud, check the security group too. The Port Lookup has an entry for 1521: it shouldn’t be open to everyone. “Connection timed out” vs “Connection refused” explains the two failures.

6. Docker

Inside a container, localhost is that container, so use the service name. And to connect from your machine, the port has to be published:

Terminal window
docker run -d --name ora -p 127.0.0.1:1521:1521 -e ORACLE_PASSWORD=change-me gvenzl/oracle-free:23-slim
docker logs -f ora

Oracle takes a while to start, so wait for DATABASE IS READY TO USE!. Connecting before then gives this error, or ORA-12514. See connecting to localhost from a container.

7. It’s up, but the database isn’t registered

Now the listener answers, and you get the next error:

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

This is progress, as the listener works, and the service isn’t registered with it. The database registers itself within a minute of starting. To check and force it:

SHOW PARAMETER service_names;
SHOW PARAMETER local_listener;
ALTER SYSTEM REGISTER;

If the database is down, start it, and check lsnrctl status again. If local_listener has a wrong address or port, the database can’t find the listener, as with a non-default port.

Warning

Don’t publish 1521 on a public address to get past this. Connect through a VPN or an SSH tunnel: ssh -L 1521:127.0.0.1:1521 me@10.0.0.5, then use localhost:1521.

Shell, we have a problem!

Similar, but different: ORA-12154 means the alias isn’t found, on the client. ORA-12514 means the listener works, but doesn’t know that service. ORA-12170 is a timeout, usually a firewall. ORA-01034: ORACLE not available means you reached it, and the database instance is down. And once you’re in, a missing table is ORA-00942.

Found this useful? Share it.

Found a mistake? Let us know at contact@ohsudo.com.

Tools

Try it yourself

Articles

Related articles