Skip to content

ORA-12543: TNS Destination Host Unreachable - Fix Network

ORA-12543: TNS Destination Host Unreachable

Section titled “ORA-12543: TNS Destination Host Unreachable”

Error Text: ORA-12543: TNS:destination host unreachable

ORA-12543 indicates that the Oracle TNS layer attempted to establish a TCP/IP connection to the database server but received an ICMP “host unreachable” or “network unreachable” response, or the TCP SYN packet received no response at all. Unlike ORA-12541 (no listener), where a connection reaches the host but finds no listener, ORA-12543 means the TCP packets are not reaching the destination host at all.

This error is a network-layer problem, not an Oracle listener problem. Oracle is correctly interpreting the connection descriptor and attempting to reach the specified host and port — the underlying OS network stack is returning an error before a connection can be established.

1. Incorrect Hostname or IP Address in tnsnames.ora

Section titled “1. Incorrect Hostname or IP Address in tnsnames.ora”
  • Hostname specified in the HOST= parameter does not resolve to the correct IP
  • IP address changed after a server migration but tnsnames.ora was not updated
  • Typo in the hostname (e.g., dbserver vs db-server)
  • A network firewall between the client and the database server is dropping packets on port 1521 (or the configured listener port)
  • Host-based firewall (iptables, firewalld, ufw, Windows Firewall) blocking inbound connections on the listener port
  • Security group rule in a cloud environment (AWS, OCI, Azure) not allowing the source IP
  • The client’s network has no route to the database server’s subnet
  • Static route to the database server’s network was removed
  • VPN tunnel is down and the database is only accessible through VPN
  • The database server OS has crashed or is being rebooted
  • Network interface on the database server is down
  • Database server is in a different VLAN with no inter-VLAN routing configured

5. Listener Hostname Does Not Match Network Configuration

Section titled “5. Listener Hostname Does Not Match Network Configuration”
  • The listener is configured to listen on a specific hostname or IP (HOST= in listener.ora) that is not the server’s active IP
  • Server has multiple network interfaces; the listener is bound to a secondary NIC that is not reachable from the client network
-- What host and port is Oracle trying to reach?
SELECT host FROM dba_db_links WHERE db_link = UPPER('&link_name');
-- (For database link issues)
-- For client connections, check the tnsnames.ora:
-- (OS command from the client)
-- cat $ORACLE_HOME/network/admin/tnsnames.ora
-- or
-- cat $TNS_ADMIN/tnsnames.ora
-- For an existing database link, check its descriptor:
SELECT
db_link,
username,
host
FROM dba_db_links
WHERE db_link = UPPER('&link_name');
-- For all db links — identify those pointing to unreachable hosts:
SELECT
owner,
db_link,
host,
created
FROM dba_db_links
ORDER BY owner, db_link;
Terminal window
# Test basic ICMP reachability (if ICMP is allowed):
ping dbserver.example.com
# Test TCP port reachability on the listener port:
telnet dbserver.example.com 1521
# Expected: Connected (blank screen after connection)
# Actual (ORA-12543): Connection refused or timed out
# More reliable TCP port test:
nc -zv dbserver.example.com 1521
# or on systems without nc:
bash -c 'echo >/dev/tcp/dbserver.example.com/1521' && echo "Port open" || echo "Port closed"
# Traceroute to see where packets stop:
traceroute dbserver.example.com
# or on Windows:
tracert dbserver.example.com

Check Listener Status on the Database Server

Section titled “Check Listener Status on the Database Server”
Terminal window
# Run on the database server:
lsnrctl status LISTENER
# Check what the listener is bound to:
lsnrctl status | grep -i "host\|port\|endpoint"
# Check listener.ora HOST setting:
cat $ORACLE_HOME/network/admin/listener.ora
Terminal window
# Resolve the hostname to confirm the IP is correct:
nslookup dbserver.example.com
# or
host dbserver.example.com
# or
dig dbserver.example.com
# Reverse-lookup the IP the server claims:
nslookup <ip_address>
# On the database server — check what IP it thinks it has:
hostname -I
ip addr show

1. Verify the Hostname and Port in the Connection Descriptor

Section titled “1. Verify the Hostname and Port in the Connection Descriptor”
# Typical tnsnames.ora entry:
PRODDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbserver.example.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = proddb.example.com)
)
)

Confirm:

  • HOST resolves to the correct server IP (nslookup dbserver.example.com)
  • PORT matches the listener port (lsnrctl status on the server)
  • The IP returned by DNS is the same IP the server is actually using

2. Test TCP Connectivity to the Listener Port

Section titled “2. Test TCP Connectivity to the Listener Port”
Terminal window
# From the client host:
nc -zv dbserver.example.com 1521
# If connection is refused → listener is not running on that port
# If connection times out → firewall is blocking the port
# If "no route to host" → routing issue
Terminal window
# Check iptables rules on the database server (run as root):
iptables -L INPUT -n | grep 1521
# Allow port 1521 through iptables:
iptables -I INPUT -p tcp --dport 1521 -j ACCEPT
service iptables save
# For firewalld:
firewall-cmd --permanent --add-port=1521/tcp
firewall-cmd --reload
firewall-cmd --list-ports
Terminal window
# Open the listener port in Windows Firewall:
netsh advfirewall firewall add rule `
name="Oracle Listener" `
dir=in action=allow `
protocol=TCP localport=1521
# Or use the GUI: Windows Defender Firewall → Advanced Settings
# → Inbound Rules → New Rule → Port → TCP → 1521 → Allow
Terminal window
# On the client — check routing table:
ip route show
# or on older Linux:
route -n
# Add a missing static route to the database server's subnet:
ip route add 10.20.30.0/24 via 192.168.1.1 dev eth0
# Make it persistent (RHEL/CentOS):
echo "10.20.30.0/24 via 192.168.1.1" >> /etc/sysconfig/network-scripts/route-eth0

6. Fix Listener Binding to Correct Hostname

Section titled “6. Fix Listener Binding to Correct Hostname”
Terminal window
# Edit listener.ora on the database server:
# Change HOST= to the correct IP or hostname:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = correct-hostname.example.com)(PORT = 1521))
)
)
Terminal window
# Restart the listener:
lsnrctl stop LISTENER
lsnrctl start LISTENER
lsnrctl status LISTENER

7. Update tnsnames.ora With Correct Host Information

Section titled “7. Update tnsnames.ora With Correct Host Information”
Terminal window
# Edit $ORACLE_HOME/network/admin/tnsnames.ora on the client:
# Update HOST= to the new IP or corrected hostname.
# Test after change:
tnsping PRODDB
# Expected: OK (XX msec)

8. Reconnect VPN or Fix Cloud Security Groups

Section titled “8. Reconnect VPN or Fix Cloud Security Groups”
Terminal window
# If access is via VPN:
# Re-establish the VPN tunnel and retest.
# For AWS: Check Security Group inbound rules on the EC2/RDS instance.
# For OCI: Check Security List or NSG rules for port 1521.
# For Azure: Check NSG rules for the listener port.
Section titled “1. Use IP Addresses Instead of Hostnames in tnsnames.ora for Critical Links”
PRODDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.20.30.100)(PORT = 1521))
(CONNECT_DATA = (SERVICE_NAME = proddb.example.com))
)

This avoids DNS resolution failures causing ORA-12543.

2. Configure Connection Timeout and Retry in sqlnet.ora

Section titled “2. Configure Connection Timeout and Retry in sqlnet.ora”
Terminal window
# Edit $TNS_ADMIN/sqlnet.ora:
SQLNET.OUTBOUND_CONNECT_TIMEOUT = 10
SQLNET.EXPIRE_TIME = 10
TCP.CONNECT_TIMEOUT = 10
Terminal window
# Add to a monitoring script (crontab):
lsnrctl status LISTENER > /dev/null 2>&1 || echo "ALERT: Listener down on $(hostname)"

4. Document Firewall Rules in the Network Architecture Runbook

Section titled “4. Document Firewall Rules in the Network Architecture Runbook”
  • Record every firewall rule that permits Oracle listener traffic
  • Include source/destination IP ranges, protocol, and port
  • Review rules during every infrastructure change
Terminal window
# 1. Ping the host:
ping -c 4 dbserver.example.com
# 2. Test the port:
nc -zv dbserver.example.com 1521
# 3. Traceroute to find where packets stop:
traceroute dbserver.example.com
# 4. Confirm listener is running (on the DB server):
lsnrctl status
Terminal window
# Start listener if it is down:
lsnrctl start
# Open port in firewall (Linux):
firewall-cmd --permanent --add-port=1521/tcp && firewall-cmd --reload
Terminal window
# Full TNS ping test:
tnsping PRODDB 5 # 5 attempts
# Attempt SQL*Plus connection:
sqlplus user/password@PRODDB <<< "SELECT 1 FROM dual;"