'; zhtm += ''; zhtm += '

' + pPage + ''; zhtm += '
'; figDoc.write(zhtm); figDoc.close(); popUpWin.focus(); } //--> Using Oracle8 -- Chapter 24 - Configuring and Using Net8 Features

Using Oracle8


Chapter 24

Configuring and Using Net8 Features


Introducing Net8

Net8 is an Oracle networking product that facilitates network communication between remote clients and database servers, as well as between two or more database servers. Net8, the successor to SQL*Net 2.x, is a software layer that runs on top of standard network protocols such as TCP/IP and SPX/IPX.

Like its predecessor, Net8 enables location, network, and application transparency:

Net8 Naming Techniques

You can implement Net8 by using host, local, external naming, and Oracle Names server methodologies. Oracle Names is a centralized management system used mostly by larger shops. An Oracle Names Server maintains client configuration information in one location. Oracle Names Server is very similar to Domain Name Service (DNS) on IP-based networks. Each method has its advantages and disadvantages. Host, local, and external naming are most commonly used for smaller installations.

It really doesn't matter what naming convention and technique a shop uses. What really matters is that the technique is unique. Whenever connections are made between clients and servers, there must be no confusion as to what database the connection must be made to. To enable uniqueness, Oracle and Net8 use the convention of DB_NAME.DB_DOMAIN.

A domain is a logical collection of machines, hardware, and networked devices in a networked environment. The convention is that, all names must be unique within a domain, but can be repeated across domains. If your shop uses DNS (Domain Naming Service) for defining its network, you can use DNS-type conventions for your Oracle domain. For example, if your server's host name in a DNS architecture is ABCINC.STARSHIP.COM, you could keep the domain name ABCINC.STARSHIP.COM, but it's not necessary to do so. You may want to keep the domain name WORLD for backward compatibility, especially if you have a heterogeneous environment (with several networking operating systems at work). However, if your database server is serving intranets and the Internet, observing DNS naming conventions may be more advantageous to your shop. The DB_DOMAIN parameter in INITSID.ORA acts as an extension component to a global database name. WORLD is DB_DOMAIN's default value.

The global name is a unique name that represents the database's name and domain. The representation for the database's global name is DB_NAME.DB_DOMAIN. Don't confuse this with the parameter GLOBAL_NAMES in the INITSID.ORA file. GLOBAL_NAMES has to be set to TRUE if you want database links to use the same name as the DB_NAME. As seen in Figure 24.1, if you want to refer to table TOASTERS in the MONTHLY schema, the global name that would prefix MONTHLY.TOASTERS would be SALES or SALES.WORLD because there's only one domain. In contrast, Figure 24.2 shows several domains. If you want to refer to table MONTHLY.TOASTERS in the SAMERICA domain, you would use SALES.SAMERICA.ABCINC as the global name (that is, refer to the database SALES in the domain SAMERICA.ABCINC). Similarly, to access the table MONTHLY.TOASTERS in the EUROPE domain, you would use SALES.EUROPE.ABCINC as the global name. This ensures that uniqueness is maintained when you have similar tables and objects in different locations.

Figure 24.1 : This naming structure uses a single domain name.

Figure 24.2 : This naming structure uses multiple domain names.

Supported Network Protocols

Net8 works with several industry-standard network protocols. These include but are not restricted to TCP/IP, SPX/IPX, Named Pipes, LU6.2, DECnet, Bequeath, and AppleTalk. The adapters for each protocol are supplied mostly by the vendors of the operating system on which they run.

To configure Oracle networking, you need to know the following:

Testing network connectivity
Because Net8 is a layer on top of an operating system network protocol, it makes sense to ensure that the clients and servers can "see" each other. On IP-based networks, just pingthe server or the client from the server to verify this. If you can't ping the destination host, Net8 won't work and you'll need to contact your network/systems administrator in such a situation. An Oracle utility named TNSPING80 verifies that the listener is listening on the server. TNSPING80 is verified normally after the operating system ping is verified.

Basic Net8 Files

Net8 uses a minimum of three basic files to establish communications between remote clients and server: TNSNAMES.ORA, LISTENER.ORA, and SQLNET.ORA. These files are identical in form, function, and location on all platforms of Oracle. (You may have SNMP.ORA on some platforms and network protocols as well.)

Although you can modify these files by using any text editor, Oracle provides (and recommends) tools to configure these files: Net8 Assistant and Net8 Easy Config. We look at these tools later in the chapter.

TNSNAMES.ORA

This configuration file is used by clients to connect to servers (actually, to a listener service running on the server). Servers also use this file to connect to other servers as clients. A sample TNSNAMES.ORA is created on client software in the ORACLE_HOME/NET80/ADMIN folder. You have to add this file to this folder for server-to-server communications because you will unlikely ever do the standard client installation on the server.

Definition of ORACLE_HOME varies
The definition of ORACLE_HOME varies on different platforms and depends on the installation. On Windows NT systems, it may be in the form of C:\ORANT. On UNIX servers, an environment variable probably defines ORACLE_HOME. The folder and file structure is virtually identical on all plat-forms under ORACLE_HOME.

The following is an example of this file. Your systems administrator is a good source of information about the listener's port number on the server.

Different platform? Different SID
The naming convention for the system identifier (SID) varies on different platforms. The SID can be up to four alphanumeric characters on Windows NT. The SID can be up to eight alphanumeric characters on most UNIX platforms. Consult your platform-specific documentation for valid SIDs.

FinProd.world =
 (DESCRIPTION=
 (ADDRESS_LIST=
  (ADDRESS=
   (PROTOCOL=TCP)
    (Host=STARSHIP)
     (Port=1521)
    )
   )
(CONNECT_DATA=(SID=finance)
(source_route=yes)

   )
)

As you can see, the TNSNAMES.ORA file has two main components: the service name and the address/connect descriptor. In the file, FinProd is an alias or service name that represents a connection to the database instance Finance, running on a server/host named STARSHIP and establishing a connection on port 1521; that is the port on which the listener is listening. (The LISTENER.ORA file on host STARSHIP, running an instance called Finance, will have an entry for port 1521.) In general, the connect descriptor contains information specific to the database server, database instance, and network protocol.

Using Oracle tools to configure networking
Oracle recommends using Net8 Easy Config and Net8 Assistant to configure your network connections on the client side. All changes and new entries made via the Net8 Easy Config and Net8 Assistant tools are reflected in the TNSNAMES.ORA file.

LISTENER.ORA

This file is located on the server and acts as a configuration file for the listener service/process. This configuration file runs on the server and "listens" to incoming requests. This file has three major components: address list, Oracle SID, and listener parameters.

When the Oracle product is installed on a database server, the installer gets basic information about the server's network configuration (host name, IP address, or both) and creates a sample LISTENER.ORA in the ORACLE_HOME/NET80/ADMIN folder. If you want more than one listener service on a server, simply add details about the listeners in the listener's ADDRESS_LIST component. If you have one listener service for several Oracle instances (SIDs) on a server, simply add the instance information in this file's SID_LIST component. You can have multiple listeners for a single database listening on different server ports, or you can have a single listener listening on a port for requests made to different databases on the same server.

LISTENER.ORA defines the listener's address descriptor besides the instance's (SID) name or the global name of the database instances for which the listener is listening. The listener parameter portion is used for tracing and logging the listener process.

The following is a LISTENER.ORA file:



Internal network protocol (always needed)
Service name associated with IPC
Domain; follows Internet naming conventions
Same as descriptors for TNSNAMES.ORA
Number of seconds listener sleeps before responding to LSNRCTL80 STATUS command
Time (in seconds) after which listener request is timed out
Amount of tracing desired, from 0 to 16 (0 = no tracing, 16 = support-level tracing)

For other configuration parameters that go into the LISTENER.ORA file, refer to Appendix B of the Net8 Administrator's Guide in the Oracle documentation set.

Checking Listener Status

You can verify the status of the listener process by typing LSNRCTL80 STATUS at the server's command line for UNIX and Windows NT servers. (The LSNRCTL80 executable was formerly LSNRCTL with Oracle 7.x and SQL*Net 2.x.) The command results in the following output:

Starting and stopping the listener process on different platforms
LSNRTCL80 is the executable used to verify and start/stop the listener process. On UNIX servers, you can start and stop the process with the LSNRCTL80 start and LSNRCTL80 stop commands, respectively. To verify that the process is running, use ps -ef on the server. (You must have the required privileges.) For Windows NT servers, use the Services dialog box, which you access through Control Panel. You can see whether the listener is running and set the listener process's startup to automatic or manual.

LSNRCTL80 for 32-bit Windows: Version 8.0.3.0.0 - Production
 on 29-MAR-98 00:43:48

(c) Copyright 1997 Oracle Corporation.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=IPC)(KEY=finance.world))
STATUS of the LISTENER
------------------------
Alias                   LISTENER
Version                 TNSLSNR80 for 32-bit Windows: Version
                        8.0.3.0.0 - Production
Start Date              24-MAR-98 21:28:09
Uptime                  2 days 3 hr. 15 min. 38 sec
Trace Level             off
Security                ON
SNMP                    OFF
Listener Parameter File C:\ORANT\NET80\admin\listener.ora
Listener Log File       C:\ORANT\NET80\log\listener.log
Services Summary...
  FINANCE          has 1 service handler(s)
  The command completed successfully

SQLNET.ORA

This configuration file, used by clients and servers, contains information about Oracle Names (if used) and information about other client parameters such as diagnostics, naming conventions, and security. This file is installed automatically on the server in the ORACLE_HOME/NET80/ADMIN folder. Net8 client installations also install it in the same folder on the client side. A sample client-side SQLNET.ORA file is as follows:

Distributing the files
In a client/server environment, you may have several hundreds of personal computers that need to be connected to the Oracle database with Net8. You could use Microsoft Systems Management Server (SMS) to distribute the TNSNAMES.ORA and SQLNET.ORA files to each PC. If you want to make a server a client to another server, you can copy or FTP SQLNET.ORA and TNSNAMES.ORA to the database server.

TRACE_LEVEL_CLIENT = OFF
sqlnet.authentication_services = (NTS)
names.directory_path = (TNSNAMES, HOSTNAME)
names.default_domain = world
name.default_zone = world
automatic_ipc = off

The settings for TRACE_LEVEL_CLIENT are similar to the TRACE_LEVEL_LISTENER parameter in LISTENER.ORA. The values for both parameters can be either a scale from 0 through 16 or the following predefined names (which correspond to numeric values):

AUTOMATIC_IPC can be turned on or off, depending on whether IPC is wanted.

A new parameter introduced in Net8, SQLNET.EXPIRE_TIME, is used for dead-connection detection. The recommended value for this is 10 (minutes). This parameter must be entered in the server's SQLNET.ORA file. It's a good idea to consult your network administrator before enabling this parameter; a packet-albeit small-would be sent out at the interval specified in the SQLNET.EXPIRE_TIME parameter.

Net8 Features

The following sections cover a few new Net8 features that have improved the product over SQL*Net 2.x.

Multiplexing

Oracle8 Enterprise Edition provides the Connection Manager, which facilitates multiplexing. Net8 takes in multiple client connections and combines or multiplexes them over a single transport connection through Oracle Connection Manager to the destination database. Multiplexing improves response time and increases the number of client connections. It also better uses resources on the server.

Multiplexing is available only on TCP/IP networks and only if the multithreaded server (MTS) option is used. You examine MTS later in the "Connecting to Multithreaded Servers" section. The Connection Manager uses the CMAN.ORA file to configure multiplexing.

Dead Connection Detection

This new feature identifies and terminates "dead" connections caused by improper client session termination. If dead-connection detection is enabled, a probe packet is sent to the client from the server. The client process is terminated if no response is received within a user-defined interval.

Dead-connection detection makes administration of the database a little bit easier; uncommitted transactions are rolled back and the locks associated with the transaction are released. In addition, resources associated with connection of the "dead" process aren't wasted.

Parallel Server Reconnections

Network configuration files for Oracle Parallel Server (OPS) have to be configured a little differently. In the TNSNAMES.ORA file, the ADDRESS_LIST should include the details of the nodes (host name, port number) and Oracle instance names (SIDs). This enables a client-side application to go through the list and connect to the first available instance for a service name. If an instance in the ADDRESS_LIST is unavailable, the client application simply goes on to the next available instance.

Configuring Net8

The following sections review the predefined configurations of Net8 that are part of the default installation of most Oracle client-side software, such as SQL*Plus 8.0. You also see how to use two tools specifically for client-side network configuration: Net8 Assistant and Net8 Easy Config, both of which are written in the Java programming language.

The Default TNSNAMES.ORA File

The sample TNSNAMES.ORA file created during a standard Oracle client installation has default samples that correspond to different network protocols (such as TCP, IPX, and Bequeath). You can ask your network administrator on what port the listener is listening (the default is normally 1521), as well as other details, such as database instance name (SID). Then you can drop, modify, or add aliases (services) to configure the client with the Net8 Assistant and Net8 Easy Config. This is covered in detail later in this chapter's "Using Net8 Assistant" and "Using Net8 Easy Config."

Use Net8 Easy Config and Net8 Assistant instead of an editor
Although you can modify TNSNAMES.ORA via a text editor such as Notepad, it's highly recommended that you use Net8 Easy Config or Net8 Assistant to modify the client side. Using the tools ensures that only the required changes are made to the existing file. When you use Windows Notepad or a UNIX editor such as vi, you might miss a parenthesis or type some extra, unwanted characters.

Oracle8 Server is packaged with a CD-ROM called Oracle8 Client, which creates a standard client configuration, including TNSNAMES.ORA and SQLNET.ORA files on the client. Because your client machine (PC or server) will be connected to the database server with just one networking protocol, you can choose your network protocol during the Oracle8 client installation. If one isn't chosen, the standard client installation creates a TNSNAMES.ORA with the most commonly used network protocols listed. You look at three sections of a default TNSNAMES.ORA file that explain TCP/IP, IPX/SPX, and Extproc:


TCP section
Server's host name
SPX section
Section for calling external procedures

As you can see in the default file, Oracle client-side installation gives you various choices for configuring the TNS alias or service name. The word world represents the domain; the letters prefixing the domain are the service names or aliases. A description of each alias follows each alias.world combination. This description varies for different network protocols.

Fortunately, you don't have to remember the syntax for each protocol adapter. It's always useful to know the syntax, though, so that if you have to move the files to a server, you can do so with minimal editing.

Oracle8 and Net8 have "external" stored procedure capability; the last service name (extproc_connection_data.world) describes the address for the external procedure. When stored or internal procedures written in PL/SQL programs call external procedures, the Net8 listener spawns a session-specific process and, using PL/SQL, passes information regarding the external procedure name, shared library name, and arguments (if needed). Examples of external programs are shared libraries written in a language such as C++/C. For more information on external procedures, refer to Oracle8 Server Administrator's Guide and PL/SQL User's Guide and Reference in the Oracle documentation set.

Using Net8 Assistant

Net8 Assistant, a new tool written in the Java programming language, has a similar look and feel on different platforms. It replaces Oracle Network Manager, which was packaged with Oracle Server through release 7.3.4. As Figure 24.3 shows, Net8 Assistant provides a graphical user interface that helps you administer and configure profiles (groupings of Net8 parameters), service names, and Oracle Names Servers. To launch the Net8 Assistant in Windows NT or Windows 95, choose Start, and then Programs, and then click Oracle for Windows NT/9x; select the Oracle Net8 Assistant icon.

Figure 24.3 : Create a profile by using Net8 Assistant's general options.

Configuring the Profile

As you can see in Figure 24.3, the Profile branch of the network tree on the left displays a drop-down box and tabbed pages on the right. Each item in the drop-down box presents different configuration pages.

If you select the General option, you can customize Tracing, Logging, Routing, and Advanced settings:

UNIX signal handling
When an event occurs in UNIX, a signal flags a process that executes the relevant process code. Because UNIX doesn't allow events to call more than one signal, it's possible that a signal may not be made properly, and a defunct or dead process may not be cleaned up. The BEQUEATH_DETACH parameter in the SQLNET.ORA profile turns UNIX signal handling off or on. The default value, NO, leaves signal handling on.

Selecting Naming from the Profile branch's drop-down list enables you to use various naming methods to configure your client/server connections. The page in Figure 24.4 has three tabbed pages: Methods, Oracle Names, and External.

Figure 24.4 : Use the Promote and Demote buttons on the Methods page to set the order of the naming convention used.

Disabling out-of-band breaks
The DISABLE_OOB parameter in the SQLNET.ORA profile is used to disable out-of-band breaks. This parameter's default value, OFF, keeps the out-of-band breaks on.

The Methods page includes two list boxes: Available Methods and Selected Methods. Oracle and Net8 uses the Naming methods in a top-down hierarchy. You can choose from several networking methodologies:

You use the Oracle Names page when your network configuration is using Oracle Names. This page enables you to set the following values:

The External page has these parameters available:

Configuring Service Names

The Service Names branch of the network tree enables you to create aliases or service identifiers for connecting Net8 clients to Oracle8 servers. The dialog box and sequence is exactly the same as detailed in the section "Using Net8 Easy Config."

Configuring Oracle Names Servers

The last option under the network tree, Oracle Names Servers, is used to configure Oracle Names. The administrative functions available for Oracle Names configuration include discovering an Oracle Names Server, Creating a Names Server, Reloading All Names Servers, Navigating Oracle Names Server, and other options.

Using Net8 Easy Config

To launch Net8 Easy Config, choose Start, and then Programs; then select Oracle for Windows NT/9x and Oracle Net8 Easy Config. The first screen is the Oracle Service Name Wizard (see Figure 24.5). You can use this wizard to create a new service, modify an existing service, and test existing services.

Figure 24.5 : Use the Oracle Service Names Wizard to configure network services.

Type in new service names
Select an existing service


In the following example, you use this wizard to add a service named FinProd. The alias (or service name) FinProd refers to an Oracle instance (SID) called finance running on server STARSHIP.

Verifying changes made in TNSNAMES.ORA with a text editor
You can view the TNSNAMES.ORA file in a text editor after changing or adding any information through Net8 Easy Config. You can see a new entry for the finance alias you create in the "Add a service with Net8 Easy Config" steps.

Add a service with Net8 Easy Config

  1. Launch Net8 Easy Config.
  2. The Existing Services list box lists all the service descriptors observed earlier in the default configuration file. To add a new service, click Add New Service and type FinProd in the Net Service Name text box. Click Next to move to the next dialog box.
  3. Select your network protocol. (Figure 24.6 shows TCP/IP selected.) Click Next.
    Figure 24.6 : Select a network protocol for configuring Net8 clients.
  4. Enter information about the database server name (Host Name) or IP address (see Figure 24.7). If the listener is set to listen on a port other than 1521, you can make the change here. Click Next.
    Figure 24.7 : Select a host name and listener port.
  5. Add the database instance name in the next dialog box-in this case, finance (see Figure 24.8).
    Figure 24.8 : Enter the database SID.
  6. Click Finish to save the service name (see Figure 24.9). However, it's recommended that you first test the service to see if it works (see Figure 24.10). If the test is successful, you can save this information.
    Figure 24.9 : Test the service to see if a connection can be made.
    Figure 24.10: Verify to see if the created service works.

Connecting to Other Products with ODBC

Open Database Connectivity (ODBC) is a programming interface developed by Microsoft for providing Windows client-side products connectivity to ODBC-compliant databases (Oracle, of course, is ODBC-compliant). To enable connectivity to ODBC databases, you must install an ODBC driver, which runs on "top" of Net8 drivers. In other words, you can install the ODBC drivers if you have client-side connectivity working with Net8. Oracle, as well as third-party vendors, make ODBC drivers for Oracle databases. Examples of products connecting to Oracle with ODBC are PowerBuilder (Professional Edition), Microsoft Access, Microsoft Visual Basic, and Seagate Crystal Reports.

For this example, configure an ODBC connection on a PC running Windows NT 4.0. The ODBC configuration utility is found in Control Panel. (When you install a standard Oracle client such as Net8 or SQL*Plus 8.0, you also can access another shortcut for the utility from the Oracle for Windows NT folder.) You also have to install the Oracle ODBC driver on your PC. (You need administrator access if you're using Windows NT.)

Some Oracle tools come with ODBC drivers
You may want to verify whether you have an ODBC driver already installed on your PC. The ODBC administrator will list an ODBC driver, if present.

The ODBC configuration utility has several tabbed pages (see Figure 24.11).

Figure 24.11: You need to configure ODBC on a PC to work with Oracle Server.

Data source name that only the user who configures it can see
Can be operated and seen by all users of the PC; also visible to Windows NT services
Enables you to connect to a data provider; users with the same drivers installed can share it
Lists all ODBC drivers installed on the PC
When tracing is enabled, logs all calls made to the ODBC drivers
Lists the core components for the 32-bit ODBC administrator

Add an ODBC system data source name

  1. From the Windows Start menu, select Settings and then Control Panel. Launch the ODBC tool.
  2. On the System DSN page, click the Add button. The Create New Data Source dialog box appears, listing all the ODBC drivers installed locally (see Figure 24.12).
    Figure 24.12: Create a new data source in the 32-bit ODBC Administrator.
  3. Either double-click the Oracle ODBC driver or select it and click Finish.
  4. Enter relevant information in the Oracle8 ODBC Driver Setup dialog box (see Figure 24.13). The Data Source Name, Description, and userid can be anything relevant to you. Enter FinProd in the Service Name text box. Click OK.
    Figure 24.13: Enter the data source name, description, and userid.

With this, you're done configuring your system DSN. As you can see in Figure 24.14, the DSN FinanceConnect is listed as a system data source.

Figure 24.14: Within each ODBC front-end product, all you need to do is simply use the name FinanceConnect hereafter as needed.

Connecting to Multithreaded Servers

When a client program such as SQL*Plus connects to an Oracle server with Net8, a process is spawned on the server. This process can be dedicated or shared (multithreaded). By default, the connection is made by using a dedicated server. For most online transaction processing (OLTP) applications, data is retrieved into client applications, operations are performed on the data, and changes are saved. Thus, data processing shifts between the client and the server.

It's not always advantageous in terms of system resources to use dedicated server processes. You should use a dedicated connection, however, for database administration activities and batch loads. If the server operating system can support it, you can use multithreaded or shared server processes (MTS). With the MTS option, a number of small processes share the workload of dedicated server processes. Two processes-shared servers and shared dispatchers-are created in addition to the standard Oracle database server processes.

Setting Net8 Entries and Initialization Parameters

To set up the MTS option, certain initialization parameters must be configured in the database instance's configuration file (INITSID.ORA) on the server. (INITSID.ORA's location varies from installation to installation.) You can use any text editor, such as Windows Notepad or UNIX vi, to configure the parameters:

MTS_LISTENER_ADDRESS = " (addr) "
MTS_LISTENER_ADDRESS =
"(ADDRESS=
(PROTOCOL=TCP)
(HOST=STARSHIP)
(PORT=1521)
)"
MTS_SERVICE = DB_NAME

Prerequisites for shared servers
The database server's operating system must support the MTS option. Oracle on that platform must also support the multithreaded server option. Oracle on most UNIX and VMS platforms supports the MTS option. The Oracle-to-Windows NT port doesn't support the MTS option.

Connecting to Shared Servers

To connect from client software to a database server running with the MTS option enabled, use regular aliases or services generated with Net8 Easy Config, Oracle Net8 Assistant, or both. The database instance has to be stopped and started after the preceding parameters are introduced in the initialization.

Managing Dispatchers

Oracle8 provides two dynamic views-V$DISPATCHER and V$QUEUE-to monitor load on the dispatcher processes. The number of dispatcher processes can be increased or decreased depending on the load and number of connections. Idle dispatchers are automatically terminated, until the number reaches MTS_DISPATCHERS, which acts as a lower limit for dispatcher processes. You can monitor this process from Server Manager (in motif mode) on UNIX servers.

SEE ALSO
For a listing of other dynamic views,

Managing Shared Servers

You also can monitor shared servers by using Server Manager in motif mode on UNIX-based systems. Idle shared server processes also are terminated automatically, to a lower limit of MTS_SERVERS.


© Copyright, Macmillan Computer Publishing. All rights reserved.