Oracle: sqlplus default database, TWO_TASK and LOCAL
February 03, 2010 17:44:14 Last update: February 03, 2010 17:44:14
When you start sqlplus withoud SID, Oracle says that you connect to the default database you created during installation. What if I installed multiple databases and I forgot which one is default? Is there a way to find out which is the current default? I wasn't able to find an answer.
But there are a couple of ways to change the default by setting a couple of environment variables. The bad news is: the variables are different depending on which platform you are on.
Of course, you can always provide SID in the connection string to remove any ambiguity:
But there are a couple of ways to change the default by setting a couple of environment variables. The bad news is: the variables are different depending on which platform you are on.
- Unix
If you are on Unix and the database is local, set these two variables:export ORACLE_HOME=/app/oracle/product/10.2.0/db_1 export ORACLE_SID=orcl
If the database is remote, setTWO_TASK:export TWO_TASK=orcl
- Windows
If you are on Windows, setLOCAL:set LOCAL=orcl
Of course, you can always provide SID in the connection string to remove any ambiguity:
sqlplus scott/tiger@orcl
Easy email testing with http://www.ximailstop.com