Hello,
I am working with Oracle 10g. I have installed the client on my workstation and now I am trying to use TNSPING to test the connections in my TNSNAMES.ORA file.
When I try to use TNSPING though I get this error;
'tnsping' is not recognized as an internal or external command, operable program or batch file.
I have searched here and other places and I see that I am supposed to 'add the path' to C:oracleproduct10.2.0client_1BIN
I don't see any instructions how to do this though. Could someone describe where I do this and how I do it?
Thanks
for further information.
Description of 'Figure 15-1 Absolute Name for X.500 Namespaces'
Description of 'Figure 15-2 Absolute Name for Domain Component Namespaces'![Oracle Oracle](/uploads/1/2/6/4/126473355/837228261.jpg)
I am working with Oracle 10g. I have installed the client on my workstation and now I am trying to use TNSPING to test the connections in my TNSNAMES.ORA file.
When I try to use TNSPING though I get this error;
I use ODBC connections to link to Oracle databases. TNSPING (SPACE and then the SERVICE NAME without the prefix: or the.suffix).
'tnsping' is not recognized as an internal or external command, operable program or batch file.
I have searched here and other places and I see that I am supposed to 'add the path' to C:oracleproduct10.2.0client_1BIN
I don't see any instructions how to do this though. Could someone describe where I do this and how I do it?
Thanks
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 the 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
Connecting to a database involves starting network components and entering a connect string with a net service name, such as the following:
This section contains these topics:
Starting Oracle Net Services Components
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 the Listener
For Oracle Net to accept connections on the database server, start the listener with the Listener Control utility on the server:
- Determine the status of the listener. From the command line, enter:where
listener_name
is the name of the listener defined in thelistener.ora
file. It is not necessary to identify the listener if you are using the default listener, namedLISTENER
.If theSTATUS
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:SET PASSWORD
is only required if the password is set in thelistener.ora
file. The password defaults toORACLE
. - Start the listener. Enter: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.
- Exit from the Listener Control utility. Enter:
On Windows, the listener can also be started through the Control Panel:
- Select the Services icon in the Control Panel window.
- Select the
Oracle
HOME_NAME
TNSListener
service—the service name if you are using the default listener nameLISTENER
—orOracle
HOME_NAME
TNSListener
lsnr
, wherelsnr
is the nondefault listener name. - Click Start to start the service.
- In the Services window, click Close.
Task 2: Start the Database
Use the tool of choice, such as SQL*Plus, to start the database:
- Start SQL*Plus without connecting to the database:
- Connect to Oracle as SYSDBA:
- When you enter a
STARTUP
command, specify the database name and full path of the parameter file:If you do not specify thePFILE
option, the Oracle database uses the standard initialization parameter file located in the$ORACLE_BASE/admin/
db_name
/pfile/
sid
directory on UNIX platforms, andORACLE_BASE
admin
db_name
pfile
sid
directory on Windows. If you do not specify a database name, then the database uses the value of theDB_NAME
parameter specified in the initialization parameter file.See Also:Oracle Database Administrator's Guide for further information about starting the database
Task 3: Start Oracle Connection Manager
If Oracle Connection Manager is installed and configured, start it with the Oracle Connection Manager Control utility (CMCTL), entering commands in the following order:
- From the command line, enter:
instance_name
is the name of the Oracle Connection Manager that you would like to administer. You can determine the name by viewingcman.ora
, the Oracle Connection Manager configuration file. The file can be found at the following location on the Oracle Connection Manager computer:- UNIX:
- Windows:
Oracle Connection Manager displays a status message indicating the name of the instance and informing you that the instance has not yet been started.Note:If you do not provide an instance name as an argument, the Oracle Connection Manager with a fully qualified host name is administered. This is the default. After you issue the ADMINISTER command, CMCTL displays the instance name this way:CMAN_fully_qualified_host_name - Start the Oracle Connection Manager that you have chosen to administer:Oracle Connection Manager indicates that the instance has been started. In addition, it provides a status report for the instance.
- Exit from the Oracle Connection Manager Control utility. Enter:On Windows, Oracle Connection Manager can also be started through the Control Panel:
- Select the Services icon in the Control Panel window.
- Select the
Oracle
HOME_NAME
CMan
service to start Oracle Connection Manager, and then click Start. - In the Services window, click Close.
Entering a Connect String
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 8, 'Configuring Naming Methods', and the tool used for the connection.
The connect string takes the following basic form:
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.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 TWO_TASK
and LOCAL
Further information about connect string format is provided in the following topics:
Connect Identifier and Connect Descriptor Syntax Characteristics
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:
Single quotes (') are required if a double quote (') is used in a connect identifier. For example:
Likewise, double quotes (') are required if a single quote (') is used in a connect identifier. For example:
Absolute Name Specification for Directory Naming
Note:
JDBC OCI Drivers support absolute naming. JDBC Thin Drivers support absolute naming only when the complete DN is used. See the Oracle Database JDBC Developer's Guide and Reference![Tnsping Tnsping](/uploads/1/2/6/4/126473355/202697347.png)
This section describes how to configure absolute names for the following namespaces:
Absolute Names for X.500 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 15-1 depicts this example.Figure 15-1 Absolute Name for X.500 Namespaces
Description of 'Figure 15-1 Absolute Name for X.500 Namespaces'
Absolute Names for Domain Component NamespacesFor 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.Example 1
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 15-2 depicts this example.Example 2
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 [email protected]
([email protected]
). Figure 15-2 depicts this example.Figure 15-2 Absolute Name for Domain Component Namespaces
Description of 'Figure 15-2 Absolute Name for Domain Component Namespaces'
![Oracle Oracle](/uploads/1/2/6/4/126473355/837228261.jpg)
Initiating Connections
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.
Connecting from the Operating System to Test a Client
The general form of connecting an application to a database server from the command line is:
For example:
To prevent the password from displaying during a logon, you can leave out the password parameter on the command line. For example:
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.
Connecting from the Tool Logon Screen to Test a Client
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.Connecting from 3GL to Test a Client
In applications written using 3GL, the program must establish a connection to a server using the following syntax:
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:The
:
password
variable contains the password for the database account to which you are connecting.Connecting Using Special Commands Within Tools
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:For example:
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.
Testing the Network
The preferred sequence for testing the network is as follows:
- Start and test each listener.
- Start and test each Oracle Connection Manager (if included in your network layout).
- Test the server with a loopback test.
- Test client with a connection.
This section contains these topics:
Testing a Listener
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'.
Testing Oracle Connection Manager
To test Oracle Connection Manager, initiate a connection from a client to any active database that has been registered with Oracle Connection Manager.
Testing Configuration on the Database Server
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 Enterprise Manager or Net8 Assistant.
Oracle Net Manager
- Start Oracle Net Manager.
- In the navigator, expand Directory or Local > Service Naming.
- Select the net service name or database service.
- Choose Command > Test Net Service.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:
- Ensure that the database and listener are running, and then click Test.
- Click Change Login to change the username and password for the connection, and then click Test.
- Click Close to dismiss the Connect Test dialog box.
Testing Network Connectivity from the Client
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:
TNSPING Utility
The TNSPING utility determines whether or not a service (for example, an Oracle database or any other Oracle service) on an 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.
Using TNSPING
To invoke the TNSPING utility, enter the following:
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 intnsnames.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.
Example: Reaching a Database with TNSPING
To connect to a database using a net service name of
sales
, the following is entered:This produces the following message:
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:This command produces the following message:
Example: Invalid Net Service Name with TNSPING
Below is an example of TNSPING attempting to connect to an invalid net service name:
This attempt produces the following message:
Example: Valid Net Service Name with TNSPING
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):
TRCROUTE Utility
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.
Using TRCROUTE
To invoke TRCROUTE, enter the following from the command line:
The following are two examples of trace route output.
Example: Successful Trace Route
The following example shows a successful Trace Route packet that traveled from a client to a listener.
Example: Trace Route with Error
The following examples shows an unsuccessful Trace Route packet that could not reach the listener because the listener was not up.
Oracle Net Manager
To verify connectivity for a client computer, use Net8 Assistant:
- Start Oracle Net Manager.
- In the navigator, expand Directory or Local > Service Naming.
- Select the net service name or database service.
- Choose Command > Test Net Service.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:
- Ensure that the database and listener are running, and then click Test.
- Click Change Login to change the username and password for the connection, and then click Test.
- Click Close to dismiss the Connect Test dialog box.