Oracle Essentials [Electronic resources] : Oracle Database 10g, 3rd Edition نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Oracle Essentials [Electronic resources] : Oracle Database 10g, 3rd Edition - نسخه متنی

Jonathan Stern

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید










3.3 Configuring Oracle Net


Oracle Net (known as
Net8 for Oracle8 and
Oracle8i, and SQL*Net prior to Oracle8) is a
layer of software
that allows different physical machines to communicate for the
purpose of accessing an Oracle
database.


The name Net8 was changed to Oracle Net in
Oracle9i, and we will
generally use "Oracle Net" in this
chapter as a neutral term to apply to all versions of Oracle
networking. The term "Oracle Net Services"
in Oracle refers to all the components of Oracle
Net, including dispatchers, listeners, and shared servers; these are
explained later in this chapter.

A version of Oracle Net runs on the client
machine and on the database server, and allows clients and servers to
communicate over a network using virtually any popular network
protocol. Oracle Net can also perform network protocol interchanges.
For example, it allows clients that are speaking LU 6.2 to interact
with database servers that are speaking TCP/IP.

Oracle Net also provides location
transparencythat is, the client application does
not need to know the server's physical location. The
Oracle Net layer handles the communications, which means that you can
move the database to another machine and simply update the Oracle Net
configuration details accordingly. The client applications will still
be able to reach the database, and no application changes will be
required.

Oracle Net introduces the notion of service names, or
aliases.
Clients provide a service name or Oracle Net alias to specify which
database they want to reach without having to identify the actual
machine or instance for the database. Oracle Net looks up the actual
machine and the Oracle instance, using the provided service name, and
transparently routes the client to the appropriate database.


3.3.1 Resolving Oracle Net Service Names


The following Oracle Net
configuration options resolve the service name the client specifies
into the host and instance names needed to reach an Oracle database:

Local name resolution


For local name resolution, you install a
file called
TNSNAMES.ORA
on each client machine that contains entries that provide the host
and Oracle instance for each Oracle Net alias. You must maintain this
file on the client machines if any changes are made to the underlying
database locations. Your network topology is almost certain to change
over time, so use of this option can lead to an increased maintenance
load.


Oracle Names service


Using the Oracle Names software that ships with
Oracle eliminates the need for a TNSNAMES.ORA
file on each client. When a client specifies a service name, Oracle
Net automatically contacts the Oracle Names server, typically located
on another machine. Oracle Names replies with the host and instance
information needed by the client. You can configure multiple Oracle
Names servers to provide redundancy and increased performance. Oracle
Names minimizes the overhead of updating the local
TNSNAMES.ORA files when there are frequent
changes to the Oracle network topology. Oracle Names can also be very
useful for complex networks that are widely distributed.


Oracle Internet Directory


The good part about the Oracle Names service is that it eliminates
the need for client configuration files. The bad part is that it is
proprietaryit applies only to Oracle databases. The need for a
centralized naming service extends far beyond the Oracle environment.
In fact, there is a well-defined standard for accessing this type of
information, the Lightweight Directory Access Protocol,
or LDAP. Since Oracle8i was released, the Oracle
database has shipped with the Oracle Internet Directory
(OID). OID is an LDAP-enabled directory that can fulfill the same
role as the Oracle Names service. The OID is also used for a variety
of other purposes, such as enabling single sign-on for the Oracle
Application Server Portal product, which is described in Chapter 14.
Although the use of Oracle Names was still supported in
Oracle9i, the future direction of this
functionality clearly lies with OID. In Oracle Database
10g, you can export directory entries to create
a local TNSNAMES.ORA file; this file may be used
for clients not using the directory or if the directory should not be
available.


Host naming


Clients can simply use the name of the host on which the instance
runs. This is valid for TCP/IP networks with a mechanism in place for
resolving the hostname into an IP address. For example, the Domain
Name Service (DNS) translates a hostname into an IP address, much as
Oracle Names translates service names. With Oracle Database
10g, you can use this method with either a host
name, domain-qualified if appropriate, or a TCP/IP address, but the
connection will not support advanced services such as connection
pooling.


Third-party naming services


Oracle Net can interface with external or third-party naming and
authentication services such as
Kerberos or Radius. Use of such services may require Oracle Advanced
Security (known as the Advanced Networking Option prior to
Oracle8i).



These name resolution options are not
mutually exclusive. For example, you can use Oracle Names and local
name resolution (TNSNAMES.ORA files) together.
In this case, you specify the order Oracle should use in resolving
names in the SQLNET.ORA file (for example, check
Oracle Names first, and if the service name isn't
resolved, check the local TNSNAMES.ORA file).
This is useful for cases in which there are corporate database
services specific to certain clients. You would use Oracle Names for
the standard corporate database services, such as email, and then use
TNSNAMES.ORA entries for the client-specific
database services, such as a particular development database.


3.3.2 Oracle Net Manager


In Oracle8, Oracle provided a GUI utility called the
Net8
Assistant used to create the various configuration files required for
Net8; this utility was renamed the Oracle Net Manager with the
Oracle9i release.

Like the Database Configuration Assistant, the Oracle Net Manager is
written in Java, provides the same look and feel across platforms,
and is typically first accessed from the installer. The
Oracle Net
configuration files have a very specific syntax with multiple levels
of nested brackets. Using the Oracle Net Manager allows you to avoid
the errors that are common to hand-coded files. This utility, which
automates the configuration of various Oracle Net components, is
shown in Figure 3-4 as it appears in Oracle Database
10g.


Debugging Network Problems


If you're having a
problem with your network, one of the first steps toward debugging
the problem is to check that the Oracle Net files were generated, not
hand-coded. If you're in doubt, back up the current
configuration files and use the Oracle Net Manager to regenerate
them. In fact, when Oracle Worldwide Support assists customers with
Oracle Net problems, one of the first questions they ask is whether
the files were hand-coded.


Figure 3-4. Net Manager



3.3.3 Auto-Discovery and Agents


Beginning with Oracle 7.3, Oracle provided auto-discovery features that allowed
it to find new databases automatically. Support for auto-discovery
has increased and improved with each Oracle release since then. With
Oracle8i, the Universal Installer and Oracle Net
Manager work together smoothly to automatically configure your Oracle
Net network. All that is required is the
INIT.ORA (or SPFILE in
Oracle9i or more current releases) entry that
maps the instance to the service or application, as described in the
sidebar "Generic Service Names"
later in this chapter. Auto-discovery and dynamic registration take
care of the rest.

A key piece of the Oracle network that enables auto-discovery is the
Oracle Intelligent Agent. The Agent is a
piece of software that runs on the machine with your Oracle
database(s). It acts as an agent for other functions that need to
find and work with the database on the machine. For example, the
Agent knows about the various Oracle instances on the machine and
handles critical management functions, such as monitoring the
database for certain events and executing jobs. The Agent provides a
central point for auto-discovery: Oracle Net discovers instances and
databases by interrogating the Agent. We'll examine
the Agent again in Chapter 5.


3.3.4 Oracle Net Configuration Files


Oracle Net requires several configuration files. The default location
for the files used to configure an Oracle Net network are as follows:

On Windows,
ORACLE_HOME\net80\admin for Oracle8 and
ORACLE_HOME\network\ admin for
Oracle8i and more current releases

On Unix,
ORACLE_HOME/network/admin


You can place these files in another location, in which case you must
set an environment or system variable called
TNS_ADMIN to the non-default location.
Oracle then uses TNS_ADMIN to locate the files. The vast majority of
systems are configured using the default location.

The files that form a simple Oracle Net configuration are as follows:

LISTENER.ORA


Contains
details for configuring the Oracle Net Listener, such as which
instances or services the Listener is servicing. As the name implies,
the Listener "listens" for incoming
connection requests from clients that want to access the Oracle
database over the network. For details about the mechanics of the
Listener's function, see Section 3.6.3.


TNSNAMES.ORA


Decodes a
service name into a specific machine address and Oracle instance for
the connection request. (If you're using Oracle
Names or OID, as described earlier, you don't need
to use the TNSNAMES.ORA file as part of your
configuration.) This file is key to Oracle Net's
location transparency. If you move a database from one machine to
another, you can simply update the TNSNAMES.ORA
files on the various clients to reflect the new machine address for
the existing service name. For example, suppose that clients reach
the database using a service name of
"SALES". The
TNSNAMES.ORA file has an entry for the service
name SALES that decodes to a machine named HOST1 and an Oracle
instance called PROD. If the Oracle database used for the SALES
application is moved to a machine called HOST2, the
TNSNAMES.ORA entry is updated to use the machine
name HOST2. Once the TNSNAMES.ORA files are
updated, client connection requests will be routed transparently to
the new machine with no application changes required.


SQLNET.ORA


Provides
important defaults and miscellaneous configuration details. For
example, SQLNET.ORA contains the default domain
name for your network. If you're using Oracle Names,
SQLNET.ORA can contain the address the client
uses to find the Oracle Names server and the order in which Oracle
Net should resolve service names.


LDAP.ORA


For
Oracle8i and beyond, the
LDAP.ORA file contains the configuration
information needed to use an LDAP directory, such as the Oracle
Internet Directory. This information includes the location of the
LDAP directory server and the default administrative context for the
server. This is no longer required for an LDAP server that is
registered with the Domain Name Server in Oracle Database
10g.



For more details on the inner workings of Oracle Net and the various
configuration options and files, see your Oracle networking
documentation or Oracle Net Configuration and
Troubleshooting, by Hugo Toledo and Jonathan Gennick (see
Appendix B for details).

Chapter 2,
Oracle9i added a feature called a
persistent parameter
file. This file, which is named
SPFILE,
provides storage for system parameters you have changed while your
Oracle9i instance is running, using the ALTER
SYSTEM command. With the SPFILE, these new
parameter values are preserved and used the next time you restart
your Oracle instance. You can indicate whether a particular change to
a system parameter is intended to be persistent (in which case it
will be stored in the SPFILE) or temporary.

The SPFILE is a binary file that is kept on the
server machine. By default, an Oracle9i or more
current instance will look first for the SPFILE
at startup and then for an instance of the
INIT.ORA file.

The SPFILE can also be kept on a shared disk, so
that it can be used to initialize multiple instances in an Oracle
Real Application Cluster.


Generic Service Names


Prior to Oracle8i,
the Listener on a database server was configured to listen for
specific instance names. Clients used a Net8 service name that
resolved the specific host and instance names. Starting with
Oracle8i, you can use the
SERVICE_NAMES parameter in the
initialization file for an instance to specify the generic service or
application name(s) the instance supports. When the instance is
started on the database server, it registers the
applications/services it supports with the Listener. The Oracle Net
name resolution files use service names that resolve to a host and an
application, not a host and an instance. The Listener on the host
then directs the client to the appropriate instance based on the
applications each instance is registered to support.

For example, suppose you had SALES and HR applications running on the
PROD instance on the HOST1 database. Prior to
Oracle8i, you would configure a Listener to
listen for the instance called PROD. Clients for both the SALES and
HR applications would use a service name that resolved to the HOST1
machine and the PROD instance. If you moved the SALES application to
another instance on the same host, you would have to update the
Oracle Net name resolution files to reflect the new instance name for
that application. With Oracle8i, the PROD
instance could have an INIT.ORA/SPFILE entry for
the SERVICE_NAMES parameter, specifying that it supports the SALES
and HR applications. When started, the PROD instance would register
dynamically with the Listener and would be associated with SALES and
HR. The entries in the Oracle Net name resolution files would decode
to HOST1 and an application name of SALES or HR instead of to HOST1
and the PROD instance. The Listener would automatically direct
clients that specify a service name of SALES or HR to the PROD
instance.

This level of indirection avoids the need to embed instance names in
the Oracle Net name resolution files, reducing administration time
and increasing the flexibility of the system. Suppose that you
migrate the data for the SALES application to another database. The
instance name for SALES users would now be different. Prior to
Oracle8i, you would have to update the Oracle
Net naming files to reflect the change to the instance name for
SALES. Since Oracle8i, you
don't have to embed the instance name for SALES in
the name resolution files. When the instance for the new database
containing the SALES data is started, it will register with the
Listener and will be associated with the SALES application. Clients
requesting a connection to HOST1 for the application SALES will
automatically be directed to the new instance by the Listener, with
no changes to the Oracle Net name resolution files.


/ 167