Tns name Not Found

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NewToOracle
    New Member
    • Feb 2009
    • 15

    Tns name Not Found

    Hi,

    I am new To Oracle.When I am trying to log in Sql* Plus , There It is asking for the USername And Password,I Put that Information .After that it ask me Host string.. What should I Put there.When I put there 127.0.0.1 it says "Tns name Not found". what is the concept of Tns what does it represents.

    I found the same error when i try to login in PLSQL developer to do my work.

    Can anyone help me.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    You need to verify that the credentials you are providing match the ones in the tnsnames.ora file in your oracle directory. If you have the SQL Net Easy Configuration wizard then run it to correct and verify your configuration.

    Comment

    • madankarmukta
      Contributor
      • Apr 2008
      • 308

      #3
      Originally posted by r035198x
      You need to verify that the credentials you are providing match the ones in the tnsnames.ora file in your oracle directory. If you have the SQL Net Easy Configuration wizard then run it to correct and verify your configuration.
      Then what does the host string represents ..?

      Comment

      • NewToOracle
        New Member
        • Feb 2009
        • 15

        #4
        Originally posted by madankarmukta
        Then what does the host string represents ..?
        Hi All,

        Thanks for the time you gave to resolve my question .

        Anyways madankarmukta,
        I am asking Hoststring in the context when we try to login in sql* plus .

        Comment

        • debasisdas
          Recognized Expert Expert
          • Dec 2006
          • 8119

          #5
          host string is the name of the database that you are trying to connect. If you have not specified any other name the default name would be ORCL. If the DB is installed on your pc you need not specify the HOST STRING.

          Comment

          • NewToOracle
            New Member
            • Feb 2009
            • 15

            #6
            Originally posted by debasisdas
            host string is the name of the database that you are trying to connect. If you have not specified any other name the default name would be ORCL. If the DB is installed on your pc you need not specify the HOST STRING.
            Okay.. SO the host string is basically the IP address of the machine where the database is installed..Plea se correct me If I am going wrong.

            It means if the oraganizantion is having a shared machine with the Db instyalled on it and the one acting as a oracle server , then while accessing database we need to specify that IP in the host string for login in sql* plus which in turn need to specify in tns.ora file.

            Please correct me If I am getting wrong.

            Comment

            • debasisdas
              Recognized Expert Expert
              • Dec 2006
              • 8119

              #7
              you need the name of the database not the IP address of the system.

              Comment

              • chaarmann
                Recognized Expert Contributor
                • Nov 2007
                • 785

                #8
                Originally posted by madankarmukta
                Then what does the host string represents ..?
                It represents the host-name, the port number and the database name (= SID, =ServiceID). It can also contain additional non-mandatory parameters.
                You can give it directly or you just give a single name as reference.
                This single name then is looked up in the tnsnames.ora file.

                Example:
                as direct string:
                "(DESCRIPTI ON =(ADDRESS_LIST =(ADDRESS =(PROTOCOL = TCP)(HOST = myHostNameOrIp) (PORT = 1526)))(CONNECT _DATA =(SID=myOracleD B))"
                or as reference:
                "myOra"

                If you give it as reference, you must have following entry in tnsnames.ora file:
                Code:
                myOra=
                  (DESCRIPTION =
                    (ADDRESS_LIST =
                       (ADDRESS =
                          (PROTOCOL = TCP)
                          (HOST = myHostNameOrIp)
                          (PORT = 1526)
                       )
                    )
                    (CONNECT_DATA =
                       (SID=myOracleDB)
                    )
                  )
                Buy the way, you can use "tnsping" to see if the connection is ok or not.

                Comment

                • Jibran
                  New Member
                  • Oct 2008
                  • 30

                  #9
                  Host String refers to database name or SID.

                  Comment

                  • NewToOracle
                    New Member
                    • Feb 2009
                    • 15

                    #10
                    Originally posted by chaarmann
                    It represents the host-name, the port number and the database name (= SID, =ServiceID). It can also contain additional non-mandatory parameters.
                    You can give it directly or you just give a single name as reference.
                    This single name then is looked up in the tnsnames.ora file.

                    Example:
                    as direct string:
                    "(DESCRIPTI ON =(ADDRESS_LIST =(ADDRESS =(PROTOCOL = TCP)(HOST = myHostNameOrIp) (PORT = 1526)))(CONNECT _DATA =(SID=myOracleD B))"
                    or as reference:
                    "myOra"

                    If you give it as reference, you must have following entry in tnsnames.ora file:
                    Code:
                    myOra=
                      (DESCRIPTION =
                        (ADDRESS_LIST =
                           (ADDRESS =
                              (PROTOCOL = TCP)
                              (HOST = myHostNameOrIp)
                              (PORT = 1526)
                           )
                        )
                        (CONNECT_DATA =
                           (SID=myOracleDB)
                        )
                      )
                    Buy the way, you can use "tnsping" to see if the connection is ok or not.
                    Thanks for the detailed and explanatory answer.

                    So, I need to add the reference in tnsnames.ora file containing protocol ,Host and other information which Oracle server will use during startup.

                    Thank you very much.

                    Comment

                    • chaarmann
                      Recognized Expert Contributor
                      • Nov 2007
                      • 785

                      #11
                      Originally posted by NewToOracle
                      So, I need to add the reference in tnsnames.ora file containing protocol
                      Not necessarily. It is advised, but sometimes you can't do it because you have no rights to modify this file. You have 2 other options:
                      1.) give the long string directly
                      2.) make an entry in database table USER_DB_LINKS. Put the long string there in column HOST

                      Comment

                      Working...