Oracle9i Net Services Administrator's Guide Release 2 (9.2) Part Number A96580-02 |
|
|
View PDF |
Once you have completed configuring the network, you should make a connection and test each component to ensure that the network is functioning properly. Oracle Net Services provide a variety of tools to help you start, test, and control an Oracle Names server, listener, and Oracle Connection Manager.
This chapter outlines procedures to make a connection and test network components. This chapter contains these topics:
Connecting to a database involves starting network components and entering a connect string with a net service name, such as the following:
CONNECT username/password@connect_identifier
This section contains these topics:
Client workstations and other servers connect to a listener with a net service name when logging onto an Oracle database server.
After installing and configuring all the network components, you need to start them to make the network functional. Following is an outline of the tasks you should perform to start the network components.
Task 1: Start Oracle Names Servers
Task 2: Start Oracle Names Client Cache
Task 5: Start Oracle Connection Manager
Start Oracle Names servers using either Oracle Net Manager or Oracle Names Control utility on the computers where Oracle Names server software is installed and configured. To start Oracle Names servers, use either Oracle Net Manager or Oracle Names Control utility:
Use Oracle Net Manager... | Use Oracle Names Control utility... |
---|---|
|
The |
On Windows NT, an Oracle Names server can also be started through the Control Panel:
Oracle
HOME_NAME
Names
onames_server
service.To avoid clients looking up address information in an Oracle Names server each time, create a client cache of the information.
See Also:
"Task 5: (Optional) Configure Client Caches" for more information about client caches |
To create a client cache:
namesctl
NAMESCTL> START_CLIENT_CACHE
On Windows NT, the client cache can also be started through the Control Panel:
Oracle
HOME_NAME
ClientCache
service.For Oracle Net to accept connections on the database server, start the listener with the Listener Control utility on the server:
lsnrctl
LSNRCTL> STATUS [
listener_name]
where 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 listener, named LISTENER
.
If the STATUS
command indicates that the listener is running, go to Step 2. If the listener is not running, go to Step 3.
Even if the listener is running, stop the listener, and start it again before proceeding to Step 2. To stop the listener, enter:
LSNRCTL> SET PASSWORD
password
LSNRCTL> STOP [
listener_name]
SET PASSWORD
is only required if the password is set in the listener.ora
file. The password defaults to ORACLE
.
LSNRCTL> START [listener_name
]
The Listener Control utility will display a status message indicating that the listener has started successfully. Check that all expected services for that listener are listed in the services summary in the status message.
LSNRCTL> EXIT
On Windows NT, the listener can also be started through the Control Panel:
Oracle
HOME_NAME
TNSListener
service--the service name if you are using the default listener name LISTENER
--or Oracle
HOME_NAME
TNSListener
lsnr
, where lsnr
is the nondefault listener name.Use the tool of choice, such as SQL*Plus, to start the database:
sqlplus /nolog
SQL> CONNECT username/password as sysdba
STARTUP
command, specify 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_BASE/admin/
db_name
/pfile/
sid
directory on UNIX platforms, and ORACLE_BASE
\admin\
db_name
\pfile\
sid
directory on Windows NT. 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:
Oracle9i Database Administrator's Guide for further information about starting the database |
If Oracle Connection Manager is installed and configured, start it with the Oracle Connection Manager Control utility, entering commands in the following order:
CMCTL
CMCTL> START CMAN
Oracle Connection Manager displays a status message indicating that Oracle Connection Manager has started successfully.
CMCTL> EXIT
On Windows NT, Oracle Connection Manager also be started through the Control Panel:
Oracle
HOME_NAME
CMAdmin
service to acquire information about available Oracle Names Servers, and then click Start. If you are not using Oracle Names, do not start this service.Oracle
HOME_NAME
CMan
service to start Oracle Connection Manager, and then click Start.After the network components are started, as described in "Connecting to a Database", you should be able to make a connection across the network. How you make a connection depends upon the naming method you configured in Chapter 9, "Configuring Naming Methods", and the tool used for the connection.
The connect string takes the following basic form:
CONNECT username/password@connect_identifier
On most operating systems, you can define a default connect identifier. This way, a connect identifier does not need to be specified in the connect string. To define a default connect identifier, use the TWO_TASK
environment variable on UNIX platforms or the LOCAL
environment variable or registry entry on Windows NT.
For example, if the TWO_TASK
environment variable is set to sales
, you can connect to a database from SQL*Plus with CONNECT
username
/
password
rather than CONNECT username/password@sales
. Oracle Net checks if TWO_TASK
is set and uses the value sales
as the connect identifier. If it exists, Oracle Net connects.
See Also:
Oracle operating system-specific documentation for instructions on setting |
Further information about connect string format is provided in the following topics:
Connect identifiers used in a connect string cannot contain spaces, unless enclosed within single quotes (') or double quotes ("). In the following examples, a connect identifier and a connect descriptor that contain spaces are enclosed within single quotes:
CONNECT scott/tiger@'(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sales-server)
(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=sales.us.acme.com)))'
CONNECT scott/tiger@'cn=sales, cn=OracleContext, dc=us, dc=acme, dc=com'
Single quotes (') are required if a double quote (") is used in a connect identifier. For example:
CONNECT scott/tiger@'sales@Good"Fast"Food.com'
Likewise, double quotes (") are required if a single quote (') is used in a connect identifier. For example:
CONNECT scott/tiger@"cn=sales, cn=OracleContext, ou=Mary's Dept, o=acme"
Note: JDBC OCI Drivers support absolute naming. JDBC Thin Drivers support absolute naming only when the complete DN is used. See the Oracle9i JDBC Developer's Guide and Reference for further information. |
This section describes how to configure absolute names for the following namespaces:
For X.500 namespaces, the default directory entry defined for the client must be in one of the following formats:
[ou],o
[ou],o,c
where [ou]
represents an optional organizationalUnitName.
The absolute name the client uses as the connect identifier must be in one of the following formats:
cn[.ou].o
cn[.ou].o.c
where [cn]
represents the Oracle Net entry.
For example, consider a client that has been configured with a default Oracle Context of cn=OracleContext,ou=acctg,o=acme,c=us
.
The directory contains database object sales
with a DN of cn=sales,cn=OracleContext,ou=mktg,o=acme,c=jp
. In this scenario, the client requires a connect identifier of sales.mktg.acme.jp
(cn.ou.o.c
). Figure 16-1 depicts this example.
For domain component namespaces, the default directory entry defined for the client must be in one of the following formats:
dc[,dc][...]
ou,dc[,dc][...]
where [dc]
represents an optional domain component and [...]
represents additional domain component entries.
The absolute name the client must use in the connect identifier must be in one of the following formats:
cn.dc[.dc][...]
cn[.ou]@dc[.dc][...]
where [cn]
represents the Oracle Net entry.
Consider a client that has been configured with a default Oracle Context of cn=OracleContext,dc=us,dc=acme,dc=com
.
The directory server contains an entry for database object sales
with a DN of cn=sales,cn=OracleContext,dc=jp,dc=acme,dc=com
. In this scenario, the client requires a connect identifier of sales.jp.acme.com
(cn.dc.dc.dc
). Figure 16-2 depicts this example.
Consider the same default directory entry as Example 1. The directory server contains database object sales
with a DN of cn=sales,cn=OracleContext,ou=mktg,dc=jp,dc=acme,dc=com
. Notice ou=mktg
. Because domain components must be separated from organization units, the client requires a connect identifier of sales.mktg@jp.acme.com
(cn.ou@dc.dc.dc
). Figure 16-2 depicts this example.
There are a number of ways to initiate a connection to an Oracle server. Commonly used methods are described in these topics:
The specifics of use are slightly different in each case. Each of the general methods listed is briefly covered here. To identify the method used in a specific tool, refer to the user guide for the tool.
The general form of connecting an application to a database server from the command line is:
tool username/password@connect_identifier
For example:
SQLPLUS system/password@sales
To prevent the password from displaying during a logon, you can leave out the password parameter on the command line. For example:
SQLPLUS system@sales
You will be prompted to enter your password without it showing on screen.
Most Oracle tools can use the operating system command line to connect; some provide alternatives.
Some tools provide a logon screen as an alternative form of logon. A user can log on to a database server by identifying both the username and connect identifier (username
@
connect_identifier
) in the username field of the tool logon screen, and entering the password as usual in the password field.
In applications written using 3GL, the program must establish a connection to a server using the following syntax:
exec sql connect :username identified by :password
In this connection request, :
username
and :
password
are 3GL variables that can be set within the program either statically or by prompting the user. When connecting to a database server, the value of the :
username
variable is in the form:
username@net_service_name
The :
password
variable contains the password for the database account to which you are connecting.
Some Oracle tools have commands for database connections, once the tool has been started, to allow an alternative username to be specified without leaving the tool. SQL*Plus allows the CONNECT
command using the following syntax:
SQL> CONNECT username/password@net_service_name
For example:
SQL> CONNECT scott/tiger@serverx
This is very similar to the operating system command line method, except that it is entered in response to the tool prompt instead of the operating system prompt.
Other Oracle tools use slightly different methods specific to their function or interface. For example, Oracle CDE tools use logon buttons and a pop-up window with the username, password, and remote database ID field.
The preferred sequence for testing the network is as follows:
This section contains these topics:
To test a listener, initiate a connection from a client to any active database controlled by that listener, as described in "Testing Configuration on the Database Server".
To test Oracle Connection Manager, initiate a connection from a client to any active database for which a source route address has been created.
Once you have configured the network, test the configuration by performing a loopback test on the database server.
A loopback test uses Oracle Net to go from the database server back to itself, bypassing the Interprocess Communication (IPC). Performing a successful loopback verifies that Oracle Net is functioning on the database server.
To perform the loopback test, use Oracle Net Manager:
Testing assumes the database and listener are running. If they are not, see "Starting Oracle Net Services Components" to start components.
During testing, a Connection Test dialog box appears, providing status and test results. A successful test results in the following message:
The connection test was successful.
If the test was successful, proceed to Step 5.
If the test was not successful:
To test several different clients in your network, initiate a connection to a database server from each of them by following the instructions in "Entering a Connect String".
Oracle Net also provides the following tools to help evaluate network connectivity:
The TNSPING utility determines whether or not a service (for example, an Oracle database, an Oracle Names server, or any other Oracle service) on a Oracle Net network can be successfully reached.
If you can connect successfully from a client to a server (or a server to another server) using the TNSPING utility, it displays an estimate of the round trip time (in milliseconds) it takes to reach the Oracle Net service.
If it fails, it displays a message describing the error that occurred. This enables you to see the network error that is occurring without the overhead of a database connection.
To invoke the TNSPING utility, enter the following:
tnsping net_service_name [count]
Note: Different platforms may have different interfaces, but the program accepts the same arguments. Invoke TNSPING for the display of the proper interface requirements. |
net_service_name
: must exist in tnsnames.ora
file or the name service in use, such as NIS or DCE's CDS.count
(optional): determines how many times the program attempts to reach the server.If the net service name specified is a database name, TNSPING attempts to contact the corresponding listener. It does not actually determine whether or not the database itself is running. Use SQL*Plus to attempt a connection to the database.
Following are some examples of TNSPING.
To connect to a database using a net service name of sales
, the following is entered:
TNSPING sales
This produces the following message:
TNS Ping Utility for Solaris: Version 9.2.0.2.0 - Production on 25-JAN-2002 14:46:28 Copyright (c) 1997 Oracle Corporation. All rights reserved. Used parameter files: Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = sales-server)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = sales.us.acme.com))) OK (10 msec)
To determine whether a connection can be made to the sales
database, and to specify that TNSPING try to connect eight times and then give up, use the following syntax:
tnsping sales 8
This command produces the following message:
TNS Ping Utility for Solaris: Version 9.2.0.2.0 - Production on 25-JAN-2002 14:49:26 Copyright (c) 1997 Oracle Corporation. All rights reserved. Used parameter files: Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = sales-server)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = sales.us.acme.com))) OK (10 msec) OK (0 msec) OK (10 msec) OK (0 msec) OK (10 msec) OK (10 msec) OK (10 msec) OK (0 msec)
Below is an example of TNSPING attempting to connect to an invalid net service name:
tnsping badname
This attempt produces the following message:
TNS Ping Utility for Solaris: Version 9.2.0.2.0 - Production on 25-JAN-2002 14:51:12 Copyright (c) 1997 Oracle Corporation. All rights reserved. Used parameter files: TNS-03505: Failed to resolve name
Following is an example of using TNSPING to connect to a name that is valid, but that resolves to an address where no listener is located (for example, the listener may not be started):
TNS Ping Utility for Solaris: Version 9.2.0.2.0 - Production on 25-JAN-2002 14:46:28 Copyright (c) 1997 Oracle Corporation. All rights reserved. Used parameter files: Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = sales-server)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = sales.us.acme.com))) TNS-12541: TNS:no listener
To check whether a Oracle Names server can be reached, use a command using the protocol address as in the following:
tnsping '(ADDRESS=(PROTOCOL=tcp)(HOST=onames-server)(PORT=1575))'
A message similar to the following will be returned to the user:
TNS Ping Utility for Solaris: Version 9.2.0.2.0 - Production on 25-JAN-2002 15:28:37 Copyright (c) 1997 Oracle Corporation. All rights reserved. Attempting to contact (address=(protocol=tcp)(host=onames-server)(port=1575)) OK (60 msec)
The Trace Route Utility (TRCROUTE) enables administrators to discover the path or route a connection is taking from a client to a server. If TRCROUTE encounters a problem, it returns an error stack to the client instead of a single error. These additional error messages make troubleshooting easier.
TRCROUTE is different from TNSPING in that it travels as a special type of connect packet, and is routed as such. As it travels toward its destination, the TRCROUTE connect packet collects the TNS addresses of every node it travels through. If an error occurs, TRCROUTE collects error information that shows where the error occurred. The TRCROUTE displays the information collected on the client screen. You can redirect the TRCROUTE output to a file, and print it if you wish.
The TRCROUTE uses minimal resources. It gathers information in the connect data of a special connect packet; standard connect packets are not affected.
The server is not affected by TRCROUTE. The listener receives and processes the TRCROUTE connect packet. It returns the information to the client by putting it into a refuse packet. The server does not need to start up any new processes or deal with dummy connections.
To invoke TRCROUTE, enter the following from the command line:
trcroute net_service_name
The following are two examples of trace route output.
The following example shows a successful Trace Route packet that traveled from a client to a listener.
trcroute sales Trace Route Utility for Solaris: Version 9.2.0.2.0 - Production on 25-JAN-2002 14:35:05 Copyright (c) 1999 Oracle Corporation. All rights reserved. Route of TrcRoute: ------------------ Node: Client Time and address of entry into node: ------------------------------------------------------------- 25-JAN-2002 14:35:05 ADDRESS= PROTOCOL=TCP HOST=sales-server PORT=1521 Node: Server Time and address of entry into node: ------------------------------------------------------------- 25-JAN-2002 14:35:06
The following examples shows an unsuccessful Trace Route packet that could not reach the listener because the listener was not up.
trcroute sales Trace Route Utility for Solaris: Version 9.2.0.2.0 - Production on 25-JAN-2002 14:43:05 Copyright (c) 1999 Oracle Corporation. All rights reserved. Route of TrcRoute: ------------------ Node: Client Time and address of entry into node: ------------------------------------------------------------- 25-FEB-2002 14:43:05 ADDRESS= PROTOCOL=TCP HOST=sales-server PORT=1521 TNS-12203: TNS:unable to connect to destination TNS-12541: TNS:no listener TNS-12560: TNS:protocol adapter error TNS-03601: Failed in route information collection
To verify connectivity for a client computer, use Oracle Net Manager:
Testing assumes that the database and listener are running. If they are not, see "Starting Oracle Net Services Components" to start components.
During testing, a Connection Test dialog box appears, providing status and test results. A successful test results in the following message:
The connection test was successful.
If the test was successful, proceed to Step 5.
If the test was not successful:
To test an Oracle Names server, use the Oracle Names Control utility PING
command. Following are two ways to PING
the Oracle Names server labrador
in the us.acme
domain.
From the Oracle Names Control utility prompt, enter:
NAMESCTL> ping labrador.us.acme
You can test several Oracle Names servers with the same PING
command. For example:
NAMESCTL> ping huey.jp.acme duey.jp.acme louie.jp.acme
PING
responds with the time it takes to contact the Oracle Names server and return an acknowledgment. If PING
fails, make sure the Oracle Names server is started or double-check the configured address of the Oracle Names server.
The information stored in an Oracle Names server can be queried to verify registration with the QUERY
command.
To use the QUERY
command, use either Oracle Net Manager or Oracle Names Control utility:
Use Oracle Net Manager... | Use Oracle Names Control utility... |
---|---|
|
For a Oracle Names server in the administrative region, create and register an alias with the Oracle Names server: To display all data:
The record type of an object may also be requested. Common record types include: - - - - - To display the database address for a net service name:
The following example shows a query of the net service name
The |