How Can We Help?

Search for answers or browse our knowledge base.

Documentation | Demos | Support

< All Topics
Print

How to default to the local database when logging in from the command line

Set the ORACLE_SID via My Computer > Properties > Advanced > Environment Variables. Add a new variable (or edit existing) by clicking New and supplying a variable name of ORACLE_SID and a value of whatever the database (service) name is as it appears in the tnsnames.ora file. Click OK when you are done.

When you log in from the command line again, the new variable will be picked up and you should get something similar to the following:

C:Documents and SettingsAdministrator>sqlplus protect

SQL*Plus: Release 10.2.0.4.0 - Production on Tue Feb 10 13:49:24 2009

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Enter password:

Connected to:Oracle Database 10g Release 10.2.0.4.0 - Production

SQL>

To connect to another database, provide the net service name as it appears in the tnsnames.ora file. Use the following example:

C:Documents and SettingsAdministrator>sqlplus protect@vontudbs

SQL*Plus: Release 10.2.0.4.0 - Production on Tue Feb 10 13:49:24 2009

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Enter password:

Connected to:Oracle Database 10g Release 10.2.0.4.0 - Production

SQL>

Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Table of Contents