1 2 Previous Next 20 Replies Latest reply: Oct 9, 2012 9:50 AM by EdStevens RSS

    Changin from IPs to hostnames in tnsnames and listener heads to TNS-12541

    David de Vega
      Hello.

      In order to prevent problems and extrawork in future with planned IP changes, i want to change the tnsnames and listener.ora server configuration files.
      Now they are using the IP in the HOST parameter, and I want to use the hostname. But it doesnt works:
      TNSNAMES.ORA:
      ----------------------
      
      VCSBD =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = tcp)(HOST = 62.37.231.78)(PORT = 1524))
          (CONNECT_DATA =
            (SERVER = DEDICATED)
            (SERVICE_NAME = vcsbd)
          )
        )
      
      
      LISTENER.ORA:
      --------------------
      
      LISTENER_VCSBD=
              (ADDRESS_LIST=
                      (ADDRESS=
                              (PROTOCOL=tcp)
                              (HOST=62.37.231.78)
                              (PORT=1524)
                      )
                      (ADDRESS=
                              (PROTOCOL=ipc)
                              (KEY=vcsbd)
                      )
              )
      
      SID_LIST_LISTENER_VCSBD=
              (SID_LIST=
                      (SID_DESC=
                              (GLOBAL_DBNAME=vcsbd)
                              (SID_NAME=vcsbd)
                              (SERVICE_NAME=vcsbd)
                              (ORACLE_HOME=/usr/oracle/product/11.2.0)
                      )
              )
      
      
      
      TESTING: -- 
      
      $ tnsping vcsbd
      
      TNS Ping Utility for Linux: Version 11.2.0.2.0 - Production on 05-OCT-2012 13:32:30
      
      Copyright (c) 1997, 2010, Oracle.  All rights reserved.
      
      Archivos de parámetros utilizados:
      /usr/oracle/product/11.2.0/network/admin/sqlnet.ora
      
      
      Adaptador TNSNAMES utilizado para resolver el alias
      Intentando contactar con (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp)(HOST = 62.37.231.78)(PORT = 1524)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = vcsbd)))
      Realizado correctamente (0 mseg)
      I want to change the HOST parameter to server hostname, in order to make oracle resolve the hostname from the /etc/hosts.
      But wen I change it, I get TNS-12541 errors when tnsping. Ping works, but tnsping not.

      updating TNSNAMES:
      -----------------------------
      
      VCSBD =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = tcp)(HOST = servervcs)(PORT = 1524))
          (CONNECT_DATA =
            (SERVER = DEDICATED)
            (SERVICE_NAME = vcsbd)
          )
        )
      
      updating LISTENER.ORA
      ---------------------------------
      
      LISTENER_VCSBD=
              (ADDRESS_LIST=
                      (ADDRESS=
                              (PROTOCOL=tcp)
                              (HOST=servervcs)
                              (PORT=1524)
                      )
                      (ADDRESS=
                              (PROTOCOL=ipc)
                              (KEY=vcsbd)
                      )
              )
      
      SID_LIST_LISTENER_VCSBD=
              (SID_LIST=
                      (SID_DESC=
                              (GLOBAL_DBNAME=vcsbd)
                              (SID_NAME=vcsbd)
                              (SERVICE_NAME=vcsbd)
                              (ORACLE_HOME=/usr/oracle/product/11.2.0)
                      )
              )
      
      
      
      TESTING: ---
      
      
      $ cat /etc/hosts:
      # Do not remove the following line, or various programs
      # that require network functionality will fail.
      127.0.0.1               servervcs localhost.localdomain localhost
      62.37.231.78            servervcs
      #62.37.231.68           servervcs
      ::1             localhost6.localdomain6 localhost6
      
      
      
      $ lsnrctl reload LISTENER_VCSBD
      
      LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 05-OCT-2012 13:37:05
      
      Copyright (c) 1991, 2010, Oracle.  All rights reserved.
      
      Conectándose a (ADDRESS=(PROTOCOL=tcp)(HOST=servervcs)(PORT=1524))
      TNS-12541: TNS:no hay ningún listener
       TNS-12560: TNS:error del adaptador de protocolo
        TNS-00511: No hay ningún listener
         Linux Error: 111: Connection refused
      Conectándose a (ADDRESS=(PROTOCOL=ipc)(KEY=vcsbd))
      El comando ha terminado correctamente
      
      
      
      $ lsnrctl status LISTENER_VCSBD
      
      LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 05-OCT-2012 13:37:12
      
      Copyright (c) 1991, 2010, Oracle.  All rights reserved.
      
      Conectándose a (ADDRESS=(PROTOCOL=tcp)(HOST=servervcs)(PORT=1524))
      TNS-12541: TNS:no hay ningún listener
       TNS-12560: TNS:error del adaptador de protocolo
        TNS-00511: No hay ningún listener
         Linux Error: 111: Connection refused
      Conectándose a (ADDRESS=(PROTOCOL=ipc)(KEY=vcsbd))
      LISTENER STATUS
      ------------------------
      Alias                     LISTENER_VCSBD
      Versión                   TNSLSNR for Linux: Version 11.2.0.2.0 - Production
      Fecha de Inicio       28-MAY-2012 12:04:16
      Tiempo Actividad   130 días 1 hr. 32 min. 56 seg.
      Nivel de Rastreo        off
      Seguridad               ON: Local OS Authentication
      SNMP                      OFF
      Parámetros del Listener   /usr/oracle/product/11.2.0/network/admin/listener.ora
      Log del Listener          /usr/oracle/diag/tnslsnr/efacturaES-BD1/listener_vcsbd/alert/log.xml
      Recibiendo Resumen de Puntos Finales...
        (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=62.37.231.78)(PORT=1524)))
        (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=vcsbd)))
      Resumen de Servicios...
      El servicio "vcsbd" tiene 2 instancia(s).
        La instancia "vcsbd", con estado UNKNOWN, tiene 1 manejador(es) para este servicio...
        La instancia "vcsbd", con estado READY, tiene 1 manejador(es) para este servicio...
      El servicio "vcsbdXDB" tiene 1 instancia(s).
        La instancia "vcsbd", con estado READY, tiene 1 manejador(es) para este servicio...
      El comando ha terminado correctamente
      
      
      
      $ ping servervcs
      PING servervcs (127.0.0.1) 56(84) bytes of data.
      64 bytes from servervcs (127.0.0.1): icmp_seq=1 ttl=64 time=0.017 ms
      64 bytes from servervcs (127.0.0.1): icmp_seq=2 ttl=64 time=0.013 ms
      
      --- servervcs ping statistics ---
      2 packets transmitted, 2 received, 0% packet loss, time 999ms
      rtt min/avg/max/mdev = 0.013/0.015/0.017/0.002 ms
      
      
      
      $ tnsping vcsbd
      
      TNS Ping Utility for Linux: Version 11.2.0.2.0 - Production on 05-OCT-2012 13:32:33
      
      Copyright (c) 1997, 2010, Oracle.  All rights reserved.
      
      Archivos de parámetros utilizados:
      /usr/oracle/product/11.2.0/network/admin/sqlnet.ora
      
      
      Adaptador TNSNAMES utilizado para resolver el alias
      Intentando contactar con (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp)(HOST = servervcs)(PORT = 1524)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = vcsbd)))
      TNS-12541: TNS:no hay ningún listener
      Any clue?
      what i'm doing wrong? what did I forget?

      Regards

      Edited by: elvegaa_esp on 05-oct-2012 4:48
        • 1. Re: Changin from IPs to hostnames in tnsnames and listener heads to TNS-12541
          Shivananda Rao
          $ ping servervcs
          PING servervcs (127.0.0.1) 56(84) bytes of data.
          64 bytes from servervcs (127.0.0.1): icmp_seq=1 ttl=64 time=0.017 ms
          64 bytes from servervcs (127.0.0.1): icmp_seq=2 ttl=64 time=0.013 ms
          TESTING: ---


          $ cat /etc/hosts:
          # Do not remove the following line, or various programs
          # that require network functionality will fail.
          127.0.0.1 servervcs localhost.localdomain localhost
          62.37.231.78 servervcs
          #62.37.231.68 servervcs
          ::1 localhost6.localdomain6 localhost6
          Crosscheck the IP. Your ping command shows the IP of servervcs as 127.0.0.1 (localhost) and the /etc/hosts file shows multiple IPs assigned to servervcs
          • 2. Re: Changin from IPs to hostnames in tnsnames and listener heads to TNS-12541
            EdStevens
            elvegaa_esp wrote:
            Hello.

            In order to prevent problems and extrawork in future with planned IP changes, i want to change the tnsnames and listener.ora server configuration files.
            Now they are using the IP in the HOST parameter, and I want to use the hostname. But it doesnt works:

            <snip>
            >
            >
            $ cat /etc/hosts:
            # Do not remove the following line, or various programs
            # that require network functionality will fail.
            127.0.0.1 servervcs localhost.localdomain localhost
            62.37.231.78 servervcs
            #62.37.231.68 servervcs
            ::1 localhost6.localdomain6 localhost6
            <snip>

            BZZZTTT!

            so what IP do you want 'servervcs' to resolve to? It should only occur ONCE in your hosts file, and NOT on ip 127.0.0.1.
            • 3. Re: Changin from IPs to hostnames in tnsnames and listener heads to TNS-12541
              Osama_Mustafa
              $ cat /etc/hosts:
              # Do not remove the following line, or various programs
              # that require network functionality will fail.
              127.0.0.1               servervcs localhost.localdomain localhost
              62.37.231.78            servervcs
              #62.37.231.68           servervcs
              ::1             localhost6.localdomain6 localhost6
              Why you set servervcs to 127.0.0.1 ??? Fix this problem as guys told you and try again !!!!!

              Read this
              http://docs.oracle.com/cd/E19089-01/n1.sysmgr12/819-4141/gafub/index.html
              • 4. Re: Changin from IPs to hostnames in tnsnames and listener heads to TNS-12541
                David de Vega
                'servervcs' its the localhost.

                I didn't configure this server. I wonder why the last DBA or system administrator did this.
                But i'm seeing that other server has the same /etc/hosts configuration, plus having the hostname in the HOST parameter, and works fine. I think i'm missing something.

                This is the other server 'aoc-bd1':
                AOC-BD1$ cat /etc/hosts
                # Do not remove the following line, or various programs
                # that require network functionality will fail.
                127.0.0.1               AOC-BD1  localhost.localdomain localhost 
                192.168.76.8            AOC-BD1 localhost.localdomain localhost 
                And in its TNSNAMES and LISTENER the host parameter is 'AOC-BD1', and it works.
                • 5. Re: Changin from IPs to hostnames in tnsnames and listener heads to TNS-12541
                  sb92075
                  for some loose definition of "works"
                  • 7. Re: Changin from IPs to hostnames in tnsnames and listener heads to TNS-12541
                    David de Vega
                    Sure
                    $ echo $HOSTNAME
                    AOC-BD1
                    
                    $ /sbin/ifconfig
                    eth0      Link encap:Ethernet  HWaddr **:**:**:**:**:**
                              inet addr:192.168.76.8  Bcast:192.168.76.255  Mask:255.255.255.0
                              inet6 addr: fe80::221:85ff:fe35:74c/64 Scope:Link
                              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
                              RX packets:281062361 errors:0 dropped:0 overruns:0 frame:0
                              TX packets:68084207 errors:0 dropped:0 overruns:0 carrier:0
                              collisions:0 txqueuelen:1000
                              RX bytes:1817935227 (1.6 GiB)  TX bytes:3856945523 (3.5 GiB)
                              Base address:0x3000 Memory:dfb40000-dfb60000
                    
                    eth0:1    Link encap:Ethernet  HWaddr **:**:**:**:**:**
                              inet addr:192.168.76.10  Bcast:192.168.76.255  Mask:255.255.255.0
                              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
                              Base address:0x3000 Memory:dfb40000-dfb60000
                    
                    lo        Link encap:Local Loopback
                              inet addr:127.0.0.1  Mask:255.0.0.0
                              inet6 addr: ::1/128 Scope:Host
                              UP LOOPBACK RUNNING  MTU:16436  Metric:1
                              RX packets:210984342 errors:0 dropped:0 overruns:0 frame:0
                              TX packets:210984342 errors:0 dropped:0 overruns:0 carrier:0
                              collisions:0 txqueuelen:0
                              RX bytes:3935512631 (3.6 GiB)  TX bytes:3935512631 (3.6 GiB)
                    
                    $ cat /etc/hosts
                    # Do not remove the following line, or various programs
                    # that require network functionality will fail.
                    127.0.0.1               AOC-BD1 localhost.localdomain 
                    192.168.76.8            AOC-BD1 localhost.localdomain 
                    
                    $ cat /usr/oracle/product/10.2.0/network/admin/tnsnames.ora
                    AOC-BD1_AOCPROD_HN=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=AOC-BD1)(Port=1521)))(CONNECT_DATA=(service_name=aoc-bd1_aocprod)(INSTANCE_NAME=aocprod)(SID=aocprod)))
                    
                    $ cat /usr/oracle/product/10.2.0/network/admin/listener.ora
                    listener_aoc-bd1_aocprod=
                       (ADDRESS_LIST=
                          (ADDRESS=
                              (PROTOCOL=tcp)
                              (HOST=AOC-BD1)
                              (PORT=1521)
                          )
                         (ADDRESS=
                              (PROTOCOL=ipc)
                              (KEY=aoc)
                          )
                       )
                    SID_LIST_listener_aoc-bd1_aocprod=
                       (SID_LIST=
                          (SID_DESC=
                               (GLOBAL_DBNAME=aoc-bd1_aocprod)
                               (SID_NAME=aocprod)
                               (SERVICE_NAME=aocprod)
                               (ORACLE_HOME=/usr/oracle/product/10.2.0)
                          )
                         )
                    STARTUP_WAIT_TIME_listener_aoc-bd1_aocprod=0
                    CONNECT_TIMEOUT_listener_aoc-bd1_aocprod=0
                    
                    
                    $ lsnrctl status listener_aoc-bd1_aocprod
                    
                    LSNRCTL for Linux: Version 10.2.0.3.0 - Production on 08-OCT-2012 13:20:17
                    
                    Copyright (c) 1991, 2006, Oracle.  All rights reserved.
                    
                    Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=AOC-BD1)(PORT=1521))
                    STATUS of the LISTENER
                    ------------------------
                    Alias                     listener_aoc-bd1_aocprod
                    Version                   TNSLSNR for Linux: Version 10.2.0.3.0 - Production
                    Start Date                17-DEC-2011 09:49:05
                    Uptime                    248 days 13 hr. 13 min. 56 sec
                    Trace Level               off
                    Security                  ON: Local OS Authentication
                    SNMP                      OFF
                    Listener Parameter File   /usr/oracle/product/10.2.0/network/admin/listener.ora
                    Listener Log File         /usr/oracle/product/10.2.0/network/log/listener_aoc-bd1_aocprod.log
                    Listening Endpoints Summary...
                      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=AOC-BD1)(PORT=1521)))
                      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=aoc)))
                    Services Summary...
                    Service "aoc-bd1_aocprod" has 1 instance(s).
                      Instance "aocprod", status UNKNOWN, has 1 handler(s) for this service...
                    Service "aocprod" has 1 instance(s).
                      Instance "aocprod", status READY, has 1 handler(s) for this service...
                    Service "aocprodXDB" has 1 instance(s).
                      Instance "aocprod", status READY, has 1 handler(s) for this service...
                    Service "aocprod_XPT" has 1 instance(s).
                      Instance "aocprod", status READY, has 1 handler(s) for this service...
                    The command completed successfully
                    
                    
                    $ tnsping AOC-BD1_AOCPROD_HN
                    
                    TNS Ping Utility for Linux: Version 10.2.0.3.0 - Production on 08-OCT-2012 13:20:37
                    
                    Copyright (c) 1997, 2006, Oracle.  All rights reserved.
                    
                    Used parameter files:
                    
                    
                    Used TNSNAMES adapter to resolve the alias
                    Attempting to contact (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=AOC-BD1)(Port=1521)))(CONNECT_DATA=(service_name=aoc-bd1_aocprod)(INSTANCE_NAME=aocprod)(SID=aocprod)))
                    OK (0 msec)
                    • 8. Re: Changin from IPs to hostnames in tnsnames and listener heads to TNS-12541
                      sb92075
                      ping AOC-BD1

                      what does above do?
                      show using COPY & PASTE
                      • 9. Re: Changin from IPs to hostnames in tnsnames and listener heads to TNS-12541
                        David de Vega
                        loopback
                         
                        $ ping AOC-BD1
                        PING AOC-BD1 (127.0.0.1) 56(84) bytes of data.
                        64 bytes from AOC-BD1 (127.0.0.1): icmp_seq=0 ttl=64 time=0.024 ms
                        64 bytes from AOC-BD1 (127.0.0.1): icmp_seq=1 ttl=64 time=0.014 ms
                        64 bytes from AOC-BD1 (127.0.0.1): icmp_seq=2 ttl=64 time=0.013 ms
                        64 bytes from AOC-BD1 (127.0.0.1): icmp_seq=3 ttl=64 time=0.013 ms
                        
                        --- AOC-BD1 ping statistics ---
                        4 packets transmitted, 4 received, 0% packet loss, time 2999ms
                        rtt min/avg/max/mdev = 0.013/0.016/0.024/0.004 ms, pipe 2
                        • 10. Re: Changin from IPs to hostnames in tnsnames and listener heads to TNS-12541
                          David de Vega
                          loopback
                           
                          $ ping AOC-BD1
                          PING AOC-BD1 (127.0.0.1) 56(84) bytes of data.
                          64 bytes from AOC-BD1 (127.0.0.1): icmp_seq=0 ttl=64 time=0.024 ms
                          64 bytes from AOC-BD1 (127.0.0.1): icmp_seq=1 ttl=64 time=0.014 ms
                          64 bytes from AOC-BD1 (127.0.0.1): icmp_seq=2 ttl=64 time=0.013 ms
                          64 bytes from AOC-BD1 (127.0.0.1): icmp_seq=3 ttl=64 time=0.013 ms
                          
                          --- AOC-BD1 ping statistics ---
                          4 packets transmitted, 4 received, 0% packet loss, time 2999ms
                          rtt min/avg/max/mdev = 0.013/0.016/0.024/0.004 ms, pipe 2
                          • 11. Re: Changin from IPs to hostnames in tnsnames and listener heads to TNS-12541
                            David de Vega
                            loopback
                             
                            $ ping AOC-BD1
                            PING AOC-BD1 (127.0.0.1) 56(84) bytes of data.
                            64 bytes from AOC-BD1 (127.0.0.1): icmp_seq=0 ttl=64 time=0.024 ms
                            64 bytes from AOC-BD1 (127.0.0.1): icmp_seq=1 ttl=64 time=0.014 ms
                            64 bytes from AOC-BD1 (127.0.0.1): icmp_seq=2 ttl=64 time=0.013 ms
                            64 bytes from AOC-BD1 (127.0.0.1): icmp_seq=3 ttl=64 time=0.013 ms
                            
                            --- AOC-BD1 ping statistics ---
                            4 packets transmitted, 4 received, 0% packet loss, time 2999ms
                            rtt min/avg/max/mdev = 0.013/0.016/0.024/0.004 ms, pipe 2
                            • 12. Re: Changin from IPs to hostnames in tnsnames and listener heads to TNS-12541
                              sb92075
                              elvegaa_esp wrote:
                              loopback
                               
                              $ ping AOC-BD1
                              PING AOC-BD1 (127.0.0.1) 56(84) bytes of data.
                              64 bytes from AOC-BD1 (127.0.0.1): icmp_seq=0 ttl=64 time=0.024 ms
                              64 bytes from AOC-BD1 (127.0.0.1): icmp_seq=1 ttl=64 time=0.014 ms
                              64 bytes from AOC-BD1 (127.0.0.1): icmp_seq=2 ttl=64 time=0.013 ms
                              64 bytes from AOC-BD1 (127.0.0.1): icmp_seq=3 ttl=64 time=0.013 ms
                              
                              --- AOC-BD1 ping statistics ---
                              4 packets transmitted, 4 received, 0% packet loss, time 2999ms
                              rtt min/avg/max/mdev = 0.013/0.016/0.024/0.004 ms, pipe 2
                              no remote client can ever connect to system listening on 127.0.0.1
                              • 13. Re: Changin from IPs to hostnames in tnsnames and listener heads to TNS-12541
                                Osama_Mustafa
                                its using loop back Ip which is wrong .
                                • 14. Re: Changin from IPs to hostnames in tnsnames and listener heads to TNS-12541
                                  David de Vega
                                  no remote client can ever connect to system listening on 127.0.0.1
                                  C:\oracle\product\10.2.0\client_1\BIN>tnsping AOC-BD1
                                  
                                  TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 08-OCT-2012 18:23:16
                                  
                                  Copyright (c) 1997, 2005, Oracle.  All rights reserved.
                                  
                                  Archivos de parßmetros utilizados:
                                  C:\oracle\product\10.2.0\client_1\network\admin\sqlnet.ora
                                  
                                  
                                  Adaptador TNSNAMES utilizado para resolver el alias
                                  Attempting to contact (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=192.168.76.8)(Port=152
                                  1)))(CONNECT_DATA=(SID=aocprod)))
                                  Realizado correctamente (20 mseg)
                                  It's a production DB. All remote clients can connect with no problem, and there is no other listener running.
                                  I saw this configuration in some other servers. They work too, so this can't be the source of the problem.
                                  1 2 Previous Next