Tuesday, September 4, 2007

Advanced connection options in Oracle 10g

Advanced connection options in Oracle 10g

Learning objective

After completing this topic, you should be able to recognize how to configure advanced connection options and test Oracle Net connectivity.

1. Advanced connection options

Suppose you have set up listeners to access your database using multiple addresses.You can specify the order in which the addresses are used.

Using advanced connection options, Oracle Net can take advantage of listener failover and load balancing, as well as Oracle Connection Manager source routing.

Oracle Net supports advanced connection options with local and directory naming, such as

  • connect-time failover
  • load balancing
  • source routing
connect-time failover
Using connect-time failover, the alias lists multiple listener addresses. If the first listener does not respond, the second is tried. Oracle Net keeps trying addresses in order until it contacts an available listener, or until all addresses have been tried and failed.
load balancing
Using load balancing, Oracle Net chooses an address at random from the list of addresses. In Real Application Clusters, this balances the workload across multiple instances of the same database.
source routing
Source routing is used with Oracle Connection Manager. Oracle Net treats the addresses as a list of relays, connecting to the first address and then requesting to be passed from the first to the next until the destination is reached.

Unlike failover and load balancing, source routing uses all addresses each time a connection is made.

In summary, Oracle Net provides five choices for enabling failover, load balancing, and source routing. This table illustrates how these choices relate to each connection option.

Question

Match the advanced connection options to their descriptions.

Options:

  1. Connect-time failover
  2. Load balancing
  3. Source routing

Targets:

  1. This option tries each address in order until it reaches a listener that is functioning.
  2. This option picks an address at random from the list of addresses.
  3. This option uses all addresses each time a connection is made.

Answer

Connect-time failover tries each address in order until it reaches a listener that is functioning. Load balancing picks an address at random, and source routing uses all addresses each time a connection is made.

In connect-time failover, Oracle Net keeps trying addresses until all addresses have been tried and failed.

In Real Application Clusters, the workload is balanced across multiple instances of the same database.

Source routing is used with Oracle Connection Manager.

2. Oracle Net Manager

While you can use Enterprise Manager for server-side configuration, it does not allow you to configure client or middle-tier settings.

However, Oracle Net Manager is a graphical user interface tool that you can use on either the client or the server. It provides a simple method of configuring and managing Oracle Net.

You can use Oracle Net Manager to configure the following network components:

  • naming
  • name-resolution methods
  • profiles
  • listeners
naming
You can define simple names and connect identifiers and map them to connect descriptors to identify the network location and identification of a service.
name-resolution methods
You can configure the various ways in which connect identifiers are resolved into connect descriptors.
profiles
You can configure preferences for enabling and configuring Oracle Net features on the client or server.
listeners
You can create and configure listeners to receive client connections.

If an Oracle Names server is configured, you can start, stop, tune, or gather statistics for it with Oracle Net Manager.

Question

What can you configure with Oracle Net Manager?

Options:

  1. Service names
  2. Profiles
  3. Name-resolution methods
  4. Listener stopping and starting

Answer

Oracle Net Manager allows you to configure service names, profiles, and name-resolution methods.

Option 1 is correct. You can define simple names and connect identifiers and map them to connect descriptors to identify the network location and identification of a service.

Option 2 is correct. You can configure preferences for enabling and configuring Oracle Net features on the client or server.

Option 3 is correct. You can configure the different ways in which connect identifiers are resolved into connect descriptors.

Option 4 is incorrect. You can configure new and existing listeners, but you can't stop and start them.

The command to start Oracle Net Manager is netmgr.

You type netmgr and press Enter.

The Oracle Net Manager interface contains a navigation tree on the left and a detail window on the right.

By clicking the + (plus sign) icon, you can expand each folder in the navigation tree. You can then configure your settings.

Suppose you want to configure the name-resolution methods a client or middle-tier will use and the order in which they are checked. You expand the Local folder and select the Profile node.

The detail window displays two lists of name-resolution methods, Available Methods and Selected Methods, with buttons that allow you to transfer methods from one list to the other and promote and demote the selected ones.

In this example, TNSNAMES (local naming) and EZCONNECT (Easy Connect) are selected by default.

With this default configuration, Oracle Net first examines the local name-resolution file, then attempts to use Easy Connect until it either finds a match for the user-supplied connect string or fails.

Suppose you want to enable directory naming (LDAP).

You select LDAP and click the right-pointing arrow button.

LDAP now appears at the bottom of the Selected Methods list. This means that directory naming will be the last name-resolution method Oracle Net attempts to use.

Suppose you want directory naming to be checked before Easy Connect. You select LDAP and click the Promote button.

With this new configuration, Oracle Net first examines the local name-resolution file, then checks the directory server, and finally attempts to use Easy Connect.

You can also use Oracle Net Manager to create and configure local or directory naming of Net Service aliases.

Suppose you want to configure a Net Service alias for local naming. The first thing you do is select Service Naming in the tree structure.

Then you need to open the Net Service Name wizard. To do this, you can select Edit - Create but in this case you decide to use the toolbar on the left.

You click the Plus (+) button.

This opens the Net Service Name wizard.

On the first page of the wizard, you need to choose an alias name. You type primary in the Net Service Name field and click Next.

Then you select the protocol you use to communicate with the database across a network. In this case TCP/IP is selected by default, so you accept this setting and click Next.

Next, you enter the protocol settings. You type 10.5.163.56 in the Host Name field. You accept the default port setting - 1521 - and click Next.

On this page, you can choose the actual service name that the listener is handling. You enter orcl1 and click Next.

The last page of the wizard gives you the option of performing a test to confirm that the settings you have entered are valid. You decide not to perform a test, so you click Finish.

You have successfully configured your Net Service alias.

Question

Use Oracle Net Manager to configure your name resolution methods such that Oracle Net first examines the local name-resolution file, then attempts to use Easy Connect, and finally checks the directory server.

Which sequence of steps would you use to complete this task?

Options:

  1. Select EZCONNECT and click the right-pointing arrow button. Then select EZCONNECT again and click Promote.
  2. Select EZCONNECT and click Promote.

Answer

You select EZCONNECT and click the right-pointing arrow button. Then you select EZCONNECT again and click Promote.

3. Configuring advanced connection options

Oracle Net Manager allows you to implement advanced connection options such as connect-time failover, load balancing, and source routing.

Suppose you need to configure source routing for the orcl1 Net Service name. You select the orcl1 node to display the relevant details.

Then, you click the Advanced button.

The Address List Options window displays. To enable source routing, you need to instruct Oracle Net to use each address in order until it reaches a destination.

You select Use each address in order until destination reached and click OK.

You have successfully enabled source routing for the orcl1 Net Service name. Your changes will be made once you save the configuration.

Question

You have created the Net Service name "primary". Use Oracle Net Manager to configure source routing for this Net Service name.

Which sequence of steps would you use to complete this task?

Options:

  1. Click the Advanced button. Then select Use each address in order until destination reached and click OK.
  2. Click the Show Advanced button. Then select Use each address in order until destination reached and click OK.

Answer

You click the Advanced button. Then you select Use each address in order until destination reached and click OK.

4. Test connectivity

When you are happy with your configuration, you need to test the connectivity between the client and the listener.

The tnsping utility provides a way of verifying that the host name, port, and protocol reach the listener. It does not check that the listener handles the service name, and provides no indication of the state of the database.

The tnsping utility only reports whether the listener process is up, with minimal timing or error information.

If a connection can be established from a client to a server, tnsping will report the number of milliseconds it took to reach the remote service. If the test is unsuccessful, an error message will display.

The tnsping utility also supports Easy Connect name resolution.

Question

What functionality does tnsping provide?

Options:

  1. It checks that your database's listener is up and running
  2. It checks that your database is operating smoothly
  3. It supports Easy Connect name resolution
  4. It verifies that your database is mounted

Answer

The tnsping utility checks that the listener for your database is up and running, and it supports Easy Connect name resolution.

Option 1 is correct. If a connection can be established from a client to a server, tnsping will report the number of milliseconds it took to reach the remote service.

Option 2 is incorrect. The tnsping utility only reports whether the listener process is up - it provides no indication of the state of the database.

Option 3 is correct. As long as TCP is working, tnsping can test listeners for all services listed in the tnsnames.ora file, although it does not report whether the services themselves are actually available.

Option 4 is incorrect. The tnsping utility does not provide this information. However, it does allow you to check that your database's listener is up and running.

The tnsping utility uses the following syntax:

tnsping < hostname>:< portnumber>/< Net_Servicename>

Suppose you want to test that the listener for your database is up and running. The hostname is 10.5.163.56. It uses port 1521 and the Net Service name is orcl8.

You enter tnsping to complete the command.

The tnsping utility confirms that the listener process is up.

Question

Suppose the hostname of your Oracle Net listener is 10.5.163.22. It uses port 1521 and its Net Service name is orcl2.

Complete the command used to test the specified Oracle Net listener.

Answer

You add tnsping so that the complete command to test the specified Net Service alias reads

tnsping 10.5.163.22 :1521/ orcl2

Summary

If your database can be accessed by multiple listeners, you can specify the order in which the addresses are used. Oracle Net supports advanced connection options, such as connect-time failover, load balancing, and source routing.

Oracle Net Manager is a graphical user interface tool that you can use for configuring and managing service names, name-resolution methods, profiles, and listeners in Oracle Net.

You can also use Oracle Net Manager to implement advanced connection options.

The tnsping utility provides a way of testing the connectivity between the client and the listener. It verifies that the hostname, port, and protocol reach the listener, but does not check that the listener handles the service name or that the requested service is available.

No comments: