Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Confusion over username/password

Re: Confusion over username/password

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 1997/11/26
Message-ID: <347d3c14.5839106@inet16>#1/1

On Tue, 25 Nov 1997 15:20:45 -0600, Gregg Sporar <gregg_sporar_at_i2.com> wrote:

>I'm trying to learn Oracle v7.3.3, and the supplied documentation
>doesn't always help. I'm particularly confused by several examples that
>I've seen that specify a logon username and password. In several places
>the documentation has examples that show a connection to the database
>being done with a command line specification of:
>
> username/password
>
>In actually using the software, however, I always have to use:
>
> username/password_at_dbalias
>
>where dbalias is a database alias as defined in TNSNAMES.ORA. This
>brings to mind several questions:
>
>1. Why don't the examples in the Oracle documentation include a database
>alias?
>

Because in the general case, you don't need one. Its almost always optional.

>2. How does the software know which database you want to connect to?
>

depends on the environment. In unix for example, there are three important environment variables:

ORACLE_HOME
ORACLE_SID
TWO_TASK Oracle-home should point to where the oracle software is. If you are doing a connection to a database on the same machine, you simply set your ORACLE_SID to the name of the database you want to connect to (not the tnsname, the ORACLE_SID SID=sight identifier) and login.

If you want to or need to use SQL*Net, you can use TWO_TASK to store the tnsnames entry you want to connect to. For example:

$ sqlplus scott/tiger_at_oracle8.world  

SQL*Plus: Release 3.3.3.0.0 - Production on Wed Nov 26 09:36:28 1997 Copyright (c) Oracle Corporation 1979, 1996. All rights reserved. Connected to:
Oracle8 Enterprise Edition Release 8.0.3.0.0 - Production With the Partitioning and Objects options PL/SQL Release 8.0.3.0.0 - Production  

SQL> exit
Disconnected from Oracle8 Enterprise Edition Release 8.0.3.0.0 - Production With the Partitioning and Objects options PL/SQL Release 8.0.3.0.0 - Production  

$ setenv TWO_TASK oracle8.world
$ sqlplus scott/tiger  

SQL*Plus: Release 3.3.3.0.0 - Production on Wed Nov 26 09:36:49 1997 Copyright (c) Oracle Corporation 1979, 1996. All rights reserved. Connected to:
Oracle8 Enterprise Edition Release 8.0.3.0.0 - Production With the Partitioning and Objects options PL/SQL Release 8.0.3.0.0 - Production  

SQL> So, scott/tiger = scott/tiger_at_oracle8.world when TWO_TASK is set to oracle8.world. ConnectString > TWO_TASK > ORACLE_SID (meaning, if you specify something in the connect string it will be used, if TWO_TASK is set, it takes precedence over oracle_sid and a sql*net connection will be made, if you have oracle_sid set -- it'll use that).

On NT/Win95/Win3.11 this is done via the environment or via the oracle.ini or via some registry entries. So even in these environments, you typically would use scott/tiger, not scott/tiger_at_some_db since you would have defaulted your database connection to some_db in a configuration file. Its only if you have >1 database that you use lots or if you want to know ex

>3. Is the username/password form (with no dbalias) only for use on the
>server system, and only when the ORACLE_SID env. variable is set to a
>particular instance?
>

see above...

>4. Is it safe to sssume that anywhere in the documenation where Oracle
>specifies username/password I can safely use username/password_at_dbalias?
>

Yes, pro*c manauls show you how to do this in pro*c. Oci shows you how in oci. In the sqlplus manual for example, chapter 5 "Accessing SQL Databases" is dedicated to showing you this syntax

>TIA,
>
>Gregg Sporar
>i2 Technologies
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD  

http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Wed Nov 26 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US