|Oracle® Database Net Services Administrator's Guide
11g Release 1 (11.1)
|PDF · Mobi · ePub|
This chapter is designed to help novice users set up and test a simple but common configuration—one between a client application and a database over a TCP/IP network.
This chapter contains these topics:
The tasks in this quick start guide show a TCP/IP connection between a client computer and a database server. The following about the database server and client computers is assumed:
Database Server Computer
It is running on the same network as the client.
An Oracle database is installed.
TCP/IP protocol support is installed.
A listener is configured.
It is running on the same network as the database server.
Oracle Client is installed.
TCP/IP protocol support is installed.
Before using Oracle Net to connect a client computer to a database server, confirm that the client computer can successfully communicate with the database server computer. Evaluating network connectivity can eliminate network-based errors.
To confirm network connectivity:
Confirm that the database server computer can communicate with itself with a loopback test.
A loopback test is a connection from the database server back to itself. Many network protocols provide a means of testing network connections. The utility PING can be used for TCP/IP network.
In a TCP/IP network, each computer has a unique IP address. A name resolution service, such as Domain Name System (DNS), can be used to map the IP address of a computer with its host name. If a name resolution service is not used, then the mapping is typically stored in a centrally maintained file called
hosts. This file is located in the
/etc directory on UNIX and the
\winnt directory on Windows. For example, an entry for a database server computer named
sales-server may look like the following:
#IP address of server host name alias 192.0.2.203 sales-server sales.us.example.com
To use PING, enter the following at the command line:
database_server_host is the host name of the database server computer. For example:
If the loopback was unsuccessful, try using the IP address of the database server. For example:
Verify the client computer can successfully communicate with the database server computer.
This varies according to the network protocol. For TCP/IP, you can use PING, FTP or TELNET utilities. If the client computer cannot reach the server, verify that the network cabling and network interface cards are correctly connected. Contact your network administrator to correct these problems.
Oracle Net Listener and the Oracle Database server must be running in order for the database server to receive connections.
Start the listener with the Listener Control utility. From the command line, enter:
listener_name is the name of the listener defined in the
listener.ora file. It is not necessary to identify the listener if you are using the default, named
A status message indicating that the listener has started successfully displays.
Start the database:
Start SQL*Plus without connecting to the database:
Connect to the database as SYSDBA:
SQL> CONNECT username AS SYSDBA
SYSTEM is a SYSDBA user. You will be prompted to enter a password.
Note:For simplicity in demonstrating this feature, this example does not perform the password management techniques that a deployed system normally uses. In a production environment, follow the Oracle Database password management guidelines, and disable any sample accounts. See Oracle Database Security Guide for password management guidelines and other security recommendations.
STARTUP command, specifying the database name and full path of the parameter file:
SQL> STARTUP database_name pfile=file
If you do not specify the
PFILE option, the Oracle database uses the standard initialization parameter file located in the
$ORACLE_HOME/dbs directory on UNIX platforms, and
%ORACLE_HOME%\database directory on Windows. If you do not specify a database name, then the database uses the value of the
DB_NAME parameter specified in the initialization parameter file.
See Also:Oracle Database Administrator's Guide for further information about starting the database
Confirm that database service registration with the listener has completed. From the Listener Control utility, enter:
SERVICES command lists the services supported by the database, along with at lease one available service handler.
See Also:"Monitoring Services of a Listener"
Once network connectivity has been verified, you can use easy connect naming to connect to the database.
NOTE:Starting with Oracle Database 10g, Oracle Database does not support the use of Oracle Names. Oracle Database 11g clients and databases cannot use Oracle Names, including by LDAP proxy, to resolve naming. Oracle8i and Oracle9i clients can still use Oracle Names to resolve naming for an Oracle Database 11g database; however, customers are strongly recommended to migrate to LDAP to take advantage of the new features of Oracle Database 11g.
The easy connect naming method can eliminate the need for service name lookup in the
tnsnames.ora files for TCP/IP environments. This naming method provides out-of-the-box TCP/IP connectivity to databases. It extends the functionality of the host naming method by enabling clients to connect to a database server with an optional port and service name in addition to the host name of the database.
Note:In Oracle Call Interface documentation,
serveris referred to as
If you have performed Oracle Database server install in Typical mode, the default service name used by the
oracle instance is
ORCL, and the following easy connect syntax can be used to connect to that instance:
CONNECT username@host/ORCL Enter password: password
See Also:"Using the Easy Connect Naming Method" for more information on using this method
If you do not want to use the easy connect naming method, you can use Oracle Net Configuration Assistant to create a net service name, a simple name for the database service. The net service name resolves to the connect descriptor, that is, the network address of the database and the name of the database service. The client will use the net service name to connect to the database.
The following example shows the net service name
sales mapped to a connect descriptor for a database called
sales.us.example.com. A client can use
sales mapped to connect to
sales= (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=sales-server)(PORT=1521)) (CONNECT_DATA= (SERVICE_NAME=sales.us.example.com)))
To configure a client with a net service name:
Start Oracle Net Configuration Assistant.
See Also:"Oracle Net Configuration Assistant"
The Welcome page appears.
Select Local Net Service Name Configuration.
The Net Service Name Configuration page appears.
Click Add, and then click Next.
The Net Service Name Configuration, Database Version page appears:
If the destination service is an Oracle9i or Oracle8i database, then select Oracle8i or later database or service. If destination service is an Oracle8 release 8.0 database, then select Oracle8 release 8.0 database or service.
The Net Service Name Configuration, Service Name appears.
Enter the name that identifies the database.
The service name is defined during database creation. If you are unsure what the service name is, ask the Database Administrator who created the database.
The Net Service Name Configuration, Select Protocols page appears.
Select the protocol on which the listener is configured to listen. Note that this protocol must also be installed on the client. The listener is configured to listen on TCP/IP by default.
The page appropriate for the selected protocol appears.
Enter the appropriate protocol parameters for the selected protocol in the fields provided, and then click Next.
The Net Service Name Configuration, Test page appears.
Click Yes perform a test.
During a test, Oracle Net Configuration Assistant contacts the remote database service, establishes a connection, and ends contact.
A successful test results in the following message:
If the test fails, it can be because the:
Default username (
scott) and password (
tiger) are not valid
Protocol address information does not match the listener information
The listener is not running
Destination database service is down
Depending on your diagnosis of the problem, perform one of the following tasks:
Click Change Login to change the username and password for the connection.
Click Back to review protocol address information.
Start the listener or Oracle Database on the server, as described in "Task 2: Start Oracle Net Listenerand the Oracle Database Server".
The Net Service Name Configuration, Net Service Name page appears.
Accept the default net service name or enter another net service name in the Net Service Name field. The name you enter should be unique to the client.
The Net Service Name Configuration, Another Net Service Name page appears.
Click No, and then click Next.
The Net Service Name Configuration, Configuration Done page appears.
From the client computer, connect to the database server as follows.
Connect to the database as follows:
CONNECT username@net_service_name Enter password: password
password are the database user and password, and
net_service_name is the net service name that you created in "Task 3: Configure the Client for Connection to a Database".