Monday, 22 May 2017

TNS-12543: TNS:destination host unreachable

TNS-12543: TNS:destination host unreachable

Ex: I am trying to ping standby database from primary, got the following error.

[oracle@localhost ~]$ tnsping stdby

TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 22-MAY-2017 05:22                                     :39

Copyright (c) 1997, 2013, Oracle.  All rights reserved.

Used parameter files:
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)                                     (HOST = 192.168.92.129)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = stdby)))
TNS-12543: TNS:destination host unreachable

Possible issues:

1. First step to trace this error is to test the host reachability using hostname/IP ping on OS level.

> ping IP/hostname

I am able to ping here, host is reachable, if we get issue here, we need to contact network admin.

2.  Second step is to check listener is running in the remote host to where your are trying to ping, in this scenario remote server is standby.

>lsnrctl status

If listener is not running, just start the listener and check tnsping. In this scenario my listener in standby is running fine, but still i am getting TNS-12543, host unreachable.

3. Third step is to check is SElinux settings, SELINUX should be always disabled as below.

[oracle@localhost ~]$ cat /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

If above setting is showing enforcing, then you need to login as root edit the file /etc/selinux/config and reboot the server.

In my case its disabled, but still issue is not resolved.

4. Now i check the firewall, firewall should be always disabled. use the below steps to disable firewall.

[oracle@localhost ~]$ systemctl status firewalld
â firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2017-05-22 04:23:33 EDT; 1h 1min ago
 Main PID: 604 (firewalld)
   CGroup: /system.slice/firewalld.service
           ââ604 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

In my care firewall is the issue, i disabled as follows, issue got resolved.

[oracle@localhost ~]$ su -
Password:
Last login: Mon May 22 04:12:57 EDT 2017 on pts/2
[root@localhost ~]# systemctl status firewalld
â firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2017-05-22 04:23:33 EDT; 1h 1min ago
 Main PID: 604 (firewalld)
   CGroup: /system.slice/firewalld.service
           ââ604 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

May 22 04:22:55 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
May 22 04:23:33 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
[root@localhost ~]# service firewalld stop
Redirecting to /bin/systemctl stop  firewalld.service
[root@localhost ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
[root@localhost ~]# systemctl status firewalld
â firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)

May 22 04:22:55 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
May 22 04:23:33 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
May 22 05:25:42 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
May 22 05:25:43 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@localhost ~]# exit
logout
[oracle@localhost ~]$ tnsping stdby

TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 22-MAY-2017 05:26:57

Copyright (c) 1997, 2013, Oracle.  All rights reserved.

Used parameter files:
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.92.129)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = stdby)))
OK (0 msec)
[oracle@localhost ~]$

20 comments:

  1. thanks a lot, the firewall daemon was the culprit

    ReplyDelete
  2. Thanks Ramesh .. it is very useful document..

    ReplyDelete
  3. This helped realy !!!

    ReplyDelete
  4. very useful Document, thank you very much Ramesh

    ReplyDelete
  5. Hi I have checked all the above and still the issue persists. Please help

    ReplyDelete
  6. Thanks Ramesh it was worth.

    ReplyDelete
  7. Great article, very methodical, helped me immensely with the firewall

    ReplyDelete
  8. Thanks Ramesh.. Very good document..

    ReplyDelete
  9. Thanks a lot Ramesh very good doc..help me to resolve long pending issue.

    ReplyDelete
  10. We still stuck after all those step as mentioned abkve

    ReplyDelete
    Replies
    1. what is the error you are getting, copy the tnsping result and listener status result

      Delete
  11. This is very useful document. thank you so much.

    ReplyDelete
  12. This is a complete solution. Thanks for your nice contribution.

    ReplyDelete
  13. Thanks awesome doc. After disabling firewall I worked

    ReplyDelete
  14. thank you very much buddy. Such a detailed explanation

    ReplyDelete
  15. Really helped a lot.. thank you

    ReplyDelete
  16. This is the best troubleshooting ever.
    Very helpful. Thanks

    ReplyDelete
  17. Thanks...It is very useful document.

    ReplyDelete
  18. Thank you so much for the solution

    ReplyDelete
  19. Thanks you so much.

    ReplyDelete