Oracle® Database 2 Day DBA 10g Release 2 (10.2) Part Number B14196-02 |
|
|
View PDF |
A client is any application that connects to the Oracle database to send or retrieve data. An Oracle client application can reside on any machine provided it has Oracle client software installed.
Oracle Net is a software component that resides on the client and on the Oracle database server. It establishes and maintains the connection between the client application and the server, and exchanges messages between them using industry standard protocols.
For the client application and a database to communicate, the client application must specify location details for the database it wants to connect to, and the database must provide some sort of identification or address.
See Also:
Oracle Database Net Services Administrator's Guide for more guidance in understanding Net Services and for more configuration details.On the database server, the Oracle Net listener, commonly known as the listener, is a process that listens for client connection requests. 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 listen 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 protocol address that specifies the host machine of the listener and a port number.
The listener.ora
file is automatically configured during installation, but can be configured with Enterprise Manager. For more information, see "Viewing Listener Configuration" and "Starting and Shutting Down the Listener" .
When a client requests a connection, the listener on the server brokers the request and forwards it to the Oracle database.
The client uses a connect descriptor to specify the database it wants to connect to. This connect descriptor contains a protocol and a database service name. A database can have multiple services defined, so a specific service must be specified for the connection. In a preconfigured database, there is only one service, the name of which defaults to the global database name.
The following example shows a connect descriptor that enables clients to connect to a database service called mydb.us.acme.com
:
(DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=my-server) PORT=1521)) (CONNECT_DATA= (SERVICE_NAME=mydb.us.acme.com)))
You can define your connect descriptors in your tnsnames.ora
file on the client machine, located in the ORACLE_HOME
/network/admin
directory. You can use Oracle Net Manager to configure this file as described in "Configuring Oracle Networking on Client Machines" .
Users initiate a connection request by providing a connect string. A connect string includes a username and password, and a connect identifier. This connect identifier can be the connect descriptor itself, or a name that resolves to the connect descriptor. One of the most common connect identifiers is a net service name, a simple name for a service. The following example shows a connect string that uses the net service name mydb
as the connect identifier.
CONNECT hr/hr@mydb
While the connect identifier shown here is relatively simple, others can be long and inconvenient to use if your environment configuration is more complex. With long connect identifiers, you can map the net service name to the connect descriptor. This mapping information is stored in one or more repositories of information that are accessed with naming methods.
Oracle Net provides support for the following naming methods:
The preconfigured database uses local naming. Only this form of naming is used in this book.
The local naming method stores connect descriptors, identified by their net service name, in a configuration file on the client named tnsnames.ora
. This file is located in the ORACLE_HOME
/network/admin
directory.
The directory naming method stores connect identifiers in a centralized, LDAP-compliant directory server.
The easy connect naming method enables clients to connect to an Oracle database server by using only a TCP/IP connect string consisting of a host name and optional port and service name:
CONNECT username/password@host[:port][/service_name]
For example:
CONNECT hr/hr@my-server:1521/mydb
The easy connect naming method requires no configuration.