ORA-12545: Connect Failed Because Target Host or Object Does Not Exist
ORA-12545 is a network-level Oracle error that occurs when the client cannot reach the specified host or service defined in the TNS connection string. This typically means the hostname is unresolvable, the listener is down, or the network path is blocked. It is one of the most common connectivity issues faced by Oracle DBAs and developers alike.
Top 3 Causes and Fixes
Cause 1: Incorrect HOST Entry in tnsnames.ora
The most frequent culprit is a wrong hostname or IP address in the tnsnames.ora file. This often happens after server migrations, IP changes, or simple typos.
Quick Diagnosis — test with EZConnect syntax to bypass tnsnames:
-- Test direct connection using IP (bypasses tnsnames.ora)
-- sqlplus username/password@//192.168.1.100:1521/ORCL
-- After connecting, verify your server-side network parameters
SELECT NAME, VALUE
FROM V$PARAMETER
WHERE NAME IN ('service_names', 'local_listener', 'db_name');
-- Check registered services on the server
SELECT NAME, NETWORK_NAME, ENABLED
FROM V$SERVICES
ORDER BY NAME;
Fix: Update the HOST value in tnsnames.ora to the correct IP or resolvable hostname and retest.
Cause 2: DNS Resolution Failure or Firewall Blocking Port 1521
If the client cannot resolve the hostname to an IP address, or if a firewall is blocking TCP port 1521, ORA-12545 will be thrown. Always validate DNS resolution and port reachability before diving into Oracle config files.
-- After a successful connection, use UTL_INADDR to validate DNS from DB side
SELECT UTL_INADDR.GET_HOST_ADDRESS('your-db-hostname') AS RESOLVED_IP
FROM DUAL;
-- Reverse lookup: IP to hostname
SELECT UTL_INADDR.GET_HOST_NAME('192.168.1.100') AS RESOLVED_HOST
FROM DUAL;
-- Confirm current session network context
SELECT SYS_CONTEXT('USERENV', 'IP_ADDRESS') AS CLIENT_IP,
SYS_CONTEXT('USERENV', 'SERVER_HOST') AS SERVER_HOST,
SYS_CONTEXT('USERENV', 'SERVICE_NAME') AS SERVICE_NAME
FROM DUAL;
Fix: Work with your network team to ensure port 1521 (or your custom listener port) is open, and add a static entry to /etc/hosts as a temporary workaround if DNS is the issue.
Cause 3: Oracle Listener Is Down or Misconfigured
If the listener is stopped or bound to a different IP/port than what the client expects, the connection will fail with ORA-12545.
-- OS-level listener check (run in terminal, not SQL)
-- lsnrctl status
-- lsnrctl start
-- Force dynamic service re-registration from within the DB
ALTER SYSTEM REGISTER;
-- Verify listener parameter settings
SHOW PARAMETER LOCAL_LISTENER;
-- Set local_listener explicitly if needed
ALTER SYSTEM SET LOCAL_LISTENER =
'(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.100)(PORT=1521))'
SCOPE = BOTH;
-- Check active user sessions to confirm listener is serving connections
SELECT COUNT(*) AS ACTIVE_SESSIONS,
STATUS
FROM V$SESSION
WHERE TYPE = 'USER'
GROUP BY STATUS;
Fix: Start the listener with lsnrctl start, then run ALTER SYSTEM REGISTER; to force Oracle to re-register services with the listener.
Quick Fix Checklist
-
Ping the host — confirm basic network reachability (
ping db-hostname). -
Test the port — use
telnet db-hostname 1521ornc -zv db-hostname 1521. - Check tnsnames.ora — confirm HOST, PORT, and SERVICE_NAME are correct.
-
Verify listener status — run
lsnrctl statuson the database server. -
Try EZConnect — use
sqlplus user/pass@//IP:PORT/SERVICEto isolate tnsnames issues.
Prevention Tips
Centralize TNS Configuration
Avoid managing individual tnsnames.ora files on each client machine. Use Oracle LDAP (OID/OUD) or a shared network path to distribute a single authoritative tnsnames.ora. This eliminates drift between client configurations and reduces human error significantly.
Automate Listener Health Monitoring
Set up automated health checks using a simple connectivity test query scheduled via cron or your monitoring platform (e.g., OEM, Zabbix, Datadog):
-- Lightweight health check query for monitoring automation
SELECT 'DB_ALIVE' AS STATUS,
SYSDATE AS CHECKED_AT,
SYS_CONTEXT('USERENV', 'DB_NAME') AS DATABASE_NAME,
SYS_CONTEXT('USERENV', 'SERVER_HOST') AS HOST
FROM DUAL;
Also ensure the Oracle Listener is registered as an OS service (systemd on Linux, Windows Service) so it automatically restarts after a server reboot.
Related Errors
| Error Code | Description |
|---|---|
| ORA-12541 | TNS: No Listener — Listener process is not running |
| ORA-12154 | TNS alias not found in tnsnames.ora |
| ORA-12170 | TNS: Connect timeout — host exists but not responding |
| ORA-12535 | TNS: Operation timed out — network latency issue |
| ORA-01034 | ORACLE not available — instance is down despite listener running |
📖 Want a more detailed guide?
Check out the full in-depth version (Korean) on oraerror.com — includes detailed analysis, additional SQL examples, and prevention tips.
Top comments (0)