393 You may optionally specify the service name of an Oracle instance by setting the SERVICE_NAMES parameter in the init.ora file. I recommend setting the service name in this manner as good practice, to eliminate guesswork. The following example illustrates setting the service name of an Oracle instance. In this example, two service names are specified for a single instance. service_names = toffee.cafecandy.com, orange.cafecandy.com Naming Methods The Net8 client resolves net service names through one of five known naming methods: Local naming Local naming is specific to each Oracle client and requires extensive administration. With local naming, net service names are stored in the tnsnames.ora file residing in $ORACLE_HOME/network/admin on a Unix system or in %ORACLE_HOME%\network\admin on a Windows NT system. Local naming is most appropriate for small networks with a limited number of services and clients. Oracle Names Oracle Names is an Oracle directory service comprised of a system of Oracle Names servers, which can be centrally managed by the DBA. Oracle Names is a good solution for a high-volume, dynamic, and complex environment. NOTE Oracle Names will be deprecated in Oracle9i. Because of this, if you need a cen- tralized naming resolution solution, it is recommended that you use Oracle Directory Nam- ing rather than Oracle Names. Oracle Directory Naming Oracle Directory Naming uses an LDAP (Lightweight Directory Access Protocol)–compliant directory server to store net service names and connect descriptors. The network directory becomes the cen- tral repository for all data on databases, network components, and user and cor- porate policies and preferences, replacing client-side and server-side localized files. Administrators can centrally manage these objects, and all systems on the hetero- geneous network can refer to the directory for information. Net8 supports Oracle Internet Directory, Microsoft Active Directory, and Novell Directory Services (NDS). Host naming Host naming uses a known name resolution service in a TCP/IP environment, such as Domain Name System (DNS) or Network Information Services (NIS). INTRODUCING NET8 Oracle Networking PART II C opyright ©2002 SYBEX, Inc., Alameda, CA www.sybex.com Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. CHAPTER 9 • ORACLE NETWORKING 394 External naming External naming support allows sites to resolve Oracle service names using industry-standard name services, including Sun NIS+, NDS, and the Open Software Foundation/Distributed Computing Environment (OSF/DCE) Cell Directory Service (CDS). Local naming and host naming fall under the localized management network con- figuration model. Localized management involves configuring name resolution on each Oracle client in a tnsnames.ora file. Oracle Names, Oracle Directory Naming, and external naming fall under the centralized management network configuration model. Centralized management eases management of Oracle clients, because you do not need to reconfigure each client every time a new Oracle service is added to the network. Configuring Net8 Net8 is typically installed along with other Oracle8i products. For example, when you install the database server or SQL*Plus, Net8 will be installed at the same time. You can choose to install Net8 without any other client software (though some dependent libraries will still be installed). If you need to install Net8, simply insert your server installation CD (or SQL*Plus installation CD), start the Universal Installer, and choose to do a Custom Install. From the Available Product Components window, choose Net8. (See Chapter 2 for details on the Oracle Universal Installer and installing Oracle8i components.) NOTE In addition to installing Net8 you will need to install one or more protocol adapters, to allow Net8 to communicate using the protocol you wish to use. By default, Oracle will try to install the correct protocol adapter, but it’s always a good idea to make sure that the correct one is being installed. Net8 is configured using configuration files located on the client and network server hosts. The following configuration files contain information about where ser- vices are located and how to establish connections between the application client and an Oracle service: • listener.ora, located on the server, contains configuration information about listeners on a server. C opyright ©2002 SYBEX, Inc., Alameda, CA www.sybex.com Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 395 • tnsnames.ora, located on the client, contains information about net service names and connection data. • sqlnet.ora, located on the client and/or server, contains information about the net service name resolution method and Net8 configuration options. • names.ora, located on the client, contains information about an Oracle Names server. These configuration files are typically found in $ORACLE_HOME/network/admin on a Unix system, in %ORACLE_HOME%\network\admin on Windows NT system, or in the location specified by the TNS_ADMIN environment variable or registry entry. The listener.ora and tnsnames.ora files are covered in the following discussions of configuring the listener and client. The sqlnet.ora and names.ora files are dis- cussed later in this chapter, in the “Using Oracle Names” section. Configuring and Managing the Listener You must employ a listener on each host where an Oracle service resides. The Net8 listener process monitors for and processes incoming database connection requests from client applications. The listener process runs independently of any Oracle instances running on the host. In fact, one listener process can service connections for any instance running on the host. The Net8 listener verifies the connection data passed to it by matching this information to the services that have been registered with the listener. The listener has a default name of LISTENER and will be automatically configured to listen on the TCP/IP protocol on port 1521, or on the IPC protocol for external procedures. Just as you can run multiple Oracle instances on a single node, you can also config- ure multiple listeners for that node. If you configure multiple listeners, each listener will have the name you specify in the listener.ora configuration file. A single lis- tener can service multiple service names, and multiple listeners can service a single service name. Registering Service Names A service name can be registered with the listener either through configuration infor- mation saved in the listener.ora file or through automatic registration at instance startup. Beginning with Oracle8i, the PMON process will register the service names for that instance with the listener through a feature known as service registration. Ser- vice registration is automatic at instance startup if the listener is already running. If the listener is not already running at instance startup, Oracle will periodically check CONFIGURING NET8 Oracle Networking PART II C opyright ©2002 SYBEX, Inc., Alameda, CA www.sybex.com Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. CHAPTER 9 • ORACLE NETWORKING 396 to see if the listener has started. When the listener is started, the Oracle instance will register its service names with the listener. NOTE If you are running an Oracle instance under a version of Oracle prior to Oracle8i, you must manually configure the listener for those services. Listener configuration is also required when using certain products such as Oracle Enterprise Manager (OEM). You can control service name registration by specifying the name of the listener in the init.ora file using the LOCAL_LISTENER parameter. Set this parameter to a lis- tener name alias that is resolved either through tnsnames.ora or an Oracle Names server. In the following example, the Oracle instance is configured to register its ser- vice names with the listener brewlist. local_listener=brewlist The listener alias is then resolved through a known naming method. In this example, the resolution is through local naming in the tnsnames.ora file: brewlist= (address=(protocol=tcp)(host=oregano)(port=1521)) Following instance startup, the PMON process will then register the service names for that instance with the brewlist listener running on host oregano and listening on port 1521. Configuring the listener.ora File Listing 9.1 shows a sample listener.ora file with a Net8 listener configuration. Listing 9.1: A listener.ora File with a Net8 Listener Configuration # Listener Address Section listener= (description= (address_list= (address=(protocol=tcp)(host=oregano)(port=1521)) (address=(protocol=ipc)(key=toffee.cafecandy.com)) ) ) # Static Service Section sid_list_listener= (sid_list= C opyright ©2002 SYBEX, Inc., Alameda, CA www.sybex.com Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 397 (sid_desc= (global_dbname=toffee.cafecandy.com) (oracle_home=/u01/app/oracle/product/8.1.7) (sid_name=toffee) ) ) # Listener Control Options connect_timeout_listener=5 logging_listener=off NOTE You can use the formatting style you prefer for the listener.ora file, but you should try to be consistent. Note that some versions of the Net8 software will generate an error if parentheses are written in the first column. There are three sections within the listener.ora file for each listener configured: the listener address section, the static service section, and the control parameters sec- tion. Let’s look at these sections in a bit more detail. The Listener Address Section The listener address section defines the protocol addresses for the listener. In other words, this section tells the listener where to listen for incoming connection requests. This section starts with the name of the listener, such as LISTENER, followed by a description that is a list of protocol addresses. # Listener Addresses listener= (description= (address_list= (address=(protocol=tcp)(host=oregano)(port=1521)) (address=(protocol=ipc)(key=toffee.cafecandy.com)) ) ) The address in this example is a TCP/IP protocol address that specifies the name of the destination host and the port that the listener is monitoring. The host can be the current host or another host to which the listener will forward the connection request. The second protocol address in this listing is an IPC address. In this address definition, the key parameter specifies the name of the service that receives the IPC protocol communications. CONFIGURING NET8 Oracle Networking PART II C opyright ©2002 SYBEX, Inc., Alameda, CA www.sybex.com Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. CHAPTER 9 • ORACLE NETWORKING 398 For systems that handle many connection requests, you may want to configure a queue for the listener process. This feature enables the listener to dynamically handle a larger volume of connection requests. Check your platform-specific documentation for availability of listener queues and default queue sizes. To configure a queue for a protocol address, specify the QUEUESIZE parameter at the end of the address defini- tion. The following example demonstrates how to configure a queue size of 20 for the first listener address only. # Listener Addresses listener= (description= (address_list= (address=(protocol=tcp)(host=oregano)(port=1521) (queuesize=20) ) (address=(protocol=ipc)(key=toffee.cafecandy.com)) ) ) The Static Service Section The static service section includes the static service name configurations for the lis- tener. This section also supports backward compatibility for instances running ver- sions prior to Oracle8i, as well as for certain add-ons such as OEM. This section starts with the parameter SID_LIST_<listener name>, such as SID_LIST_LISTENER, followed by a list of SIDs. # Static Service Section sid_list_listener= (sid_list= (sid_desc= (global_dbname=toffee.cafecandy.com) (oracle_home=/u1/app/oracle/product/8.1.7) (sid_name=toffee) ) ) In this example, the GLOBAL_DBNAME parameter specifies the service name for which the listener is receiving requests. The ORACLE_HOME parameter should match the definition of the ORACLE_HOME parameter for the instance. SID_NAME is the SID of the instance. C opyright ©2002 SYBEX, Inc., Alameda, CA www.sybex.com Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 399 Listener Control Parameters The control parameters are optional and control the operation of certain features of the listener, such as listener tracing and connection time-outs. Each parameter in this section is suffixed with the name of the listener, such as CONNECT_TIMEOUT_ LISTENER. Table 9.1 describes the available control parameters. TABLE 9.1: LISTENER CONTROL PARAMETERS IN THE LISTENER.ORA FILE Parameter Default Description connect_timeout 10 Specifies the time (in seconds) that the listener will wait for a valid connection to be made log_directory $ORACLE_HOME/ Specifies the destination directory for the listener network/log log file log_file <listener_ Specifies the name of the listener log file name>.log logging ON Turns listener logging on or off passwords oracle Sets an unencrypted password for the listener con- trol (lsnrctl) utility and allows one or more pass- words; an encrypted password can be set using lsnrctl change_password save_config_on_stop FALSE If set to TRUE, saves to the listener.ora file any configuration changes set using lsnrctl startup_wait_time 0 Specifies the time (in seconds) that the listener will sleep before responding to the lsnrctl status command trace_directory $ORACLE_HOME/ Specifies the destination directory for the listener network/trace trace files trace_file <listener_ Specifies the name of the listener trace file name>.trc trace_filelen Unlimited Specifies the maximum size of the listener trace file, in kilobytes trace_fileno 1 When trace_filelen is also specified, specifies the maximum number of listener trace files; when this setting is exceeded, the listener will recycle the lis- tener trace files trace_level OFF Turns listener tracing on or off and specifies incre- mental tracing levels: OFF (no trace output), USER (user trace information), ADMIN (administrative trace information), or SUPPORT (Oracle worldwide cus- tomer support trace information) CONFIGURING NET8 Oracle Networking PART II C opyright ©2002 SYBEX, Inc., Alameda, CA www.sybex.com Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. CHAPTER 9 • ORACLE NETWORKING 400 TABLE 9.1: LISTENER CONTROL PARAMETERS IN THE LISTENER.ORA FILE Parameter Default Description trace_timestamp OFF Specifies whether to add a timestamp in the format of dd-month-yyyy hh:mm:ss to a trace event; set using ON|TRUE|OFF|FALSE use_plug_and_play OFF Tells the listener to register services with an Oracle Names server The following example sets the CONNECT_TIMEOUT parameter to 5 seconds and turns listener logging off. # Listener Control Options connect_timeout_listener=5 logging_listener=off Managing the Listener You can manage the listener with the Listener Control utility, lsnrctl. You can issue a single command from the operating system prompt by passing arguments to lsnrctl, as follows: $ lsnrctl command [listener_name] In this syntax, listener_name is the name of the listener defined in the listener.ora file. It is not necessary to identify the listener if you are using the default listener, named LISTENER. Table 9.2 describes the basic lsnrctl commands. TABLE 9.2: COMMONLY USED LISTENER CONTROL (LSNRCTL) COMMANDS Command Description START Starts the listener STOP Stops the listener RELOAD Reloads the listener configuration STATUS Shows the current status of the listener, including the version of the lis- tener, start time, up time, tracing level, logging and tracing options, the name and location of the listener configuration file, a list of services reg- istered with the listener, and the addresses the listener is monitoring HELP Lists all available lsnrctl commands, or if a command is specified, shows help information about that command C opyright ©2002 SYBEX, Inc., Alameda, CA www.sybex.com Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 401 TABLE 9.2: COMMONLY USED LISTENER CONTROL (LSNRCTL) COMMANDS Command Description SET Lists the available parameters that can be passed to the SET command, or if passed a parameter, modifies the setting of the parameter SHOW Lists the available parameters that can be passed to the SHOW com- mand, or if passed a parameter, shows the setting of the parameter CHANGE_PASSWORD Sets an encrypted password for the listener SERVICES Provides detailed information about the services registered with the listener TRACE Turns on tracing for the listener VERSION Shows the current lsnrctl version Configuring the Net8 Client The Net8 client might be an application running on a PC or a database that requests information from another database through a database link. The Net8 client resolves connect identifiers to connect descriptors through a net service name identified by a known name resolution method, as discussed in the “Naming Methods” section, ear- lier in this chapter. Here, we will discuss the local naming method and basic Net8 client configuration. Local naming resolves service names to network addresses by using information configured in the tnsnames.ora file that is stored locally on each client node. Before a database server can receive connections from clients, the clients must have a tnsnames.ora file with service names that map to the service addresses listed in the database server’s listener.ora file. You configure the client by creating a list of ser- vice names (which are aliases for database network addresses) and addresses of net- work destinations (database server names or IP addresses) in the tnsnames.ora file. In the tnsnames.ora file, the net service names are mapped to database network addresses contained in a connect descriptor. A connect descriptor contains the loca- tion of the listener through a protocol address and the service name of the database to which to connect. Clients and servers that are clients of other servers use this net service name when making a connection to an application. Here is the basic syntax for a net service name entry in the tnsnames.ora file: <net service name>= (description= CONFIGURING NET8 Oracle Networking PART II C opyright ©2002 SYBEX, Inc., Alameda, CA www.sybex.com Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. CHAPTER 9 • ORACLE NETWORKING 402 (address=(protocol=<protocol>)(host=<host>)(port=<port>)) (connect_data= (service_name=<service name>) ) ) For each connect identifier referenced by a Net8 client, a matching net service name entry should be listed in the tnsnames.ora file to allow the client to make the proper connection. Listing 9.2 illustrates how a connect identifier is mapped to a con- nect descriptor through the net service name toffee. Listing 9.2: Mapping a Connect Identifer to a Connect Descriptor in the tnsnames.ora File toffee= (description= (address=(protocol=tcp)(host=oregano)(port=1521)) (connect_data= (service_name=toffee.cafecandy.com) ) ) In the event that a service name represents more than one instance, you may iden- tify a specific instance in the connect descriptor. This is particularly useful if you are using Oracle Parallel Server (OPS). Listing 9.3 shows an example that specifies the instance name, which matches the INSTANCE_NAME parameter in the init.ora file of that instance. Listing 9.3: Identifiying an Instance in a Connect Descriptor in the tnsnames.ora File toffee= (description= (address=(protocol=tcp)(host=oregano)(port=1521)) (connect_data= (instance_name=toffee) (service_name=toffee.cafecandy.com) ) ) Client Load Balancing If you have configured multiple listeners for a service, you can configure the Net8 client to randomize connection requests to the listeners through a feature called client C opyright ©2002 SYBEX, Inc., Alameda, CA www.sybex.com Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.