🧩 How to Fix ORA-12541: TNS: No Listener


🧩 Introduction

The ORA-12541 error occurs when the Oracle client cannot connect to the database because the listener is not running or not reachable. This is a common issue that prevents applications or users from accessing the database. Troubleshooting it quickly is essential to restore database connectivity.


Step 1: Check Listener Status


Run the following command on the server:


lsnrctl status


➡️ This shows whether the listener is running and which services it is listening for.


Step 2: Start the Listener if It’s Down


If the listener is not running, start it with:


lsnrctl start


➡️ This command starts the listener process.


Step 3: Verify Listener Configuration


Check the listener.ora file to ensure the host, port, and service names are correctly defined:


$ORACLE_HOME/network/admin/listener.ora


➡️ Ensure the HOST matches the server hostname or IP and the PORT is correct (default 1521).


Step 4: Check for Firewall or Network Issues


Ensure the database server allows connections on the listener port.


Use telnet <hostname> <port> to test connectivity.


Step 5: Test Database Connection


Once the listener is running, test the connection using SQL*Plus:


sqlplus username/password@//hostname:port/service_name


➡️ Successful connection confirms the issue is resolved.


Conclusion

The ORA-12541 error is usually caused by a stopped listener or misconfigured network settings. By checking listener status, starting it if necessary, and verifying configuration and connectivity, you can quickly resolve this common Oracle database issue.

Comments