Connecting to an Oracle Database

Question

What do I input for the “server name” in the login dialog?

Using the “easy connect” naming method

( Information copied from http://download.oracle.com/docs/cd/B28359_01/server.111/b28301/network004.htm )

The easy connect naming method provides TCP/IP connectivity to databases without the need to first configure Oracle Net Services. The connect identifier has the following format:

“[//]host[:port]/service_name

where:

  • host is the name or IP address of the Oracle database host computer.
  • port (optional) is the TCP port number on which the Oracle Net listener listens for connections.
    If port is excluded, the standard port number 1521 is assumed.
  • service_name is one of the services defined by the database.
    If there are no service names specifically defined, then you can use the name of the service that the database creates by default. This service name defaults to the global database name, which consists of the database name (DB_NAME parameter) and domain name (DB_DOMAIN parameter).

For example, to connect to the database service orcl.us.example.com
on the host db.us.example.com, use the following for the “server name” in the BTR2SQL login dialog:

db.us.example.com/orcl.us.example.com

“Global Database Name”

The full name of the database which uniquely identifies it from any other database. The global database name is of the form “database_name.database_domain,” for example, sales.us.acme.com.

The database name portion, sales, is a simple name you wish to call your database. The database domain portion, us.acme.com, specifies the database domain in which the database is located, making the global database name unique. When possible, Oracle Corporation recommends that your database domain mirror the network domain.

The global database name is the default service name of the database, as specified by the SERVICE_NAMES parameter in the initialization parameter file.

Local Naming

The local naming method stores connect descriptors, identified by their net service names, in a configuration file on the client named tnsnames.ora. This file is located in the Oracle_home/network/admin
directory. When you create a database using Oracle Database Configuration Assistant (DBCA), local naming is configured automatically. You must then use the Net Configuration Assistant to create connect descriptors and their corresponding net service names.

See http://download.oracle.com/docs/cd/B19306_01/network.102/b14213/tnsnames.htm for more information.

An Example using the Instant Client

Local Naming is the preferred method with BTR2SQL.

The Instant Client does not include a tnsnames.ora file (it doesn’t even include the sub-directories). So, in the ORACLE_HOME location (for instance c:\oracle\instantclient), create the folder “network” and under that create “admin”. Now, edit c:\oracle\instantclient\network\admin\tnsnames.ora. In here you might have something like:

ORCLTEST =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = myserver)(PORT = 1521))

     (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = orcltestdb)

    )

  )

The easiest way to populate this information is to copy it from the tnsnames.ora file on the server (for instance, c:\oracle\product\11.1.0\db_1\network\admin\tnsnames.ora)

Once this file is in place on the client (and the oracle client dlls are in the system PATH), you would use “ORCLTEST” for the “Server Name” in the BTR2SQL login dialog.

Leave a Reply

You must be logged in to post a comment.