CHAPTER 17. Configuring the NIS Naming Adapter
This chapter describes how to configure the NIS Native Naming Adapter into your network environment. It includes the following topics:
Refer to Chapter 13 in this guide and to "Integrating Oracle into your Native Naming Environment" in Chapter 3 in Understanding SQL*Net for information on how you can use the Native Naming Adapters provided by Oracle in your network environment.
What the NIS Adapter Does for You
Organizations and corporations already using Network Information Service (NIS) as part of their systems infrastructure have the option to store Oracle service names and addresses in NIS, using the NIS Native Naming Adapter.
Connect Using Familiar Oracle Service Name
After the NIS Naming Adapter is installed on clients and on servers that will need to make server to server connections (through database links), users can connect to a database server by specifying the Oracle service name. For example, if a database is in a user's default domain, the user would enter:
sqlplus scott/tiger@payroll
If the database is located in an Oracle domain that is not the user's default domain, the user needs to specify the fully-qualified domain name; for example,
sqlplus scott/tiger@payroll.us.oracle.com
System Requirements
The NIS Naming Adapter requires SQL*Net 2.2 or greater, and must be configured with Network Manager 2.2 or greater.
Installing the NIS Naming Adapter
To install the NIS Naming Adapter, use the Oracle Installer. Refer to your platform-specific documentation for information.
How the NIS Naming Adapter Interacts with SQL*Net and Oracle
When a user gives a command such as
sqlplus scott/tiger@payroll
(where "payroll" is an Oracle service name) the NIS Naming Adapter on the node running the client program (or server acting as a client program) contacts an NIS server located somewhere in the network, and passes the service name to the NIS server. The NIS server resolves the service name into a SQL*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.
Note: The service name should be the same as the global database name defined in the server's INIT.ORA file.
Oracle Database Service Names are Stored in a Separate NIS Map
A machine that acts as an NIS server runs a program called ypserv, which handles name requests. ypserv 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.
Note: The tnsnames map is called a.smd in releases previous to 2.2.2.
When a user issues a command like the one in the previous section, the NIS Naming Adapter uses an RPC call to contact the ypserv program and passes the Oracle 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 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.
Configuring Clients to Use the NIS Naming Adapter
After installing the NIS Naming Adapter on clients and on servers that will make database link connections to other servers, you need to configure them to use the NIS adapter. To do so, use Oracle Network Manager.
Using SQL*Net 2.2 or Earlier
Use Oracle Network Manager to create the SQL*Net configuration files. Select NIS as a name service in the Native Naming page of the Client Profile property sheet. When Network Manager generates the configuration files, the following two configuration parameters appear in the SQLNET.ORA file.
native_names.use_native=true
native_names.directory_path=(nis)
The first line tells SQL*Net to use a Native Naming adapter to contact a native name service instead of a TNSNAMES.ORA file or an Oracle Names server.
The second line indicates which native name service to use. In this example, it uses the NIS Naming Adapter to contact an NIS server to resolve Oracle service names.
Using SQL*Net 2.3
For a client or server to use the NIS Naming Adapter, the NAMES.DIRECTORY_PATH parameter in the SQLNET.ORA file must include NIS. Set this parameter using the Names Services page of the Client Profile property sheet in Network Manager. For example:
NAMES.DIRECTORY_PATH=(nis, tnsnames)
The first name resolution service listed as a value for this parameter is used first. If it is unavailable for some reason, the next is used, and so forth. In this example, NIS would be used. If it were unavailable for some reason, the TNSNAMES.ORA file would be used.
Configuring NIS Servers to Support the NIS Adapter
Before configuring servers to support the NIS Naming Adapter, make sure that NIS is configured and running on the NIS servers that need to resolve Oracle database service names. Consult your NIS documentation for specifics.
Add the tnsnames Map to the Existing Set of NIS Maps
To add the tnsnames map to the existing set of NIS maps:
1. Use Network Manager to configure all the Oracle database service names and addresses in your network. Make sure you select the NIS naming adapter on the Native Naming page in the Client Profile in Network Manager. Refer to Chapter 4, "Entering Component Information", in the Oracle Network Manager Administrator's Guide for information.
When you generate configuration files from Network Manager, a NATIVE.ORA file will be generated. This file is used as input to tns2nis when you load Oracle service names into the native naming service. Do not alter this file in any way.
Note: Keep a copy of the NATIVE.ORA file, preferably in your $TNS_ADMIN or $ORACLE_HOME/network/admin directory. You may need to use this file again later to load Oracle service names into the NIS map.
2. Convert the contents of the NATIVE.ORA file to tnsnames using the tns2nis program.
Note: The tns2nis program is supplied with the NIS adapter on the Oracle Installer tape or disk.
For example, run tns2nis on the command line with one argument:
tns2nis native.ora
tns2nis reads the NATIVE.ORA file from the current directory. (If NATIVE.ORA is not located in the current directory, you can use a full pathname to specify its location--for example, /etc/native.ora or $ORACLE_HOME/network/admin/native.ora).
tnsnames is then written into the current working directory.
3. Copy tnsnames to the NIS server, if it is not already there.
4. Install the tnsnames map using makedbm, which is an NIS program. Refer to your NIS documentation for more information.
Note: This step should be performed by the person in charge of NIS administration.
makedbm converts tnsnames to two files that the NIS server can read. The location of these files is platform-specific. Refer to your platform-specific documentation for details.
For example, as "root", a command of the form:
# makedbm tnsnames /var/yp/`domainname`/tnsnames
generates and installs the tnsnames map in the appropriate directory on the SunOS.
Making Sure 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 global_database_name tnsnames
For example, you might enter:
ypmatch payroll.world 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=(SID=DIRPROD)))