I will show, how to connect to remote database without need to use the tnsnames.ora
You can also connect to the remote database without the tnsnames.ora file.Here is the example.
sqlplus system/password@//hostname:port/SID
U:\>sqlplus system/**********@//192.168.209.145:1521/ocm11g
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Aug 23 11:31:17 2011
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
system@ocm11g> select instance_name from v$instance;
INSTANCE_NAME
------------------------------------------------
ocm11g
If you dont want to type the password in to command line, you can also use:
U:\SQL>sqlplus /nolog
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Aug 23 11:33:46 2011
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
SQL> conn system@"//192.168.209.145:1521/ocm11g"
Enter password:
Connected.
SQL> select instance_name from v$instance;
INSTANCE_NAME
------------------------------------------------
ocm11g
To be able to use the configurationless connections, you have to modify your sqlnet.ora file. this is located in the $ORACLE_HOME/network/admin directory. You need to add the EZCONNECT parameter (or modify it, if its allready there):
NAMES.DIRECTORY_PATH= (EZCONNECT,TNSNAMES)
sqlplus system/password@//hostname:port/SID
U:\>sqlplus system/**********@//192.168.209.145:1521/ocm11g
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Aug 23 11:31:17 2011
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
system@ocm11g> select instance_name from v$instance;
INSTANCE_NAME
------------------------------------------------
ocm11g
If you dont want to type the password in to command line, you can also use:
U:\SQL>sqlplus /nolog
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Aug 23 11:33:46 2011
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
SQL> conn system@"//192.168.209.145:1521/ocm11g"
Enter password:
Connected.
SQL> select instance_name from v$instance;
INSTANCE_NAME
------------------------------------------------
ocm11g
To be able to use the configurationless connections, you have to modify your sqlnet.ora file. this is located in the $ORACLE_HOME/network/admin directory. You need to add the EZCONNECT parameter (or modify it, if its allready there):
NAMES.DIRECTORY_PATH= (EZCONNECT,TNSNAMES)