What is the use of tnsnames.ora?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lrg
    New Member
    • Jun 2007
    • 8

    What is the use of tnsnames.ora?

    I'm writing an application in ASP.NET using C# for code behind and i'm also using oracle 10g. I thought when i retrieve data from the DB first tnsnames.ora is referred. But my experience is that server name given in web.config is directly connected whether or not entry is present in tnsnames.ora. Then why do we need a tnsnames.ora?
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    It defines the application can connect to which database,server address using which port . its for reference of database.
    The web.config file is for webpages not for the database.

    a typical entry in tnsname.ora file is as follows.
    ----------------------------------------------------------------------
    [CODE=oracle]
    OM =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = is-18)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = Om)
    )
    )

    EXTPROC_CONNECT ION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    )
    (CONNECT_DATA =
    (SID = PLSExtProc)
    (PRESENTATION = RO)
    )
    )

    MES =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.35.15.3)(POR T = 1521))
    )
    (CONNECT_DATA =
    (SID = MES)
    )
    )

    BDCORA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.35.12.16)(PO RT = 1521))
    )
    (CONNECT_DATA =
    (SERVICE_NAME = orcl1)
    )
    )

    MESTEST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.35.14.155)(P ORT = 1521))
    )
    (CONNECT_DATA =
    (SERVICE_NAME = MESTEST)
    )
    )
    [/CODE]

    Comment

    • lrg
      New Member
      • Jun 2007
      • 8

      #3
      My application is connecting to a server which isn't entered in tnsnames.ora. Why is this happening?

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        Is that defined in web.config ???

        Comment

        • lrg
          New Member
          • Jun 2007
          • 8

          #5
          Yes, server name is defined in web.config. But how is it possible to find out the correct server from the name alone? No ip address or port no or any other detail is given.

          Comment

          • debasisdas
            Recognized Expert Expert
            • Dec 2006
            • 8119

            #6
            You can use either IP address OR servername.

            Because as there can't be more than one system with same IP address there can't be more than one system by the same in the same network.

            Comment

            • lrg
              New Member
              • Jun 2007
              • 8

              #7
              thanks a lot. now i'm clear.

              Comment

              • debasisdas
                Recognized Expert Expert
                • Dec 2006
                • 8119

                #8
                Hi
                Irg
                Welcome to TSDN.

                You have reached the right place for knowledge shairing.

                Here you will find a vast resource of related topics and code.

                Feel free to post more doubts/questions in the forum.

                But before that give a try from your side and if possible try to post what/how you have approached to solve the problem.

                It will help Experts in the forum in solving/underestanding your problem in a better way.

                Please follow the posting guidelines in every new post/reply.

                please specify your post/question clearly.

                Dont expect others to guess and solve your problem.

                Regards

                Debasis

                Comment

                Working...