This discussion is archived
10 Replies Latest reply: Sep 3, 2013 8:17 AM by Dude! RSS

Oracle Database Server and Clients: localhost.localdomain with 127.0.0.1 issue

user8860348 Explorer
Currently Being Moderated

Folks,

 

Hello. I installed Oracle Database Server 11gR2 in the Operating System Oracle Linux 5. All clients (NetCA, DBCA, SOL Deveoper, SQL Plus ...) run on Database Server correctly. The listener LISTENER is listening on the Client Tools in Linux successfully.

 

I also installed Oracle Database 11gR2 Client (SQL Developer, NetMgr, NetCA, sqlplus, ...) in Windows XP. Both Linux and Windows XP are VMs on the top of Host OS Windows 7.

 

In order for the Client Tools in Windows XP to login into the Database Server in Linux, both Linux and Windows XP need to be configured into a Network. I have configured the 3 machines as below:

 

Windows 7 IP address : 192.168.196.1

Windows XP IP address : 192.168.196.101

Oracle Linux 5 IP address : 192.168.196.102

 

The 3 machines can ping each other successfully. Windows XP Oracle Database Client Tools can login into Linux Oracle Database Server successfully.

 

But some strange network connection issues usually happen. The thing is that when I installed the Operating System Oracle Linux 5, its default host name is "localhost.localdomain" and default IP address is 127.0.0.1. Now, its IP address has been configured as 192.168.196.102 but its host name remain as "localhost.localdomain". The hard-coded relationship "localhost.localdomain and 127.0.0.1" is breaked down and causes problems. I don't know how to give a new hostname for the new IP address 192.168.196.102 in Linux.

 

My question is:

After change Linux default IP address 127.0.0.1 into 192.168.196.102, how to change its default hostname "localhost.localdomain" into a new hostname ?

  

Thanks in advance.

  • 1. Re: Oracle Database Server and Clients: localhost.localdomain with 127.0.0.1 issue
    sybrand_b Guru
    Currently Being Moderated

    Question is, as with most questions in this forum, a result of ignorance and unwillingness to follow documentation.

    Question about changing the Linux hostname  has nothing to with Oracle *database* and doesn't belong here.

    Oracle questions belong in the *installation* forum, not here.

    Please close your question here and move them to the appropriate forum.

     

    --------------

    Sybrand Bakker

    Senior Oracle DBA

  • 2. Re: Oracle Database Server and Clients: localhost.localdomain with 127.0.0.1 issue
    EdStevens Guru
    Currently Being Moderated

    user8860348 wrote:

     

    Folks,

     

    Hello. I installed Oracle Database Server 11gR2 in the Operating System Oracle Linux 5. All clients (NetCA, DBCA, SOL Deveoper, SQL Plus ...) run on Database Server correctly. The listener LISTENER is listening on the Client Tools in Linux successfully.

     

    I also installed Oracle Database 11gR2 Client (SQL Developer, NetMgr, NetCA, sqlplus, ...) in Windows XP. Both Linux and Windows XP are VMs on the top of Host OS Windows 7.

     

    In order for the Client Tools in Windows XP to login into the Database Server in Linux, both Linux and Windows XP need to be configured into a Network. I have configured the 3 machines as below:

     

    Windows 7 IP address : 192.168.196.1

    Windows XP IP address : 192.168.196.101

    Oracle Linux 5 IP address : 192.168.196.102

     

    The 3 machines can ping each other successfully. Windows XP Oracle Database Client Tools can login into Linux Oracle Database Server successfully.

     

    But some strange network connection issues usually happen. The thing is that when I installed the Operating System Oracle Linux 5, its default host name is "localhost.localdomain" and default IP address is 127.0.0.1. Now, its IP address has been configured as 192.168.196.102 but its host name remain as "localhost.localdomain". The hard-coded relationship "localhost.localdomain and 127.0.0.1" is breaked down and causes problems. I don't know how to give a new hostname for the new IP address 192.168.196.102 in Linux.

     

    My question is:

    After change Linux default IP address 127.0.0.1 into 192.168.196.102, how to change its default hostname "localhost.localdomain" into a new hostname ?

       

    Thanks in advance.

     

    The /etc/hosts file should have TWO entries.

    The first is the same as it should be for all computers:

     

    127.0.0.1  localhost.localdomain  localhost

     

    The second should be the one that associates the actual host name to its actual IP address:

     

    192.168.196.102    myhostname.mydomain    myhostname

  • 3. Re: Oracle Database Server and Clients: localhost.localdomain with 127.0.0.1 issue
    WadhahDAOUEHI Journeyer
    Currently Being Moderated

    Hi,

    To change the hostname, edit the file /etc/sysconfig/network

     

    # vi /etc/sysconfig/network
    NETWORKING_IPV6=no
    NETWORKING=yes
    HOSTNAME=myhostname.localdomain

     

    Then reboot your server.

    Finally, edit the hosts file:

     

    # vi /etc/hosts
    127.0.0.1               localhost.localdomain localhost
    192.168.196.102 myhostname.localdoman myhostname  


    I hope this can help you

    Best Regards

  • 4. Re: Oracle Database Server and Clients: localhost.localdomain with 127.0.0.1 issue
    UserAL1178M Explorer
    Currently Being Moderated

    An easy way is to use hostname command. Hostname new_name

  • 5. Re: Oracle Database Server and Clients: localhost.localdomain with 127.0.0.1 issue
    WadhahDAOUEHI Journeyer
    Currently Being Moderated

    Hi,

    The command hostname can change the host name, but it didn't remain saved after reboot.

     

    Best Regards

  • 6. Re: Oracle Database Server and Clients: localhost.localdomain with 127.0.0.1 issue
    UserAL1178M Explorer
    Currently Being Moderated

    How to change hostname on Linux/OEL

     

    Open file /etc/sysconfig/network  using editor like vi , nano or ed

    Change entry HOSTNAME=XXXXXX to HOSTNAME=New_Host_Name

    Restart xinetd service or reboot Linux/OEL

    Restart xinetd service xinetd restart

    Reboot Linux reboot

    If you have defined hostname resolution in hosts file then change entry in /etc/hosts

  • 7. Re: Oracle Database Server and Clients: localhost.localdomain with 127.0.0.1 issue
    user8860348 Explorer
    Currently Being Moderated

    Folks,

     

    Hello. Thanks a lot for replying. The issue is solved.

  • 8. Re: Oracle Database Server and Clients: localhost.localdomain with 127.0.0.1 issue
    Dude! Guru
    Currently Being Moderated

    127.0.0.1 is not a default IP address but the loopback adapter. It is essential for several functions and must not be removed. This IP address cannot be used in the IP network as it cannot be routed.

     

    By default, when you install Enterprise Linux, your computer hostname is also on the same line as the localhost entry. This is because a machine may have a hostname, but not necessarily an IP Address, or the IP address could also be dynamic in case of DHCP.

     

    Note that several Oracle installers use the first entry it finds in /etc/hosts as the hostname for the Oracle database, unless you define the ORACLE_HOSTNAME environment variable. Removing the hostname from the 127.0.0.1 line may therefore break things like Oracle DBCONSOLE or listener configurations. I personally recommend to put the hostname in the localhost line as well as creating a new line with the actual IP address, although the later is not really necessary. For instance:

     

    127.0.0.1               myhostname.localdoman myhostname  localhost.localdomain localhost 

    192.168.196.102   myhostname.localdoman myhostname  

  • 9. Re: Oracle Database Server and Clients: localhost.localdomain with 127.0.0.1 issue
    EdStevens Guru
    Currently Being Moderated

    Dude wrote:

     

    127.0.0.1 is not a default IP address but the loopback adapter. It is essential for several functions and must not be removed. This IP address cannot be used in the IP network as it cannot be routed.

     

    By default, when you install Enterprise Linux, your computer hostname is also on the same line as the localhost entry. This is because a machine may have a hostname, but not necessarily an IP Address, or the IP address could also be dynamic in case of DHCP.

     

    Note that several Oracle installers use the first entry it finds in /etc/hosts as the hostname for the Oracle database, unless you define the ORACLE_HOSTNAME environment variable. Removing the hostname from the 127.0.0.1 line may therefore break things like Oracle DBCONSOLE or listener configurations. I personally recommend to put the hostname in the localhost line as well as creating a new line with the actual IP address, although the later is not really necessary. For instance:

     

    127.0.0.1               myhostname.localdoman myhostname  localhost.localdomain localhost

    192.168.196.102   myhostname.localdoman myhostname 

    Interesting.

    So if a client process references 'myhostname', how does the name resolution process know which ip address to use?

  • 10. Re: Oracle Database Server and Clients: localhost.localdomain with 127.0.0.1 issue
    Dude! Guru
    Currently Being Moderated

    It will use any IP address you specify, or when using a hostname, it uses the first match it finds in /etc/hosts, which is 127.0.0.1, if configured accordingly. The "external" IP address defined in /etc/hosts example is just for reference purpose.

     

    Access to any TCP/IP service is usually done by specifying the hostname.domainname 127.0.0.1 will always work to address the local system. The hostname and domainname of a machine does usually not change, but the IP address may, e.g. DHCP. When mapping the hostname of the local machine to anything else than localhost, the /etc/hosts file needs to be maintained. Using localhost for any local connection is predictable and safe and avoids Firewall issues.

     

    I cannot think of any advantage to use the external TCP/IP address to talk to the local host itself. If you need to test the external IP on the local host, you can use the IP address directly.

     

    The /etc/hosts file does simply map a name to an IP for the local host only. It does not do any DNS round robin and is not used by any DNS tools for reverse name lookup. Other tools like getent however can use any type of data configured in nsswitch.conf, including /etc/hosts.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points