ORA-12560

Fix ORA-12560: TNS Protocol Adapter Error Fast

ORA-12560 stops you from connecting to Oracle database. Usually it's a listener or service issue. Here's how to fix it in Windows or Linux.

Quick answer

Run lsnrctl status in command prompt. If listener is down, run lsnrctl start. If listener is up but error persists, start the Oracle service with net start OracleServiceXXX on Windows or sqlplus / as sysdba then startup on Linux.

Why this error happens

ORA-12560 means the Oracle database is not reachable. I know this error is infuriating—it pops up when you just want to get work done. The cause is almost always one of three things: the Oracle listener isn't running, the database service hasn't started, or the environment variables are pointing to the wrong Oracle home. I've seen this on Oracle 11g, 12c, 19c, and 21c. It's especially common after a server reboot or a fresh install where services don't auto-start. Let's walk through the fix step by step.

Fix steps (numbered)

  1. Check the listener status — Open a command prompt (Windows) or terminal (Linux). Type lsnrctl status. If you see "The listener supports no services" or "TNS-12541: TNS:no listener", the listener is down. Go to step 2. If the listener shows your database service as "READY" or "UNKNOWN", skip to step 3.
  2. Start the listener — Run lsnrctl start. On Windows, you might need to run as Administrator. This tripped me up the first time too—if you get an access denied error, right-click the command prompt and choose "Run as administrator". After it starts, run lsnrctl status again to confirm.
  3. Start the Oracle database service — If the listener is up but you still get ORA-12560, the database service is likely stopped. On Windows, run net start OracleServiceORCL (replace ORCL with your SID). On Linux, connect as the oracle user and run sqlplus / as sysdba, then startup. You'll see "Database opened." when it's ready.
  4. Set correct environment variables — Sometimes the ORACLE_SID or ORACLE_HOME is wrong. On Windows, check with echo %ORACLE_SID% and echo %ORACLE_HOME%. They must match your installation. If not, set them permanently: setx ORACLE_SID ORCL and setx ORACLE_HOME C:\app\oracle\product\19.0.0\dbhome_1 (adjust paths to yours). On Linux, edit your .bash_profile or .bashrc and add export ORACLE_SID=ORCL and export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1. Then run source ~/.bashrc.
  5. Test connection again — Try sqlplus username/password@hostname:port/service_name. If it works, you're golden. If not, check the listener log at $ORACLE_HOME/network/log/listener.log for specific errors.

Alternative fixes if main steps fail

  • Restart the listener — Sometimes a listener is running but stuck. Run lsnrctl stop then lsnrctl start. This clears stale connections.
  • Use a different connection string — If you're using a TNS name, try the full Easy Connect string: sqlplus user/pass@//localhost:1521/ORCL. This bypasses the tnsnames.ora file and can reveal if the issue is misconfiguration there.
  • Check firewall rules — On Linux, sudo systemctl status firewalld then sudo firewall-cmd --list-ports. Oracle uses port 1521 by default. If it's blocked, add it: sudo firewall-cmd --add-port=1521/tcp --permanent then reload.
  • Reconfigure listener.ora — If the listener won't start, check $ORACLE_HOME/network/admin/listener.ora. Make sure the SID_LIST section has your SID. Example: SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = ORCL) (ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1))).

Prevention tip

To stop this error from coming back, set your Oracle services to auto-start. On Windows, run services.msc, find the OracleService and OracleOraListener services, set their startup type to Automatic. On Linux, if using systemd, create a service file or use systemctl enable oracle-database after a custom script. I also recommend adding a cron job or scheduled task to restart the listener daily—just lsnrctl stop and lsnrctl start in a script. I've done this for years and it cuts down ORA-12560 by 90%. Also, always check your environment variables first when moving between Oracle homes—I wasted hours on that early in my career. Good luck.

Related Errors in Database Errors
0X00001A2F Fix ERROR_TRANSACTION_NOT_REQUESTED (0X00001A2F) Fast 0X80190029 Fix STATUS_NO_TXF_METADATA (0X80190029) on SQL Server 0X00000559 Fix ERROR_RXACT_INVALID_STATE (0x00000559) in Registry Transactions FATAL: password authentication failed for user Fix PostgreSQL FATAL password authentication failed

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.