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

B28301-04
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
PDF · Mobi · ePub

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 provided it 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 some sort of identification or address. 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.

Using service names can provide location transparency such that the client application does not need to know the server's location. When the database is moved to another location, you need to reconfigure only Oracle Net. No changes are necessary to client applications.

This section contains these topics:

Oracle Net Listener Configuration

On the database server, 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 Oracle_home/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=my-server) (PORT=1521)))

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

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

Because all of the configuration parameters have default values, it is possible to start and use a listener without configuring it. This default listener has a name of LISTENER, supports no service names upon 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. Supported service names, that is, the service names, or databases, to which the listener forwards client requests, can be configured in the listener.ora file, or this information can be dynamically registered with the listener. This dynamic registration feature is called service registration. The registration is performed by the process monitor (PMON) process—an instance background process—of each database instance that has the necessary configuration in the database initialization parameter file. Dynamic service registration does not require any configuration in the listener.ora file.

See Also:

Oracle Database Net Services Administrator's Guide for more information about configuring listeners

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 configuration file on the client 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.

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, Oracle home location, and 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 server computer 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 server computer 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. (Linux and UNIX systems only) Set the required environment variables by running the script oraenv (for the Bourne, Korn, or Bash shells) or coraenv (for the C shell).

    These scripts are typically located in the /usr/local/bin directory. They may prompt you for the desired value of the ORACLE_SID environment variable. If so, supply the system ID (SID) that you chose when you installed Oracle Database. The default SID that the installer typically suggests is orcl.

  3. (Linux and UNIX systems only) Either ensure that the Oracle_home/bin directory is in your PATH environment variable, or change the directory to Oracle_home/bin.

  4. Enter the following command:

    lsnrctl status
    

Starting and Stopping the Listener

The Oracle listener is set to start automatically whenever your server computer 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, click the Listener link under General.

    The Listener page appears.

  2. Click Stop.

To start the listener with Database Control:

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

    The Listener page appears.

  2. Click Start.

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 stop the listener at the command line:

  1. Open a command window.

  2. (Linux and UNIX only systems) Set the required environment variables by running the script oraenv (for the Bourne, Korn, or Bash shells) or coraenv (for the C shell).

    These scripts are typically located in the /usr/local/bin directory. They may prompt you for the desired value of the ORACLE_SID environment variable. If so, supply the system ID (SID) that you chose when you installed Oracle Database. The default SID that the installer typically suggests is orcl.

  3. (Linux and UNIX systems only) Either ensure that the Oracle_home/bin directory is in your PATH environment variable, or change the directory to Oracle_home/bin.

  4. Enter the following command:

    lsnrctl stop
    

To start the listener at the command line:

  1. Open a command window.

  2. (Linux and UNIX only systems) Set the required environment variables by running the script oraenv (for the Bourne, Korn, or Bash shells) or coraenv (for the C shell).

    These scripts are typically located in the /usr/local/bin directory. They may prompt you for the desired value of the ORACLE_SID environment variable. If so, supply the system ID (SID) that you chose when you installed Oracle Database. The default SID that the installer typically suggests is orcl.

  3. (Linux and UNIX systems only) Either ensure that the Oracle_home/bin directory is in your PATH environment variable, or change the directory to Oracle_home/bin.

  4. Enter the following command:

    lsnrctl start
    

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 the need to first configure Oracle Net Services.

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

  1. (UNIX and Linux only) Ensure that the required environment variables are set. At a minimum, PATH and ORACLE_HOME, must be set.

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

    • On UNIX, Linux, or Windows, open a command window and enter the following command:

      sqlplus
      
    • On Windows, 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"
    

    where:

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

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

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

    • service_name is one of the services defined by the database.

      If there are no service names specifically defined, then you can use the name of the service that the database creates by default. This service name defaults to the global database name, which consists of the database name (DB_NAME parameter) and domain name (DB_DOMAIN parameter).

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

    nick@"db.us.example.com/orcl.us.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/webfolder/technetwork/tutorials/obe/db/11g/r1/2day_dba/network/network.htm