4 Configuring the Network Environment

After installing your Oracle software and database, you have a fully functional database with a client/server network environment that has been minimally configured.

This chapter contains the following topics to help you completely configure your client/server network:

Understanding Network Configuration

A client is any application that connects to the Oracle database to send or retrieve data. An Oracle client application can reside on any machine provided it has Oracle client software installed.

Oracle Net is a software component that resides on the client and on the Oracle database server. It establishes and maintains the connection between the client application and the server, and exchanges messages between them using industry standard protocols.

For the client application and a database to communicate, the client application must specify location details for the database it wants to connect to, and the database must provide some sort of identification or address.

See Also:

Oracle Database Net Services Administrator's Guide for more guidance in understanding Net Services and for more configuration details.

Oracle Net Listener Configuration

On the database server, the Oracle Net listener, commonly known as the listener, is a process that listens for client connection requests. The default listener configuration file is called listener.ora, and it is located in the ORACLE_HOME/network/admin directory. The file contains a protocol address that identifies the database. This address defines the protocol the listener is listen on and any other protocol specific information. For example, the listener could be configured to listen at the following protocol address:

   (ADDRESS=(PROTOCOL=tcp)(HOST=my-server) (PORT=1521)))

This example shows a TCP/IP protocol address that specifies the host machine of the listener and a port number.

The listener.ora file is automatically configured during installation, but can be configured with Enterprise Manager. For more information, see "Viewing Listener Configuration" and "Starting and Shutting Down the Listener" .

Client Configuration

When a client requests a connection, the listener on the server brokers the request and forwards it to the Oracle database.

The client uses a connect descriptor to specify the database it wants to connect to. This connect descriptor contains a protocol and a database service name. A database can have multiple services defined, so a specific service must be specified for the connection. In a preconfigured database, there is only one service, the name of which defaults to the global database name.

The following example shows a connect descriptor that enables clients to connect to a database service called mydb.us.acme.com:

   (ADDRESS=(PROTOCOL=tcp)(HOST=my-server) PORT=1521))

You can define your connect descriptors in your tnsnames.ora file on the client machine, located in the ORACLE_HOME/network/admin directory. You can use Oracle Net Manager to configure this file as described in "Configuring Oracle Networking on Client Machines" .

Connection Requests

Users initiate a connection request by providing a connect string. A connect string includes a username and password, and a connect identifier. This connect identifier can be the connect descriptor itself, or a name that resolves to the connect descriptor. One of the most common connect identifiers is a net service name, a simple name for a service. The following example shows a connect string that uses the net service name mydb as the connect identifier.

CONNECT hr/hr@mydb

While the connect identifier shown here is relatively simple, others can be long and inconvenient to use if your environment configuration is more complex. With long connect identifiers, you can map the net service name to the connect descriptor. This mapping information is stored in one or more repositories of information that are accessed with naming methods.

Naming Methods

Oracle Net provides support for the following naming methods:

The preconfigured database uses local naming. Only this form of naming is used in this book.

Local Naming

The local naming method stores connect descriptors, identified by their net service name, in a configuration file on the client named tnsnames.ora. This file is located in the ORACLE_HOME/network/admin directory.

Directory Naming

The directory naming method stores connect identifiers in a centralized, LDAP-compliant directory server.

Easy Connect Naming

The easy connect naming method enables clients to connect to an Oracle database server by using only a TCP/IP connect string consisting of a host name and optional port and service name:

CONNECT username/password@host[:port][/service_name]

For example:

CONNECT hr/hr@my-server:1521/mydb

The easy connect naming method requires no configuration.

External Naming

The external naming method stores net service names in a supported non-Oracle naming service. These supported third-party services include:

  • Network Information Service (NIS) External Naming

  • Distributed Computing Environment (DCE) Cell Directory Services (CDS)

Tools for Network Configuration

Oracle enables you to manage your network configuration with the following tools: Oracle Net Configuration Assistant, Enterprise Manager, and Oracle Net Manager.

Oracle Net Configuration Assistant

The Oracle Universal Installer launches Oracle Net Configuration Assistant after the database is installed. Use Oracle Net Configuration Assistant to configure the listening protocol address and service information for an Oracle database.

During a typical database install, Oracle Net Configuration Assistant automatically configures a listener called LISTENER that has a TCP/IP listening protocol address for the database. If you do a custom install, Oracle Net Configuration Assistant prompts you to configure a listener name and protocol address of your choice.

Use Oracle Net Configuration Assistant for initial network configuration after database installation. Thereafter, you can use the Oracle Enterprise Manager and Oracle Net Manager to configure and administer your networks.

Enterprise Manager

Enterprise Manager enables you to manage your server-side network configuration with two pages: the Listener page and the Net Services Administration page.

The Listener page displays the listener status and enables you to shut it down. You can navigate to this page from the Home page by clicking the Listener link under General. See "Viewing Listener Configuration" in this chapter.

You can navigate to the Net Services page from the Home page by clicking Listener under General. The Listener page appears. Under Related Links, click Net Services Administration.

The Net Services Administration page enables you to do the following:

  • Perform the following administrative tasks for a selected listener:

    • Show current status

    • Change status (start/stop listener)

    • Change tracing settings

    • Change logging settings

  • Configure the following:

    • Listener

    • Local naming (tnsnames.ora files) on the machine running the database

    • Directory naming

  • Search and sort local and directory naming entries

  • Export directory naming entries to tnsnames.ora file

Oracle Net Manager

You can access Oracle Net Manager from the command line or for Windows platforms through the Start menu.

  • For command line (UNIX, Linux, or Windows) run netmgr.

  • On Windows click the Start button and select Programs, Oracle - oracle_home, Configuration and Migration Tools, and then Net Manager

Oracle Net Manager provides the same features as Oracle Enterprise Manager with the addition of configuring profiles. To learn how to use this tool, see "Configuring Oracle Networking on Client Machines".

Viewing Listener Configuration

The listener runs on your database server machine and brokers incoming client requests. With Enterprise Manager, you can view the status of the listener, which is set to start automatically whenever your server machine is restarted.

To view the status of the listener, navigate to the Enterprise Manager home page. Under General, click Listener. The Listener: listener_name page appears. Under General, note the listener status, which is either Up or Down.

This page also gives the listener version, its net address, and start time.

You can additionally view the listener status at the command line using the following:

lsnrctl status

Starting and Shutting Down the Listener

The Oracle listener is set up to start automatically whenever your server machine is restarted. However, when your system encounters unforeseen circumstances, or when you have manually stopped the listener, you can restart it at the command line. To do so, use the following:

lsnrctl start

You can use Enterprise Manager to stop the listener. To do so, navigate to the Listener: listener_name page by clicking Listener on the Home page. To shut down the listener, click Stop.

You can also stop it at the command line using the following:

lsnrctl stop

Configuring Oracle Networking on Client Machines

Client machines need to be configured before they can connect to an Oracle database. To configure the client machine, you must first install Oracle client software, which includes Oracle Net software.

This example shows you how to configure a Windows client with local naming, which involves adding a connect descriptor entry to the local tnsnames.ora file. The connect descriptor specifies the host name, protocol address, and service name of the database to connect to.

On Windows, you can use the Oracle Net Manager program to create a new net service entry in your tsnames.ora file as follows:

  1. Start Oracle Net Manager by clicking the Start button and then selecting Programs, Oracle, Configuration and Migration Tools, and Net Manager.

  2. From the Local tree, select Service Naming and click the plus (+) on the left hand side of the page.

    The Net Service Name Wizard appears.

  3. Enter a net service name to identify it. The name you choose will appear under the Service Naming folder. Click Next.

  4. Select the protocol to use to connect to your database. For example, you can accept the default of TCP/IP (Internet Protocol). The database listener must be configured to use the same network protocol. Click Next.

  5. Enter the host name of the database machine, such as coconuts.island.com, and the port number. Click Next.

  6. Enter either the database service name or the database SID. In the Connection Type list, select either Shared Server, Dedicated Server, or Database Default. Shared connections require your database to be running in shared mode. If you choose Dedicated, then the database dedicates a single server process to serve your connection. If you are unsure or would like to use the default database connection type, select Database Default. Click Next.

  7. The last screen of the wizard enables you to test the connection by using the information you entered. To do so, click Test. To log in to the database, you can use the SYS user and the password you specified when you configured your database. The wizard tells you if the connection test succeed or not.

  8. Click Finish. The new service appears under the Service Naming folder. You can view or modify the configuration for the highlighted service in the Service Identification and Address Configuration sections.

Note that you can additionally run Oracle Net Manager from the command line using netmgr on Windows, Linux, and Unix platforms.

Networking: Oracle by Example Series

Oracle by Example (OBE) has a series on the Oracle Database 2 Day DBA book. This OBE steps you through the tasks in this chapter and includes annotated screen shots.

To view the Networking OBE, point your browser to the following location: