Net8 Getting Started
Release 8.0.4 for Windows NT and Windows 95

A55913-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 configured Oracle Names, start the Oracle Names Server on the machine where the Oracle Names Server resides.

To start an Oracle Names Server:

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:\> NAMESCTL80

    NAMESCTL> STATUS

    If 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.

  2. Start the Oracle Names Server. Enter:

    NAMESCTL> START

  3. 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".

  2. Select the service, and click Start.

    The service starts.

  3. 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 on the server. 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 LISTENER.ORA file with the well-known Oracle Names Servers.

To start the network listener:

Use the control utility LSNRCTL80...   Use the Windows NT Control Panel...  
  1. From the command line enter:

    C:\> LSNRCTL80

    LSNRCTL> STATUS LISTENER_NAME

    where 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.

  2. 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 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.

  3. Start the network listener. Enter:

    LSNRCTL> START LISTENER_NAME

    OracleORACLE_HOMETNSListenerLSNR is created if this command is run for the first time against a non-default network listener name.

  4. 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_NAME

    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 3: Start Oracle Connection Manager(s)".

  2. Select the service, and click Start.

    The service starts.

  3. In the Services window, click Close.

 

Step 3: Start Oracle Connection Manager(s)

If you configured Oracle Connection Manager, start it on the machine where it resides:

To start an Oracle Connection Manager:

Use the control utility CMCTL80...   Use the Windows NT Control Panel...  
  1. From the command line, enter:

    C:\> CMCTL80

    CMCTL> START CMAN

  2. 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.

  2. 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.

  3. In the Services window, click Close.

 

Step 4: Start Client Cache Service

If you are using Oracle Names, you may start the OracleHOME_NAMEClientCache80 service on all of the clients in order for the SDNS.ORA file to be updated 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.

To start the OracleHOME_NAMEClientCache80 service:

Use the control utility NAMESCTL80   Use the Windows NT Control Panel...  
  1. At the command prompt, enter:

    C:\> NAMESCTL80

    NAMESCTL> START_CLIENT_CACHE

  2. Exit from the NAMESCTL utility. Enter:

    NAMESCTL> EXIT

 
  1. From the 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.

  2. Select the service, and click Start.

  3. 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:

    SVRMGR30
    

    The SVRMGR> prompt appears.

  1. Connect to the database:

    For...   Enter...  

    Host Naming method  

    SVRMGR> CONNECT SYSTEM/MANAGER@HOSTNAME1  

    Local Naming method  

    SVRMGR> CONNECT SYSTEM/MANAGER@SERVICE_NAME  

    Oracle Names method  

    SVRMGR> CONNECT SYSTEM/MANAGER@GLOBAL_DBNAME

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

    Bequeath Protocol Adapter  

    SVRMGR> CONNECT SYSTEM/MANAGER  

    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.

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

  2. Issue SQL commands, such as:

    SELECT * FROM DUAL;
    
  3. When done, enter:

    SVRMGR> EXIT
    

    Exiting Server Manager closes the database connection.

Use SQL*Plus

To connect to a remote database using SQL*Plus:

  1. From the taskbar, choose Programs > Oracle for Windows NT or Windows 95 > SQL*Plus 8.0.

    A Log On dialog box appears.

  1. Connect to the database:

    User Name  

    SYSTEM  

    Password  

    MANAGER  

    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
     

  2. Click OK.

    The Oracle SQL*Plus window appears with a SQL> prompt.

  3. Issue SQL commands, such as:

    SELECT * FROM DUAL;
    
  4. When done, enter:

    SQL> EXIT
    

    Exiting SQL*Plus closes the database connection.




Prev

Next
Oracle
Copyright © 1997 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index