Able to access Oracle database by localhost not by IP address

11,955

Solution 1

Your listener.ora entry is incorrect .It should be like the following.

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

To avoid mistakes related to manual edit, use Net manager and add the address from there . Check the following screenshots to make the listener.ora file related changes .

Open Oracle Net Manager

Add IP address to the Listener

Once the changes are done, do not forget to save it from Oracle Net Manager !

Solution 2

you can install Oracle Database on a computer that has a IP addresses. IP address is associated with a host name; you can set up aliases for the host name. By default, Oracle Universal Installer uses the ORACLE_HOSTNAME environment variable setting to find the host name.

To set the ORACLE_HOSTNAME environment variable:

Display System in the Windows Control Panel.

In the System Properties dialog box, click Advanced.

In the Advanced tab, click Environment Variables.

In the Environment Variables dialog box, under System Variables, click New.

In the New System Variable dialog box, enter the following information:

Variable name: ORACLE_HOSTNAME Variable value: The host name of the computer to use. Click OK, then in the Environment Variables dialog box, click OK.

Click OK in the Environment Variables dialog box, then in the System Properties dialog box, click OK.

Ref: https://docs.oracle.com/cd/E11882_01/install.112/e47798/reqs.htm#NTDBI2710

Share:
11,955
Soumen
Author by

Soumen

Updated on June 04, 2022

Comments

  • Soumen
    Soumen almost 2 years

    I have installed Oracle 11g and for test purpose I have connected to the database using an editor( called DBeaver). When host name is provided a localhost ,it connects .But when host name is provided as the IP of the system ,the editor fails to connect and displays following message.

    IO Error: The Network Adapter could not establish the connection
      The Network Adapter could not establish the connection
        java.net.ConnectException: Connection refused: connect
    

    I have tried changing the listener.ora from

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

    to

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

    Here I have replaced localhost with IP i.e. 10.140.0.3. But so far unable to connect it . Can anybody share some experience on this ?