2

I can connect to my oracle database using localhost:1521. However, connecting to the IP address does not work.

I'm trying to do this because I am trying to connect to my database using another machine, but even the same machine cannot connect to itself using it's own IP Address.

Note: Oracle Database 11g and Windows 7.

Magellan
  • 4,431
  • 3
  • 29
  • 53
Franz See
  • 189
  • 2
  • 5
  • 10
  • See if there is anything listening on the standard Oracle Database port: sudo netstat --tcp --udp --listening --program | grep 1521 – Wesley Apr 26 '12 at 03:25

3 Answers3

5

You need to enable the instance listener to be listening on an IP address, not just localhost. Go to the Net Services Administration page on the Oracle Enterprise Manager web interface. Edit the listener (LISTENER_localhost) and add a listener and select to use the IP address of the instance. Keep port 1521 as per default. You will be asked if you want to restart the service. Please do so. Then you should be able to connect from your host (or any other machine for that matter).

Wesley
  • 32,320
  • 9
  • 80
  • 116
  • Thanks! I tried to edit the `listener.ora` by hand and it was terrible. But the Net Manager was quite easy. However, I used the Windows program, not the web application since I didn't know the password for it (as I'm writing this, it sounds like a joke, but I'm serious...). – Thomas Uhrig Dec 02 '14 at 14:18
3

You have to make sure that the listener is using 0.0.0.0:1521. You can check this on Windows with: netstat -an -p tcp |find ":1521"

Mircea Vutcovici
  • 16,706
  • 4
  • 52
  • 80
  • Its listening on port 1521, 0.0.0.0:1521 but when I connect it says: An error occurred while establishing the connection: Long Message: The Network Adapter could not establish the connection Details:    Type: java.sql.SQLException    Error Code: 20    SQL State: 61000 – digz6666 Jul 18 '14 at 05:37
0

I had this problem after doing a database software only install. I found I had to open a port on the server in question and also the listener wasnt running to start with. To get it going I just went into lsnrctl (command line) and used the command start.

Because the listener had been started after the instance, the instance had missed its chance to register automatically. To fix this I just restarted the instance.

This can be done by using the sqlplus command line. You will need to login as a user with SYSDBA priveledges (eg system) syntax:

sqlplus name/pass as SYSDBA

then run 'shutdown' and wait for it to finish. then run 'startup' and wait for it to finish.

fingers crossed you should now have an instance registered with the listener and the listener listening on an open port.

To check that the instance is registered with the listener you can go back into lsnrctl and run the command 'status'. if it hasnt worked you'll see the message 'The listener supports no services'

JonnyRaa
  • 101
  • 1