Oracle 11g – How to Access Database Remotely

oracle-11g-r2

I have oracle database on my computer that i am accessing through a java program using localhost:1521 more precisely using ojdbc7 and host String as "jdbc:oracle:thin:@localhost:1521:orcl". Everything is working fine but now I want to access same database through another computer with different internet connection. I read that I have to change listener.ora file and add ip address where localhost is.

Now I have tried using ip address of my computer which i have set to 192.168.1.5 in network connection and same in listener.ora file and created a virtual server in my router settings and set this same ip address and port there as well. Still when I try to connect to server computer's Internet IP(not 192.168.1.5) it states "TNS:no listener".

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.5)(PORT = 1521))
    )
  )

Firewall is off. I have also tried using 127.0.0.1 and creating virtual server for that in router as well but didn't work. Oracle 11g is installed on both server and client's computer.

I have also tried using 0.0.0.0 ip in listener.ora file so it may listen to all ip's but that didn't work as well.

Can someone point me in the right direction.

Edit: Different internet connection means one is my home internet (ip:39.40.xx.1xx) other is my friends home internet (different ip) we live few miles apart and use same ISP. My computer is acting as server which is using Windows 10. Its firewall is disabled. I am assuming that my friend would use my internet IP address which would be forwarded to my computer (192.168.1.5)

Best Answer

Presuming port forwarding and network items are working as expected (can be checked with telnet host 1521).

Make sure that you restart the listener service.

Also connect to the database from your local machine and run the following commands:

ALTER SYSTEM SET LOCAL_LISTENER = "(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.5)(PORT=1521))";

ALTER SYSTEM REGISTER;

Outside of that it looks good from a listener config side.