The SID parameter
is used when the service name is not specified as part of the database initialization parameters.
The structure for this descriptor is consistent across all protocols. Also, the descriptors can be
automatically generated via the Net Configuration Assistant. As previously noted, the keywords
used by the connect descriptors are protocol specific. The keywords to use and the values to give
them are provided in the operating system??“specific documentation for Oracle Net.
Net Service Names
Users are not expected to type in a connect descriptor each time they want to access remote data.
Instead, the DBA can set up net service names (or aliases), which refer to these connect descriptors.
Service names are stored in a file called tnsnames.ora. This file should be copied to all servers on
the database network. Every client and application server should have a copy of this file.
On the server, the tnsnames.ora file should be located in the directory specified by the TNS_
ADMIN environment variable. The file is usually stored in a common directory, such as the
$ORACLE_HOME/network/admin directory on Unix or Linux systems. For a Windows NT/2000/
XP/Vista server or client, this would be in the \network\admin subdirectory under your Oracle
software home directory.
A sample entry in the tnsnames.ora file is shown in the following listing. This example assigns
a net service name of LOC to the connect descriptor given earlier:
LOC =(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=HQ)
(PORT=1521))
(CONNECT DATA=
(SERVICE_NAME=LOC)))
A user wishing to connect to the LOC instance on the HQ server can now use the LOC net
service name, as shown in this example:
sqlplus hr/hr@LOC;
Chapter 15: Oracle Net 517
The @ sign tells the database to use the net service name that follows it to determine which
database to log into.
Pages:
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776