1 2 Previous Next 15 Replies Latest reply on Dec 18, 2009 9:39 PM by rgoold

    ORA-12162: TNS:net service name is incorrectly specified

    jjk
      Hello everyone,

      I'm facing below error when I try to connect to my database ver. 10.2.0.4.0 as follows
      sqlplus / as sysdba

      Error
      ORA-12162: TNS:net service name is incorrectly specified


      can anyone tell me what I'm missing ?

      thanks,
      Rossy.Rocs
        • 1. Re: ORA-12162: TNS:net service name is incorrectly specified
          sb92075
          oerr ora 12162
          12162, 00000, "TNS:net service name is incorrectly specified"
          // *Cause:  The connect descriptor corresponding to the net service name in
          // TNSNAMES.ORA or in the directory server (Oracle Internet Directory) is
          // incorrectly specified.
          // *Action: If using local naming make sure there are no syntax errors in
          // the corresponding connect descriptor in the TNSNAMES.ORA file. If using
          // directory naming check the information provided through the administration
          // used for directory naming.
          • 2. Re: ORA-12162: TNS:net service name is incorrectly specified
            jjk
            hi,
            Actually I'm a newbie to oracle administration and I too looked the below mentioned description of the error.

            What I understood from that is that the connect description I'm providing while logging into the database is not the same or not found in my tnsnames.ora file.

            My ORACLE_SID is:
            TCSHDVAS2

            and when I execute tnsping TCSHDVAS2 I get below output.
            *(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = VDB02-vip)(PORT = 1525)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = TCSHDVAS) (INSTANCE_NAME = TCSHDVAS2)))
            OK (0 msec)*

            and I'm able to ping to VDB02-vip.

            confused whether I looking at right place and if yes, what/where to check next.

            thanks,
            Rossy.Rocs

            Edited by: rossy_rocs on Dec 17, 2009 1:14 PM
            • 3. Re: ORA-12162: TNS:net service name is incorrectly specified
              718029
              The error message ORA-12162 "TNS:net service name is incorrectly specified", is very misleading.

              It suggests that there is a problem with the tnsnames.ora file contents, but in reality the message ORA-12162 "TNS:net service name is incorrectly specified" results from improperly setting your ORACLE_SID value.

              To fix this error in Windows, set your $ORACLE_HOME:

              c:> set ORACLE_SID=orcl

              c:> sqlplus "/ as sysdba"

              Try this out...

              Thanks & Regards
              Pratik Lakhpatwala
              Jr Oracle DBA
              • 4. Re: ORA-12162: TNS:net service name is incorrectly specified
                jjk
                Hi Pratik,

                But that's exactly what I've been doing.

                thanks,
                Rossy.Rocs
                • 5. Re: ORA-12162: TNS:net service name is incorrectly specified
                  718029
                  do one thing go to net manager and test the service of your database name see what error it gives if there is no error then

                  set the oracle_home parameter and try starting the database.....

                  or go to the control panel>administrator tool>services> there will be the service name like OracleOraDb10g_home1TNSListener try restarting the service and then see....

                  Thanks & Regards
                  Pratik Lakhpatwala
                  Jr Oracle DBA
                  • 6. Re: ORA-12162: TNS:net service name is incorrectly specified
                    718029
                    did it helped you out... ??


                    Thanks & Regards
                    Pratik Lakhpatwala
                    Jr Oracle DBA
                    • 7. Re: ORA-12162: TNS:net service name is incorrectly specified
                      jjk
                      Hi Pratik,

                      Will try that out and get back with the error (if any)

                      thanks,
                      Rossy.Rocs
                      • 8. Re: ORA-12162: TNS:net service name is incorrectly specified
                        jjk
                        Hi Pratik,
                        Can't access net manager.

                        But I executed lsnrctl to check if listener was working properly and got the below error:
                        Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
                        TNS-12541: TNS:no listener
                        TNS-12560: TNS:protocol adapter error
                        TNS-00511: No listener
                        Linux Error: 111: Connection refused

                        I think this might be the real problem. No LISTENER active. what do you say ?

                        thanks,
                        Rossy.Rocs

                        Edited by: rossy_rocs on Dec 17, 2009 3:00 PM
                        • 9. Re: ORA-12162: TNS:net service name is incorrectly specified
                          718029
                          Try this out...

                          control panel>administrator tool>services> there will be the service name like OracleOraDb10g_home1TNSListener try restarting the service and then see....

                          or else do
                          C:\Documents and Settings\Administrator>lsnrctl stop

                          C:\Documents and Settings\Administrator>lsnrctl start

                          try it out...

                          Edited by: Pratik.L on Dec 17, 2009 1:45 AM
                          • 10. Re: ORA-12162: TNS:net service name is incorrectly specified
                            rgoold
                            I'm not familiar with DB admin on Windows, but could it be that the TWO_TASK variable is set, and pointing to an invalid alias? (or is it the LOCAL variable in Windows?).

                            If either of these is set then you might try unsetting them before running sqlplus / as sysdba
                            • 11. Re: ORA-12162: TNS:net service name is incorrectly specified
                              sb92075
                              I think this might be the real problem. No LISTENER active. what do you say ?
                              Neither SQL*NET nor listener is required to connect to DB when logged directly onto DB server system.

                              Does any type of Operating System virtualization exist on this system.

                              open a command window issue the following command

                              SET

                              post results from SET command
                              • 12. Re: ORA-12162: TNS:net service name is incorrectly specified
                                jjk
                                Actually,
                                I'm using Linux operating systems.
                                The output of set command on my machine is as follows:

                                MAIL=/var/spool/mail/oracle
                                MAILCHECK=600
                                OPTIND=1
                                ORACLE_BASE=/software/ora
                                ORACLE_HOME=/software/ora/oracle/product/10.2.0.1/db
                                ORACLE_SID=TCSHDVAS2
                                PATH=/software/ora/oracle/product/10.2.0.1/db/bin:/usr/lib64/qt-3.3/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/bin:/usr/sbin:/software/ora/oracle/product/10.2.0.1/db/jre/1.4.2/bin:/software/ora/oracle/product/10.2.0.1/db/lib:/software/ora/oracle/product/10.2.0.1/db/lib32:/software/ora/oracle/product/10.2.0.1/db/javavm/admin:/software/ora/oracle/product/10.2.0.1/db/bin:.:/software/ora/oracle/product/10.2.0.1/db/scripts:/software/ora/oracle/product/10.2.0.1/crs/bin:/software/ora/oracle/product/10.2.0.1/db/bin
                                PPID=14392
                                PRELINKING=yes
                                PRELINK_FULL_TIME_INTERVAL=14
                                PRELINK_NONRPM_CHECK_INTERVAL=7
                                PRELINK_OPTS=-mR
                                PS1=$'$machne : $LOGNAME >\n-- > '
                                PS2='> '
                                PS3='#? '
                                PS4='+ '
                                PWD=/software/ora/
                                QTDIR=/usr/lib64/qt-3.3
                                QTINC=/usr/lib64/qt-3.3/include
                                QTLIB=/usr/lib64/qt-3.3/lib
                                RANDOM=19348
                                SECONDS=853.121
                                SHELL=/usr/bin/ksh
                                SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
                                SSH_CLIENT='172.17.44.63 3257 22'
                                SSH_CONNECTION='172.17.44.63 3257 172.17.102.48 22'
                                SSH_TTY=/dev/pts/1
                                TERM=xterm
                                TMOUT=0
                                UID=500
                                USER=oracle
                                _=clear
                                consoletype=pty
                                machne=VMIDB02
                                mpi_selection=''
                                mpi_selector_dir=/var/lib/mpi-selector/data
                                mpi_selector_homefile=/software/ora//.mpi-selector
                                mpi_selector_sysfile=/etc/sysconfig/mpi-selector
                                qt_prefix=/usr/lib64/qt-3.3

                                thanks,
                                Rossy.Rocs
                                • 13. Re: ORA-12162: TNS:net service name is incorrectly specified
                                  sb92075
                                  Does any type of Operating System virtualization exist on this system.

                                  please post results from following:

                                  cat /etc/hosts

                                  Some sort of networking mis-configuration exists
                                  • 14. Re: ORA-12162: TNS:net service name is incorrectly specified
                                    jjk
                                    hi,

                                    The output of host is :
                                    172.17.102.48 VMIDB02
                                    172.17.102.51 VMIDB01-vip
                                    172.17.102.52 VMIDB02-vip
                                    192.168.10.1 VMIDB01-prv
                                    192.168.10.2 VMIDB02-prv
                                    172.17.102.47 VMIDB01

                                    echo $ORACLE_SID gives TCSHDVAS2.

                                    tnsping TCSHDVAS2 gives :
                                    Used TNSNAMES adapter to resolve the alias
                                    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = VMIDB02-vip)(PORT = 1525)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = TCSHDVAS) (INSTANCE_NAME = TCSHDVAS2)))
                                    OK (0 msec)

                                    And also able to ping to VMIDB02-vip host

                                    thanks,
                                    Rossy.Rocs
                                    1 2 Previous Next