Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TNSNAMES.ORA referring external file 3

Status
Not open for further replies.

nagornyi

MIS
Nov 19, 2003
882
0
0
US
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.

the client for example can connect as

connect username/password@db9i.mydomain.com

hth



Sy UK
 
heres dump on nis from otn which may be of help:-

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:

99 (description=(address=(protocol=tcp)
(host=garlic)(port=1999)))
(connect_data=(service_name=dirprod)))

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:

NAMES.DIRECTORY_PATH=(nis, hostname, tnsnames)



Sy UK
 
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.
 
The only thing you need is to set environment variable TNS_ADMIN to point to the directory where tnsnames is located.

Regards, Dima
 
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?

simon


Sy UK
 
In regedit each home has its own key.
Or set environment variable without writing to registry to work for all homes.

Regards, Dima
 
That I tried already. For some reason some tools, like TOAD, do not care about TNS_ADMIN and connect only if find their local tnsnames.ora file.
 
OK, I made TNS_ADMIN working. I had to put it to the ORACLE registry directory, not HOME0 directory, as one of the manuals suggested. Thanks, Dima.
 
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.

Regards, Dima
 
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!
 
hey bizzyb

i am trying to get this to work as i would find it very usefull.

i have set up my tnsnames.ora file to basically contain only the following:-

IFILE=\\10.128.2.9\oracle\tnsnames.ora

the ip address and share exist and can be accessed through run command.

any ideas where i am going wrong?

Sy UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top