Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

System variable that stores database specification?? 2

Status
Not open for further replies.

sjh

Programmer
Joined
Oct 29, 2001
Messages
263
Location
US
Hi,

Is there an Oracle system variable that stores the current database specification? As in the database_specification in the following command?

CONNECT username/password@database_specification

Thank you in advance!
Susie

 
I am not sure if I need ORACLE_SID or DB_NAME. How do I find the values for these two?

I am using Windows 2000.

Thanks!
Susie
 
Susie said:
CONNECT username/password@database_specification
In the above example, Susie, the term to which you refer a "database_specification" is, in fact, a "SQL*Net alias". The SQL*Net aliases available for use on your client machine appear in the "tnsnames.ora" file that typically resides in your $ORACLE_HOME\network\admin directory.

For the sake of organization, administrators typically use the name of the Oracle instance as the SQL*Net alias. But you can have an instance named "FRED" that manages a database named "BARNEY", to which we connect with a SQL*Net alias of "WILMA": "connect system/<password>@WILMA".

Once you are connected to an Oracle instance, you can confirm the name of the instance with the query:
Code:
select instance_name from v$instance;

INSTANCE_NAME
-------------
fred
You can confirm the database name with the query:
Code:
select name from v$database;

NAME
---------
BARNEY
I hope this helps. If you have follow-on questions about this, please post.




[santa]Mufasa
(aka Dave of Sandy, Utah, USA)

Do you use Oracle and live or work in Utah, USA?
Then click here to join Utah Oracle Users Group on Tek-Tips.
 
As Dave already mentioned above @database_specification denotes TNS_ALIAS that may differ from ORACLE_SID and DB_NAME. AFAIK database knows virtually nothing about the name in your local TNSNAMES.ORA file as it's resolved locally. Besides you don't have to use that alias at all and may put the whole connect string (DESCRIPTION = (ADDRESS_LIST = ... ) thus in that case your question does not make sence at all. And after all without that part of connect string you're either connected to the local database if ORACLE_SID is defined or to remote one whose TNS_ALIAS is stored in LOCAL environment variable.

Regards, Dima
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top