Skip Headers
Oracle® Database 2 Day DBA
11g Release 2 (11.2)

Part Number E10897-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

4 Configuring the Network Environment

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

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

Understanding Network Configuration

A client is any application that connects to Oracle Database to send or retrieve data. An Oracle Database client application can reside on any computer that has Oracle Database client software installed.

Oracle Net is a software layer that resides on the client computer and on the Oracle Database host computer. It establishes and maintains the connection between the client application and the database over a network, and exchanges messages between them using industry standard protocols.

For a client application and a database to communicate, the client application must be able to identify the database it wants to connect to, and the database must provide an identification. You can use a service name to connect to a database. A service name is a logical representation of a database, which is the way a database is presented to clients. A single database can be presented as multiple services.

Service names can provide location transparency so that the client application does not have to know the server's location. If the database is moved to another location, then you must reconfigure only Oracle Net. No changes are necessary to client applications.

This section contains these topics:

Oracle Net Listener Configuration

On the database host, the Oracle Net listener (the listener), is a process that listens for client connection requests. It receives incoming client connection requests and manages the traffic of these requests to the database server.

The default listener configuration file is called listener.ora, and it is located in the network/admin subdirectory of the Oracle home directory. For example, if your Oracle home directory is /u01/app/oracle/product/11.2.0/dbhome_1, then the listener.ora file is created by default in the /u01/app/oracle/product/11.2.0/dbhome_1/network/admin directory.

The file contains a protocol address that identifies the database. This address defines the protocol the listener is listening on and any other protocol-specific information. For example, the listener could be configured to listen at the following protocol address:

(DESCRIPTION=
   (ADDRESS=(PROTOCOL=tcp)(HOST=dbhost.example.com) (PORT=1521)))

This example shows a TCP/IP protocol address that specifies the host computer of the listener and a port number. The listener can listen for connection requests on network interfaces with either IP version 4 (IPv4) or IP version 6 (IPv6) addresses.

The listener.ora file is automatically configured during installation, but you can reconfigure it with Oracle Enterprise Manager Database Control.

Because the configuration parameters have default values, you can start and use a listener without configuring it. This default listener is named LISTENER, supports no service names on startup, and listens on the following TCP/IP protocol address:

(ADDRESS=(PROTOCOL=tcp)(HOST=host_name)(PORT=1521))

An Oracle database registers with the listener within a minute or so of starting up. The service names, or the databases that they represent, to which the listener forwards client requests, can be configured in the listener.ora file. This information can also be dynamically registered with the listener. Dynamic registration of services and databases with the listener is called service registration.

Service registration is performed by the process monitor (PMON) process—an instance background process—of each database instance. Dynamic service registration does not require modification of the listener.ora file.

See Also:

Client Connections

The following sections describe the elements involved in client connections to the database:

Connect Descriptors

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

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

DESCRIPTION=
   (ADDRESS=(PROTOCOL=tcp)(HOST=my-server) PORT=1521))
   (CONNECT_DATA=
      (SERVICE_NAME=mydb.us.example.com))

Connection Requests

Users initiate a connection request by providing a connect string. A connect string includes a user name and password, and a connect identifier. This connect identifier can be the connect descriptor itself, or a name that resolves to the connect descriptor using mapping information stored in one or more repositories accessed with the naming methods described in "Naming Methods". This name is referred to as a net service name.

Naming Methods

A naming method is a resolution method used by a client application to resolve a connect identifier to a connect descriptor when attempting to connect to a database service.

Oracle Net provides support for the following naming methods:

  • Easy Connect Naming

    The easy connect naming method enables clients to connect to an Oracle database by using only a TCP/IP connect string consisting of a host name and service name. The easy connect naming method requires no configuration. See "Connecting to an Oracle Database from a Client Computer" for an example of easy connect naming.

  • Local Naming

    The local naming method stores connect descriptors, identified by their net service names, in a client configuration file named tnsnames.ora. This file is located in the ORACLE_HOME/network/admin directory. When you create a database using Oracle Database Configuration Assistant (DBCA), local naming is configured automatically. You must then use the Net Configuration Assistant to create connect descriptors and their corresponding net service names.

  • Directory Naming

    Directory naming resolves a database service, net service name, or net service alias to a connect descriptor stored in an LDAP-compliant directory server.

See Also:

Tools for Network Configuration

Oracle Database enables you to manage your network configuration with the following tools:

Net Configuration Assistant

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

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

Oracle Enterprise Manager

Oracle Enterprise Manager enables you to manage your server-side network configuration with a Listener page. The Listener page displays information such as the current status, the Oracle home directory in which the listener configuration files are located, and the host name.

Oracle Net Manager

Oracle Net Manager provides the same features as Oracle Enterprise Manager with the addition of configuring profiles.

Viewing Listener Configuration

The Oracle Net listener (the listener) runs on your database host and handles incoming client requests. With Oracle Enterprise Manager Database Control (Database Control), you can view the status of the listener, which is set to start automatically whenever your host is restarted. You can also view the listener status at the command line.

To view information about the listener with Database Control:

To view information about the listener at the command line:

  1. Open a command window.

  2. Follow the steps listed in "Configuring the Operating System Environment Variables".

  3. Enter the following command:

    lsnrctl status
    

Starting and Stopping the Listener

The Oracle listener is set to start automatically whenever the host is restarted. However, when your system encounters unforeseen circumstances, or when you have manually stopped the listener, you can restart it with Database Control or at the command line.

To stop the listener with Database Control:

  1. On the Database Home page, under General, click the Listener link.

    The Listener page appears.

  2. Click Stop.

  3. Enter the host credentials, if you did not configure Preferred Credentials, then click Login.

  4. On the Start/Stop Listener page, click OK to perform the specified action or Cancel to quit.

To start the listener with Database Control:

  1. On the Database Home page, under the heading General, click the Listener link.

    The Listener page appears.

  2. Click Start.

  3. On the Start/Stop Listener page, click OK.

    After a couple of minutes, a confirmation message appears, indicating that the listener has been started.

Note:

If you have just stopped the listener and are still at the Database Control Listener page, then you will not see a Start button. You must go to the Database Home page, wait a minute or two, and then return to the Listener page.

To start or stop the listener at the command line:

  1. Open a command window.

  2. Follow the steps listed in "Configuring the Operating System Environment Variables".

  3. Enter either of the following commands, depending on whether you want to start or stop the listener:

    lsnrctl start
    lsnrctl stop
    

Connecting to an Oracle Database from a Client Computer

This section describes how to use SQL*Plus and the easy connect naming method to connect to an Oracle database from a client computer. SQL*Plus is typically installed when you install Oracle Database client software. The easy connect naming method provides TCP/IP connectivity to databases without requiring you to configure Oracle Net Services.

You can use the instructions in this section to test your network configuration.

To connect to an Oracle database from a client computer using easy connect naming:

  1. Complete the steps in "Configuring the Operating System Environment Variables".

  2. Do one of the following to start SQL*Plus:

    • (UNIX, Linux, or Windows systems) Open a command window and enter the following command:

      sqlplus
      
    • (Windows systems only) Click Start, select Programs (or All Programs), then Oracle - HOME_NAME, then Application Development, and then SQL*Plus.

  3. When prompted, enter the user name followed by an at sign (@) and a connect identifier, where the connect identifier has the following format:

    "host[:port][/service_name][:server][/instance_name]"
    

    The place holders used in the connect identifier format represent:

    • host — the name or IP address of the Oracle database host computer.

      Both IPv4 and IPv6 addresses are supported. IPv6 addresses must be enclosed in square brackets. See Oracle Database Net Services Administrator's Guide for information about IPv6 addressing.

    • port (optional) — the TCP port number on which the Oracle Net listener listens for connections.

      If port is excluded, then the standard port number 1521 is assumed.

    • service_name — a database service name.

      If no database service names are defined, then you can use the name of the default service that is created for the database. This service name consists of the global database name, which is made up of the DB_NAME and DB_DOMAIN initialization parameters as follows:

      DB_NAME.DB_DOMAIN
      

      If DB_DOMAIN is null, then the standard service name is just DB_NAME.

    • server — the type of service handler. Acceptable values are dedicated, shared, and pooled. If omitted, then the default type of server is chosen by the listener: shared server if configured, otherwise dedicated server.

    • instance_name — the instance to which to connect. When you specify only instance name, you connect to the default database service. If there is no default service configured in the listener.ora file, then an error is generated.You can obtain the instance name from the INSTANCE_NAME initialization parameter.

    For example, to connect as user NICK to the database service orcl.example.com on the host dbhost.example.com, enter the following at the user name prompt:

    nick@"dbhost.example.com/orcl.example.com"
    

    The following examples substitute IPv4 and IPv6 addresses for the host name:

    nick@"192.0.2.1/orcl.example.com"
    nick@"[2001:0DB8:0:0::200C:417A]/orcl.example.com"
    
  4. When prompted, enter the user password.

See Also:

Networking: Oracle By Example Series

Oracle By Example (OBE) has a series on the Oracle Database 2 Day DBA guide. This OBE steps you through the tasks in this chapter and includes annotated screenshots.

To view the Networking OBE, in your browser, enter the following URL:

http://www.oracle.com/technology/obe/11gr2_2day_dba/network/network.htm