ORA-12170: TNS:Connect timeout occurred When try to connect from host OS

Etanol picture Etanol · Mar 20, 2015 · Viewed 14.2k times · Source

I have Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production installed on virtual machine(VirtualBox, OS: Oracle Linux 7).

All going normal, when I try to connect from the virtual machine where oracle database installed. (sqlplus sys/[email protected]/XE as sysdba).

But I have ORA-12170 error when I try to connect to oracle from the host OS (Windown 7 x64) by using the same command.

ping 192.168.56.101 command from host OS is successfull.

Now I'm using host only network, but I had same results with bridged connection.

Here is my tnslistener.ora file:

SID_LIST_LISTENER =
 (SID_LIST =
  (SID_DESC =
   (SID_NAME = XE)
   (ORACLE_HOME = /u01/app/oracle/product/11.2.0/xe)
  )
  (SID_DESC =
   (SID_NAME = PLSExtProc)
   (ORACLE_HOME = /u01/app/oracle/product/11.2.0/xe)
   (PROGRAM = extproc)
  )
)

LISTENER =
 (DESCRIPTION_LIST =
  (DESCRIPTION =
   (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
   (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
  )
 )

DEFAULT_SERVICE_LISTENER = (XE)

What am I doing wrong?

Answer

vsmerda picture vsmerda · Oct 16, 2015

It seems your listener is incorrectly configured. If you use localhost.localdomain as HOST then the listener will bind to loopback interface only.

Try to use actual IP address instead of localhost.localdomain. Also you can use 0.0.0.0 as HOST so the listener will bind to any interface to avoid hardcoded IP address, but I don't recommend this on production server.

Also check if your guest firewall does allow TCP communication on 1521 port.

Following is my working listener.ora:

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/xe)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
    )
  )

DEFAULT_SERVICE_LISTENER = (XE)