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)
- 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. - 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, runlsnrctl statusagain to confirm. - 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 runsqlplus / as sysdba, thenstartup. You'll see "Database opened." when it's ready. - Set correct environment variables — Sometimes the ORACLE_SID or ORACLE_HOME is wrong. On Windows, check with
echo %ORACLE_SID%andecho %ORACLE_HOME%. They must match your installation. If not, set them permanently:setx ORACLE_SID ORCLandsetx ORACLE_HOME C:\app\oracle\product\19.0.0\dbhome_1(adjust paths to yours). On Linux, edit your.bash_profileor.bashrcand addexport ORACLE_SID=ORCLandexport ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1. Then runsource ~/.bashrc. - 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.logfor specific errors.
Alternative fixes if main steps fail
- Restart the listener — Sometimes a listener is running but stuck. Run
lsnrctl stopthenlsnrctl 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 firewalldthensudo firewall-cmd --list-ports. Oracle uses port 1521 by default. If it's blocked, add it:sudo firewall-cmd --add-port=1521/tcp --permanentthen 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.