Search for answers or browse our knowledge base.
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>