I know that instead of putting name descriptions in the TNSNAMES.ORA file, we can put a reference to some external text file that keeps actual descriptions. What's the syntax for such reference?
Thanks.
i think you are meaning external naming. i have not workd on this sorry but i believe it is complex to set-up.
myself i would either set up an oracle names server or if you have few databases and they are all on the default ports you can use host naming:-
to set up host naming do:-
vi sqlnet.ora and set
NAMES.DIRECTORY_PATH(hostname, tnsnames, onames)
make sure the /etc/hosts file has the following
# ip address of server hostname alias
10.128.1.12 dbserver db9i.mydomain.com
note: the domain section of the global database name must match the network domain
Once the configuration has been compleed, clients can connect to the database using the alias. Note that at the server side, the listener must be running on default port 1521.
Network Information Service (NIS)
Organizations and corporations already using NIS as part of their systems infrastructure have the option to store net service names and addresses in NIS, using NIS external naming.
When a user gives a command such as
sqlplus scott/tiger@payroll
(where payroll is an Oracle service) NIS external naming on the node running the client program (or database server acting as a client program) contacts an NIS server located somewhere in the network, and passes the net service name to the NIS server. The NIS server resolves the net service name into a Oracle Net address and returns this address to the client program (or server acting as a client program). The client program then uses this address to connect to the Oracle database.
A computer that acts as an NIS server runs a program called ypserv, which handles name requests. The ypserv program stores different types of data in special files called maps. For example, passwords are stored in a map called passwd.byname. Oracle database service names are stored in a map called tnsnames.
When a user issues a connect string, NIS external naming uses an RPC call to contact the ypserv program and passes the Oracle net service name payroll and the name of the map--tnsnames. The ypserv program looks in the tnsnames map for the name payroll and its corresponding value, which is the address for the net service name. The address is returned to the client, and the client program (or server acting as a client program) uses this address to contact the database server.
Task 1: Configure NIS Servers to Support the NIS External Naming
Before configuring servers to support the NIS external naming, make sure that NIS is configured and running on the NIS servers that need to resolve Oracle database net service names. Consult your NIS documentation for specifics.
Adding the "tnsnames" Map to the Existing Set of NIS Maps
To add the tnsnames map to the existing set of NIS maps:
Create a tnsnames.ora file, as specified in "Configuring the Local Naming Method".
--------------------------------------------------------------------------------
Note:
Keep a copy of the tnsnames.ora file, preferably in $ORACLE_HOME/network/admin directory. You may need to use this file again later to load net service names into the NIS map.
Convert the contents of the tnsnames.ora file to a tnsnames map using the tns2nis program.
--------------------------------------------------------------------------------
Note:
The tns2nis program is supplied with NIS External Naming on the Oracle Universal Installer tape or disk.
For example, run tns2nis on the command line with one argument:
tns2nis tnsnames.ora
The tns2nis program reads the tnsnames.ora file from the current directory. (If tnsnames.ora file is not located in the current directory, you can use a full path name to specify its location--for example, /etc/tnsnames.ora or $ORACLE_HOME/network/admin/tnsnames.ora).
The "tnsnames" map is then written into the current working directory.
Copy tnsnames to the NIS server, if it is not already there.
Install the tnsnames map using makedbm, which is an NIS program.
--------------------------------------------------------------------------------
Note:
This step should be performed by the person in charge of NIS administration.
The makedbm program converts the tnsnames map into two files that the NIS server can read. The location of these files is operating system specific.
See Also:
Oracle operating system-specific documentation for details
For example, to generate and install a tnsnames map on the Solaris Operating System, as the root user, enter the following at the command line:
# makedbm tnsnames /var/yp/'domainname'/tnsnames
Verifying that the "tnsnames" Map Has Been Properly Installed
You can test the NIS server to see if the map has been installed properly by typing a command with the format:
ypmatch net_service_name tnsnames
For example, you might enter:
ypmatch payroll.com tnsnames
This returns the length of the address (in characters) followed by the address; for example:
Task 2: Configure Clients
To configure clients, configure NIS as the first method specified in the NAMES.DIRECTORY_PATH parameter in the sqlnet.ora file. This parameter specifies the order of naming methods Oracle Net can use to resolve connect identifiers to connect descriptors.
Start Oracle Net Manager.
See Also:
"Starting Oracle Net Manager"
In the navigator pane, expand Local > Profile.
From the list in the right pane, select Naming.
Click the Methods tab.
From the Available Methods list, select NIS, and then click the right-arrow button.
In the Selected Methods list, select NIS, and then use the Promote button to move the selection to the top of the list.
Choose File > Save Network Configuration.
The sqlnet.ora file updates with the NAMES.DIRECTORY_PATH parameter, listing nis first:
Thanks a lot, but this is not exactly what I meant. .. What I meant is something very very simple.. Like you put the TNSNAMES.ORA to some place on the LAN, let's say to the root of F: drive . Then in your local tnsnames.ora files you delete all lines and put a single line, something like
@F:\TNSNAMES.ORA. But may be it sholud be like
@'F:\TNSNAMES.ORA' or
&F:\TNSNAMES.ORA -- I don't remember exact syntax and that's what I was asking.
sem i am fermiliar with tns_admin on unix such as set it in your .profile or whatever. But where would you set this in windows environment, assumning user has multiple homes? regedit or environmental variables?
Toad does care about TNS_ADMIN but it should be set either globally or under correct registry key. TOAD has some internal names cacheing and may suggest non-existing names obtained before. But once the name has been chosen it lets sql*net to process connect string, thus further actions do not depend on toad.
Another option is to place a master tnsnames.ora file in a common directory somewhere, and have the clients' tnsnames file simply redirect to the common version. The syntax example for the clients' tnsnames is: IFILE=\\###.###.###.###\common_location\tnsnames.ora
It is also helpful to add comments to the client tnsnames file that let the users know they are being redirected.
This is particularly helpful for users who need to manipulate their own tnsnames on occasion.
That's what I originally meant: redirection! TNS_ADMIN is working fine for us for now, though if we ever need to have a custom part in each tnsnames file, redirection is definitely the way to go. Thanks!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.