Tuesday, September 4, 2007

Introducing Oracle Net Listener

Introducing Oracle Net Listener

Learning objective

After completing this topic, you should be able to recognize how to create and configure an Oracle Net listener in Oracle Database 10g.

1. The Oracle Net listener

You use Oracle Net Services to enable connections between the Oracle Database server and either clients or middle-tier applications.

Once you establish a network session, Oracle Net is responsible for transmitting the data, establishing and maintaining the connection, and exchanging messages.

For all of this to happen, either Oracle Net or a package that simulates it - such as Java Database Connectivity (JDBC) - must exist on each computer communicating with the database server.

On the client machine, Oracle Net is invisible to users - it's just a background component used by applications seeking database connections.

Among the many examples of applications seeking such connections are SQL*Plus, Oracle Forms, and Oracle Discoverer.

On the database server side, Oracle Net runs an active process called the listener. This process coordinates connections between the database and external applications.

It needs to run in order to make external connections to the database possible.

All remote user connections must pass through the Oracle Net listener. A single listener can service thousands of client connections.

You can control the Oracle Net listener using Database Control or the lsnrctl command line utility. To configure listeners you can use Database Control.

From the server perspective, Database Control controls the configuration of the listener itself, as well as general parameters such as log file locations and password protection.

Note

If you are an advanced administrator, you can configure Oracle Net Services by editing the configuration manually with a text editor.

Although Oracle Net is most typically used to enable incoming database connections, its services can be extended to permit access to external code libraries and procedures ( EXTPROC).

Oracle Net can also be extended to use Heterogeneous services to connect the Oracle instance to non-Oracle data sources, including Sybase, Informix, DB2, and SQL server.

Question

What is the key function of the listener in Oracle Net?

Options:

  1. To enable access to external code libraries and procedures ( EXTPROC)
  2. To make external connections to the database possible
  3. To use Heterogeneous services to connect the Oracle instance to non-Oracle data sources including Sybase, Informix, DB2, and SQL server

Answer

The key function of the listener in Oracle Net is to make external connections to the database possible.

Option 1 is incorrect. Although this functionality is available with Oracle Net, it is not the key role of the Oracle Net listener.

Option 2 is correct. Oracle Net runs the listener process on the database server side, to coordinate connections between the database and external applications. Without it, external connections to the database would be impossible.

Option 3 is incorrect. Although this functionality is available with Oracle Net, it is not the key role of the Oracle Net listener.

2. Monitoring and modifying listeners

Suppose you want to monitor listener settings using Database Control.

The General section of Enterprise Manager's Home page contains a link to the listener your server uses.

You select the LISTENER_localhost.localdomain link to find out more about your listener.

The General section of the Listener page allows you to view

  • the listener version and ORACLE_HOME
  • the first listening address for the listener
  • the location of the configuration files used to start the listener
  • the availability of the listener, and when it was started

If you click the hyperlinked values for Availability, Oracle Home, or Host, you will get more detailed information.

The State section of the Listener page allows you to monitor the listener response time - TNS Ping (ms) - and the average number of connections refused or established per minute.

You can click the hyperlinked values for each property for more information.

Question

You want to examine listener properties.

Identify the sequence of steps required to view the properties of the LISTENER_localhost.localdomain listener.

Options:

  1. Select the Listener hyperlink.
  2. Select the Oracle Home hyperlink.

Answer

You select the LISTENER_localhost.localdomain link.

Question

Which properties can you view on the Listener page?

Options:

  1. The contents of the listener's configuration file
  2. The first listening address for the listener
  3. The listener response time
  4. The listener version

Answer

You can access the first listening address, the listener response time, and the listener version.

Option 1 is incorrect. The listener configuration file is used to configure the listener, but no link to it displays on this page.

Option 2 is correct. The first listening address for the listener displays in the General section of the Listener page.

Option 3 is correct. You can monitor the listener response time by referencing the TNS Ping (ms) field in the Status section of the Listener page. Clicking the hyperlinked value for this property directs you to more detailed information.

Option 4 is correct. The listener version displays in the General section of the Listener page.

Let's say you want to create a new listener called BACKUP in case the existing listener fails.

The listener you want to create is a Net service.

To start creating a new listener, you first need to access the Net Services Administration page.

You select Net Services Administration from the Related Links section at the bottom of the listener properties page.

The Net Services Administration page allows you to administer network services from specific paths, specified in the Configuration File Location table.

You want to set up a listener, whose configuration files are to be placed in the selected path.

In the Administer drop-down list box, select Listeners and click Go.

The login prompt for the Net Services Administration host displays. The credentials for host login are entered automatically , so you just click Login.

A table listing the available listeners displays. In this case there is just one row entry for the listener called LISTENER. As it is the only entry, it is automatically selected.

You want to access the Create Listener page to create a new listener.

You click Create to open the page.

You must now name the listener or accept the default name.

Because it will be used for backup purposes, you call it BACKUP.

Next, you must specify an address for the listener. The currently empty Addresses table at the bottom of the screen is used to specify addresses.

To add an address, you click the Add button above the table.

Each address consists of a protocol, a port, and a host name.

As the default protocol, TCP/IP, is used on your network, you accept it.

You enter the port number 1526.

Note

Oracle Net's default port is 1521. If you choose to use a port other than 1521, you need to provide extra configuration for the listener or for the instance.

You enter an IP address for the local computer. And you click OK to save the address.

You are returned to the Create Listener screen.

A new address for your listener displays in the Addresses table.

You've done the minimum required to create a listener, and are happy with this level of customization.

So you click OK to create your new listener.

A message confirms that the listener has been created successfully.

Question

Which of these features must you specify or accept displayed default values for when you create a listener?

Options:

  1. A name
  2. An address
  3. A protocol
  4. Total send buffer size

Answer

You must specify a name, an address, and a protocol for the listener address or accept the defaults.

Option 1 is correct. All listeners must have a name. You can accept the default or enter one in the Listener Name field.

Option 2 is correct. Each address consists of a protocol, a port, and a hostname.

Option 3 is correct. You do have to supply a protocol or accept the default.

Option 4 is incorrect. Although you can specify this, you don't have to and no default is displayed. The minimum requirements are a name, an address, and a protocol.

Question

You need to create a new listener.

Starting from the Listener properties page, and given that your login details for the Net Services Administration Host are supplied automatically, identify the sequence of steps required to open the page in which you create a new listener.

Options:

  1. Select the Net Services Administration link from the Related Links section of the listener properties page.
    From the Administer drop-down list, select Listeners and click Go.
    Click Login.
    Click Create.
  2. Select the Net Services Administration link from the Related Links section of the listener properties page.
    From the Administer drop-down list, select Listeners and click Go.
    Click Create


Answer

You select the Net Services Administration link from the Related Links section of the listener properties page.Then from the Administer drop-down list, you select Listeners and click Go. After logging into the Net Services Administration host, you click Create.

3. Static and dynamic registration

Registration is the means by which listeners know the names and ORACLE_HOME locations of the instances to which they forward client connections. There are two kinds of registration:

  • dynamic registration
  • static registration
dynamic registration
Oracle8 i, Oracle9 i, and Oracle Database 10 g instances
automatically register with the default listener on database startup.

With this dynamic registration, no additional configuration is required for the default listener.
static registration
For Oracle Database releases predating Oracle 8 i, listener registration is not automatic. Instead you need to include a list of all database services serviced by the listener within the listener configuration file.

You can also opt for static service registration with newer releases. You would do this if

  • your listener was not on the default port 1521 and you did not wish to configure your instance to register with a nondefault port
  • your application required static service registration

You need to modify the BACKUP listener to handle static database registration.

In the Listeners page, you select BACKUP and click Edit.

The Edit Listener page opens at its General tabbed page.

You need to set up static database registration.

You select the Static Database Registration tab.

In the Static Database Registration tabbed page you list the database services you want to register in a table.

Currently there are no table items.

To register a database, you click the Add button.

In the Add Database Service page you enter the service name.

It matches the global database name - ORCL4. BROCADERO.COM.

Then you specify the ORACLE_HOME path.

Finally, you specify the SID for the database. This matches the database name - ORCL4.

To implement your changes, you click OK.

You are returned to the Static Database Registration tabbed page. You click OK again.

A message informs you that you have edited the BACKUP listener successfully.

You will have to restart your listener for the changes to take effect.

Question

Match the scenarios for using registration with the appropriate registration methods.

Options:

  1. You don't want additional configuration for the default listener
  2. You want to use the default for Oracle Database 10 g
  3. You're using a release of Oracle predating Oracle 8 i
  4. Your listener is not on port 1521 and you don't wish to configure your instance to register with a nondefault port.

Targets:

  1. Dynamic registration
  2. Static registration

Answer

Dynamic registration is appropriate when you don't want additional configuration for the default listener, or when you want to use the default for Oracle Database 10 g.

Static registration is appropriate when you're using a release of Oracle predating Oracle 8 i, or when your listener is not on port 1521 and you don't wish to configure your instance to register with a nondefault port.

Question

You need to apply static registration to the LISTENER listener.

Starting from the Edit Listeners page, identify the sequence of steps required to open the tabbed page that allows you to apply static registration to the LISTENER listener.

Options:

  1. Ensure that LISTENER's Select button is selected and click Edit.
    Click the Static Database Registration tab.
    Click Add.
  2. Ensure that LISTENER's Select button is selected and click Edit.
    Click the Other Services tab.
    Click Add.

Answer

You ensure that LISTENER's Select button is selected and click Edit. Then you click the Static Database Registration tab. Finally, you click Add.

Summary

On the database server side, Oracle Net runs an active process called the listener. This process coordinates connections between the database and external applications. The key function of the listener in Oracle Net is to make external connections to the database possible.

The listener properties you can view using Enterprise Manager include the first listening address, the listener response time, and the listener version. To create a listener, you need to log into the Net Services Administration Host. The minimum requirements for creating a new listener are a name and an address. The address consists of a protocol, a port, and a hostname.

Oracle8 i, Oracle9 i, and Oracle Database 10 g instances automatically register with the default listener on database startup, using a mechanism called dynamic registration. For Oracle Database releases predating Oracle 8 i, a non-automatic mechanism called static registration applies to listeners. With static registration, you need to include in the listener configuration file a list of all database services serviced by the listener .

No comments: