Normally, when you connect oracle via SQL*Plus you can specify a connect string such sqlplus apps/apps@DEV. If this is specified, oracle uses tnsnames entry which is included in tnsnames.ora file located at $ORACLE_HOME/network/admin.
where suffix @DEV is the SID of the target instance.
If you are using this connection string in migration process and you are not sure of the target instance SID then you can use $TWO_TASK environment variable to get the SID.
#sqlplus apps/apps@$TWO_TASK
ebsdev@r12-dev-app(/home/oracleappsdna)# echo $TWO_TASK EBSDEV ebsdev@r12-dev-app(/home/oracleappsdna)# sqlplus apps/apps@$TWO_TASK SQL*Plus: Release 10.1.0.5.0 - Production on Mon Dec 23 22:48:06 2013 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select 'OracleAppsDNA' from dual; 'ORACLEAPPSDN' ------------- OracleAppsDNA SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options ebsdev@r12-dev-app(/home/oracleappsdna)# |
Note: $TWO_TASK is used for connecting an oracle database which is not installed on same host.