Tuesday, September 4, 2007

Configuring local name resolution in Oracle 10g

Configuring local name resolution in Oracle 10g

Learning objective

After completing this topic, you should be able to configure local name resolution in a given scenario

1. Name resolution

For an application to connect to a service through an Oracle Net listener, the application must know

  • the address or host where the listener resides
  • which protocol the listener will accept
  • which port the listener is monitoring

When the listener is located, the final piece of information the application needs is the name of the service it wants to connect to.

This connection information is stored in the local name resolution file, which is called tnsnames.ora and is located on the client machine.

A connect identifier can be a connect descriptor or a name that resolves to a connect descriptor such as a Net Service name, Database service name or Net Service alias.

A connect descriptor carries host, protocol, port, and service name information.

Oracle must convert a connect identifier into a connect descriptor.

This process of resolving connection information is called name resolution.

Oracle Net supports several name resolution methods:

  • Easy Connect
  • local naming
  • directory naming
  • external naming
Easy Connect
The Easy Connect method eliminates the need for looking up a Net Service name in the tnsnames.ora file.
local naming
Local naming resolves a Net service name, stored in the tnsnames.ora file located on a client.
directory naming
Directory naming resolves a Net Service name, stored in a centralized LDAP-compliant directory server.
external naming
External naming resolves service information stored in a third-party naming service.

Question

What information does a client application need to know to connect to a service using an Oracle Net listener?

Options:

  1. The address of the service requested
  2. The address or host where the listener resides
  3. The port the listener is monitoring
  4. The protocol the listener will accept

Answer

To connect to a service using an Oracle Net listener, a client application needs to know the address or host where the listener resides, the protocol the listener will accept, and the port the listener is monitoring.

Option 1 is incorrect. The address of a service is not needed to connect to the service using an Oracle Net listener. However, the name of the service is a required parameter to initiate a connection.

Option 2 is correct. This connection information is stored in a file named tnsnames.ora, which is located on the client machine.

Option 3 is correct. This connection information is stored in a file named tnsnames.ora, which is located on the client machine.

Option 4 is correct. This connection information is stored in a file named tnsnames.ora, which is located on the client machine.

Consider some advantages, disadvantages, and other noteworthy features of the main name resolution methods.

  • Easy Connect
  • Local naming
  • Directory naming
Easy Connect
The Easy Connect name resolution method simplifies network management by allowing a database connection to be completed without first configuring a net service name or performing other client-side configuration.

It also allows you to connect to different databases or instances running on the same computer.

Easy Connect is enabled by default. It only supports the TCP/IP protocol and does not support advanced connection options such as connect-time failover, load balancing or source routing.

With Easy Connect the user supplies all information required for the Oracle Net connection as part of the connect string.

The syntax for Easy Connect connection strings is shown.

< username>/< password>@< hostname>:< listenerport>/< servicename>

Here is an example of an Easy Connect command.

CONNECT hr/hr@db.us.oracle.com:1521/dba10g
Local naming
The local naming method requires the user to supply an alias for the Oracle Net Service.

Oracle Net checks the alias against a local list of known services and, if it finds a match, converts the alias into host, protocol, port, and service name information.

Local naming supports all Oracle Net protocols as well as advanced connection options such as connect-time failover, load balancing, and source routing.

The syntax for local naming connection strings is shown, with an example of a local naming command.

< username>/< password>@< service name>


CONNECT hr/hr@dba10g

One advantage of local naming is that the database users only need to remember a short alias rather than the long connect string required by Easy Connect.

Local naming is appropriate for organizations where Oracle Net service configurations do not change often.
Directory naming
The directory naming method requires the user to supply an alias for the Oracle Net Service.

Oracle Net checks the alias against an external list of known services and, if it finds a match, converts the alias into host, protocol, port, and service name information.

Directory naming supports all Oracle Net protocols as well as advanced connection options such as connect-time failover, load balancing, and source routing.

The syntax for directory naming connection strings is shown.

< username>/< password>@< service name>

The following is an example of a directory naming command:

CONNECT hr/hr@sales

As with local naming, database users only need to remember a short alias rather than the long connect string required by Easy Connect.

Another advantage of directory naming is that as soon as a new service name is added to the LDAP directory, the service name is available for users to connect with.

Directory naming is appropriate for organizations where Oracle Net service configurations change frequently.

Question

Match the naming methods to descriptions of how they work.

Options:

  1. Easy Connect
  2. Local naming
  3. Directory naming

Targets:

  1. The naming method that simplifies network management by allowing a database connection to be completed without the need to perform client-side configuration.
  2. The naming method that is most appropriate for simple distributed networks with a small number of services that change infrequently.
  3. The naming method that is appropriate for organizations where Oracle Net Services configurations change frequently.

Answer

Easy Connect simplifies network management by allowing a database connection to be completed without the need to perform client-side configuration. Local naming is most appropriate for simple distributed networks with a small number of services that change infrequently and Directory naming is appropriate for organizations where Oracle Net Services configurations change frequently.

The Easy Connect naming method eliminates the need for looking up a Net service name in the tnsnames.ora file.

One advantage of Local naming is that the database users only need to remember a short alias rather than the long connect string required by Easy Connect.

The advantage of Directory naming is that a new service name is available for use as soon as it is added to the LDAP directory.

Question

Suppose you're an Oracle database administrator with a company where Oracle Net Services configurations do not change often.

Identify the naming method that is most suited to your needs.

Options:

  1. Directory naming
  2. Local naming
  3. Easy Connect
  4. External naming

Answer

Local naming is appropriate for organizations where Oracle Net Services configurations do not change often.

Option 1 is incorrect. Directory naming is appropriate for organizations where Oracle Net Services configurations change frequently.

Option 2 is correct. Local naming supports all Oracle Net protocols as well as advanced connection options such as connect-time failover, load balancing, and source routing.

Option 3 is incorrect. Easy Connect supports the TCP/IP protocol only. It does not support advanced connection options such as connect-time failover, load balancing, and source routing.

Option 4 is incorrect. External naming resolves service information stored in a third-party naming service.

2. Configuring name resolution

Suppose you want to modify your local name resolution file so that you can connect to another database.

Enterprise Manager allows you to do this by creating a local Oracle Net Service alias.

In Enterprise Manager, you navigate to the listener properties page using the Listener link.

You click the Listener link.

The listener properties page displays.

In the Related Links section, you click the Net Services Administration link.

This brings you to the Net Services Administration page.

You now need to access the Local Naming page.

You click the down-pointing arrow of the Administer drop-down list box and select Local Naming. Then you click Go.

You are required to provide a username and password to log in to the host.

These appear automatically, so you click the Login button to continue.

The Local Naming page allows you to test, edit, create, and delete Net Service names.

You click Create to enter a new Net Service name.

This brings up the Create Net Service Name page.

To give the service a unique name, you enter testorcl in the Net Service Name field.

And, to identify the service, you ensure Use Service Name is selected in the Database Information section before entering orcl.oracle.com in the Service Name field.

You want requests to be served by the default database connection, so you ensure that Database Default is selected.

Next you need to add an address, so you click Add.

This brings you to the Add Address page.

Here you must make sure that TCP/IP is selected in the Protocol drop-down list.

Next, you need to configure the connection settings for your client machine by entering the client's port number and IP address.

You enter 1521 in the Port field and 10.5.163.56 in the Host field. Then you click OK.

You return to the Create Net Service Name page, where you click OK to save your settings.

Enterprise Manager generates a message confirming that you have successfully created an Oracle Net Service alias.

The next thing you want to do is create a backup address for the Net Service name. This will ensure that if your primary listener is unavailable, Oracle will automatically use your backup listener.

To do this, you need to edit the Net Service name you have created - in this case testorcl.

You select testorcl and click Edit.

This brings you to the Edit Net Service Name page.

You click Add to add an address.

The TCP/IP protocol is selected by default.

You enter 152 6 in the Port field and 10.5.163.56 in the Host field.

Then you click OK to return to the Edit Net Service Name page.

A new address has been added to the Net Service name.

You want to use this secondary address only when the first is unavailable, so you select Try each address, in order, until one succeeds from the Connect-time Failover and Client Load Balancing section. Then you click OK.

Question

Suppose you want to connect to a remote database. You need to create a new Net Service name called "testorcl". You need to configure this Net Service name to connect to the orcl.oracle.com database which is located at 10.5.163.56 and uses port 1521.

Identify the sequence of steps required to connect to the database

Options:

  1. You click Create and enter testorcl in the Net Service Name field orcl.oracle.com in the Service Name field. Then you click Add. You enter 1521 in the Port field and 10.5.163.56 in the Host field and click OK. Finally, you click OK to create the Net Service Name.
  2. You click Create and enter testorcl in the Net Service Name field orcl.oracle.com in the Service Name field. Then you click Add. Finally, you enter 1521 in the Port field and 10.5.163.56 in the Host field and click OK.

Answer

You click Create and enter testorcl in the Net Service Name field orcl.oracle.com in the Service Name field. Then you click Add. Finally, you enter 1521 in the Port field and 10.5.163.56 in the Host field and click OK.

Summary

For an application to connect to a service through an Oracle Net listener, it must obtain the connection information for the service. The process of resolving connection information is called name resolution. Naming methods for resolving connection information include Easy Connect, local naming, and directory naming.

To connect to a client through a listener, you need to create an Oracle Net Service name containing the client's connection information. To ensure that Oracle automatically uses your backup listener if your primary listener is unavailable, you create a backup Net Service name.

1 comment:

Blogger said...

BlueHost is one of the best website hosting provider for any hosting services you require.