Tnsnames.ora is a file which is used by oracle client to connect to oracle server.As we know when if we want to connect to oracle database from remote machine we enter into sqlplus using connect identifire as shown
C:\>sqlplus
SQL*Plus: Release 10.2.0.1 - Production on Wed Mar 21 15:28:03 2007
(c) Copyright 2000 Oracle Corporation. All rights reserved.
Enter user-name: scott/tiger@orcl
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
This connect identifier i.e orcl in above example is resolved by sqlplus client by looking at tnsnames.ora file which is placed at the following location $ORACLE_HOME/network/admin however it can be placed at any given location and it’s path can be set in $TNS_ADMIN environment variable for unix systems.The tnsnames.ora provides the network resolution for connect identifier used by sqlplus clients and application servers.
TNSNAMES.ora contains entries as shown
TNSNAMES.ORA:
=============
V805.US.ORACLE.COM =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = TCP)
(HOST = DAN.US.ORACLE.COM)
(PORT = 1521)
)
(
CONNECT_DATA = (SID=ORCL))
)
LISTENER.ORA:
=============
LISTENER=
(ADDRESS_LIST=
(ADDRESS=
(PROTOCOL= TCP)
(HOST = DAN.US.ORACLE.COM)
(PORT= 1521)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl.oracle.com)
(SID_NAME = ORCL)
)
)
As shown above the entries in TNSNAMES correspond listener entries at the server side.Address_list and Address in tnsnames.ora specifies the address of the listener which listens to incoming client requests for the given database.Also the connect_data specifies the service name i.e Sid of the databse specified at the server.
Reference: http://www.oraclefaq.net/2007/03/21/what-is-tnsnamesora/
No comments:
Post a Comment