6 Replies Latest reply on Apr 25, 2005 5:51 AM by 442550

    TNS-12203: TNS:unable to connect to destination

      I installed RHEL 3.0, Oracle on a new machine. I created an oracle database CDMDV3, configured and started the listener.

      I could connect to this database from sqlplus when I attempt locally. However when I connect from a remote machine, it gives a TNS 12560: TNS:protocol adapter error.

      [gstream@gsdev ~]$ trcroute CDMDV3

      Trace Route Utility for Linux: Version - Production on 21-APR-2005 19:

      Copyright (c) 1999 Oracle Corporation. All rights reserved.

      Route of TrcRoute:

      Node: Client Time and address of entry into node:
      21-APR-2005 19:58:38 ADDRESS= PROTOCOL=TCP HOST= PORT=1521

      TNS-12203: TNS:unable to connect to destination
      TNS-12560: TNS:protocol adapter error
      TNS-03601: Failed in route information collection

      I checked the listner, tnsnames entries; all seems to be fine. I commented out the sqlnet.ora file as suggested elsewhere. However I couldn't get this to work.

      Here is the portion of information I got in the trace file.

      [14-APR-2005 16:48:40:167] nttcni: entry
      [14-APR-2005 16:48:40:167] nttcni: trying to connect to socket 9.
      [14-APR-2005 16:48:40:168] ntt2err: entry
      [14-APR-2005 16:48:40:168] ntt2err: soc 9 error - operation=1, ntresnt[0]=530, ntresnt[1]=113, ntresnt[2]=0
      [14-APR-2005 16:48:40:168] ntt2err: exit
      [14-APR-2005 16:48:40:168] nttcni: exit
      [14-APR-2005 16:48:40:168] nttcon: exit
      [14-APR-2005 16:48:40:168] nserror: nsres: id=0, op=65, ns=12560, ns2=0; nt[0]=530, nt[1]=113, nt[2]=0; ora[0]=0, ora[1]=0, ora[2]=0
      [14-APR-2005 16:48:40:168] nsopen: unable to open transport
      [14-APR-2005 16:48:40:168] nsmfr: 2268 bytes at 0x811fed0
      [14-APR-2005 16:48:40:168] nsmfr: 508 bytes at 0x811fcd0

      What could be the problem. I could ping to this machine from a remote terminal both by ipaddress and the machine name.


        • 1. Re: TNS-12203: TNS:unable to connect to destination
          Ivan Kartik
          I think this is the server IP (where listener is running):
          If so then try execute this command on client as following:

          telnet 1521

          Now, we've got three options:
          1. Connection refused
          Reason: listener is not running or firewall has rejected our connection
          2. Nothing (connection hung)
          Reason: firewall has droped our connection
          3. Got escape character - connection is available

          To check wheter listener is running execute "lsnrctl stat"
          To stop firewall on Linux login as root and execute following command "/etc/init.d/iptables stop".
          For disbling of FW permanently (will not start during next boot) - execute "setup" and disable iptables in "System services"

          BTW: It's generaly byd ide to check connection via ping or traceroute utilility. Use telnet instead.
          Because ICMP != TCP
          • 2. Re: TNS-12203: TNS:unable to connect to destination
            Hi Alex!
            Supposing that the listener is running on port 1521 this sounds like a firewall issue. You could verify that the firewall supports the Oracle Net (SQL*Net) protocol. If not you could solve this by using shared servers (formally known as MTS). You can determine the port then.

            • 3. Re: TNS-12203: TNS:unable to connect to destination
              Ivan Kartik

              could you explain to me how MTS can solve the situation when firewall does not support SQL*Net?
              • 4. Re: TNS-12203: TNS:unable to connect to destination
                Hi Ivan!
                With MTS (Shared Server) the listener hands over the request to dospatchers. These dispatchers can be registered on static ip ports (eg 5123, 5124, etc). What happens is that with a normal sqlnet connection the server will reopen a connection on a random port. This it what the firewall might not understand. here a little schema:


                client ----> listener on 1521 ----> server process ---> opens random port ----> client

                client ----> listener ----> shared server process on a fixed port ----> communicates via fixed port ----> client

                The only thing that rest is to open the fixed port in the firewall.

                • 5. Re: TNS-12203: TNS:unable to connect to destination
                  Ivan Kartik

                  Yes using DISPATCHERS on static ports will help, when you connecting directly to them (ommiting the listener).
                  But you didn't mentioned about this fact in your previous post.
                  My primary idea was "problem with iptables" ecause many people don't know that default install of RH is starting with iptables which blocking incoming conenctions to port 1521.

                  This it what the firewall might not understand
                  This is not SQL*Net problem (or that FW does not understand SQL*Net) but this is port redirections (FW) problem.

                  • 6. Re: TNS-12203: TNS:unable to connect to destination

                    Thanks very much Ivan & Andreas.

                    Ivan's first reply fixed the problem rightaway.

                    * the connection hung when I telnet to 1521
                    * I stoped firewall (iptables stop)
                    * everthing works just fine now.