Net8 Getting Started 
Release 8.0.5 for Windows NT and Windows 95/98 
A64419-01
 
Library
 
Product
 
Contents
 
Index
 

Prev Next

7
Connecting To a Database

This chapter describes how to connect to a database from a client machine.

Specific topics discussed are:

Connection Overview

Client workstations and other servers connect to a network listener with a service name when logging onto an Oracle server. The appropriate Oracle Protocol Adapter is used when the database alias (or service name) used to request a connection specifies that protocol in the configuration file.

Step 1: Start Oracle Names Server(s)

If you are using Oracle Names, start an Oracle Names Server on the machine where Oracle Names Server is installed and configured with the NAMESCTL80 control utility or the Control Panel:

Use the control utility NAMESCTL80...  Use the Windows NT Control Panel... 
  1. Verify whether the Oracle Names Server is running or not running. 
From the command line, enter:C:\> NAMESCTL80NAMESCTL> STATUSIf the STATUS command indicates the Oracle Names Server is running, go to Step 3. If the Oracle Names Server is not running, go to Step 2. 
  1. Start the Oracle Names Server. Enter: 
NAMESCTL> START 
  1. Exit from the NAMESCTL80 utility. Enter: 
NAMESCTL> EXIT 
  1. From the Control Panel window, double-click Services. 
The Services window appears. Look for the OracleORACLE_HOMENamesService80 service. A blank in the Status column indicates that the service is not running. If the service is already running, close the window and go to the section "Step 2: Start the Network Listener"
  1. Select the service, and click Start. 
The service starts. 
  1. In the Services window, click Close. 
 
 

Step 2: Start the Network Listener

For Net8 to accept connections on the server, a network listener must be started. If you have started an Oracle Names Server, the network listener upon startup automatically registers the databases specified in the SID_LIST_LISTENER_NAME section of the ORACLE_HOME\NET80\ADMIN\LISTENER.ORA file with the well-known Oracle Names Servers.

On the server, start the listener with the LSNRCTL80 control utility or the Control Panel:

Use the control utility LSNRCTL80...  Use the Windows NT Control Panel... 
  1. From the command line enter: 
C:\> LSNRCTL80LSNRCTL> STATUS LISTENER_NAMEwhere LISTENER_NAME is the name of the network listener defined in the LISTENER.ORA file with the alias LISTENER. It is not necessary to identify the network listener if you are using the default network listener, named LISTENER.If the STATUS command indicates the network listener is running, go to Step 2. If the network listener is not running, go to Step 3. 
  1. Even if the network listener is running, Oracle Corporation advises you to stop the network listener, and start it again. To stop the network listener, enter: 
LSNRCTL> SET PASSWORD PASSWORDLSNRCTL> STOP LISTENER_NAMESET PASSWORD is only required if the password is set in the LISTENER.ORA file. The password defaults to ORACLE
  1. Start the network listener. Enter: 
LSNRCTL> START LISTENER_NAMEOracleORACLE_HOMETNSListenerLSNR is created if this command is run for the first time against a non-default network listener name. 
  1. Exit from the LSNRCTL80 utility. Enter: 
LSNRCTL> EXIT 
  1. From the Control Panel window, double-click Services. 
The Services window appears. Look for OracleHOME_NAMETNSListener80 (the service name if you are using the default network listener name LISTENER) or OracleHOME_NAMETNSListener80LSNR (where LSNR is the non-default network listener name). OracleHOME_NAMETNSListener80LSNR is only created if the following command has been run:LSNRCTL80 START LISTENER_NAMEA blank in the Status column indicates that the service is not running. If the service is already running, close the window and go to the section "Step 3: Start Oracle Connection Manager(s)"
  1. Select the service, and click Start. 
The service starts. 
  1. In the Services window, click Close. 
 
 

Step 3: Start Oracle Connection Manager(s)

If you are using Oracle Connection Manager, start it on the machine where Oracle Connection Manager is installed and configured with the CMCTL80 control utility or the Control Panel:

Use the control utility CMCTL80...  Use the Windows NT Control Panel... 
  1. From the command line, enter: 
C:\> CMCTL80CMCTL> START CMAN 
  1. Exit from the CMCTL80 utility. Enter: 
CMCTL> EXIT 
  1. From the Control Panel window, double-click Services. 
The Services window appears. If you are using Oracle Names, select the OracleHOME_NAMECMAdminService80 to acquire information about available Oracle Names Servers, and click Start. If you are not using Oracle Names, do not start this service.The service starts. 
  1. Select the OracleHOME_NAMECManService80 to start the Oracle Connection Manager, and click Start. 
A blank in the Status column indicates that the service is not running.The service starts. 
  1. In the Services window, click Close. 
 
 

Step 4: Start Client Cache Service

If you are using Oracle Names, you may enable client caching on clients with the NAMESCTL80 control utility or the Control Panel (for Windows NT only). Client caching will update the SDNS.ORA file with the new Oracle Names Server information. If you do not want to update the SDNS.ORA file, it is not necessary to start this service.
Use the control utility NAMESCTL80  Use the Windows NT Control Panel... 
  1. At the client command prompt, enter: 
C:\> NAMESCTL80NAMESCTL> START_CLIENT_CACHE 
  1. Exit from the NAMESCTL utility. Enter: 
NAMESCTL> EXIT 

Note: The Control Panel is not available for Windows 95/98 clients. You must use the NAMESCTL80 control utility. 

  1. From the client Control Panel window, double-click Services. 
The Services window appears. Look for the OracleHOME_NAMEClientCache80 service. A blank in the Status column indicates that the service is not running. If the service is already running, go to Step 3. 
  1. Select the service, and click Start. 
  2. In the Services window, click Close. 
 
 

Step 5: Connect to the Database

Two ways to make database connections are to:

Use Server Manager

To connect to a database using Server Manager:

  1. Enter the following at the MS-DOS command prompt for any machine in the network:
  2. C:\>SVRMGR30
    

    The SVRMGR> prompt appears.

  3. Connect to the database:

  4. For...  Enter... 

    Host Naming method 

    SVRMGR> CONNECT USERNAME/PASSWORD@HOSTNAME1 

    Local Naming method 

    SVRMGR> CONNECT USERNAME/PASSWORD@SERVICE_NAME 

    Oracle Names method 

    SVRMGR> CONNECT USERNAME/PASSWORD@GLOBAL_DBNAME  

    GLOBAL_DBNAME is the global database name and domain you defined in the LISTENER.ORA for the Oracle Names Server. 

    Bequeath Protocol Adapter 

    SVRMGR> CONNECT SYSTEM/MANAGER2 

     
    1 If you cannot make a connection to the database, verify that the GLOBAL_DBNAME parameter in the LISTENER.ORA file specifies a complete name, including domain, for the server machine. 
    2 Bequeath is from a server to itself.

    Server Manager returns a "Connected" message to the screen.

  5. Issue SQL commands, such as:
  6. SELECT * FROM DUAL;
    
  7. When done, enter:
  8. SVRMGR> EXIT
    

    Exiting Server Manager closes the database connection.

Use SQL*Plus

To connect to a remote database using SQL*Plus:

  1. Choose Start > Programs > Oracle for Windows NT or Windows 95/98 > SQL*Plus 8.0.
  2. A Log On dialog box appears.

  3. Connect to the database:
  4. User Name 

    USERNAME 

    Password 

    PASSWORD 

    Host String 
    • HOSTNAME for host naming method 
    • SERVICE_NAME for local naming method 
    • GLOBAL_DBNAME in the LISTENER.ORA for Oracle Names 
    • blank for Bequeath 
     
     

  5. Click OK.
  6. The Oracle SQL*Plus window appears with a SQL> prompt.

  7. Issue SQL commands, such as:
  8. SQL>SELECT * FROM DUAL;
    
  9. When done, enter:
  10. SQL> EXIT
    

    Exiting SQL*Plus closes the database connection.



 
Prev
 
Next
 
Oracle 
Copyright © 1998 Oracle Corporation. 
All Rights Reserved. 
 
Library
 
Product
 
Contents
 
Index