By arunraj
Use the following command to connect to SQL Plus in Windows.
sqlplus <userName>/<passWord>@<serviceName>
The above command works if there is an entry for the service name in tnsnames.ora file which is available in
If there is no entry for the Service name in tnsnames.ora file, then use the following command to connect to SQL Plus.
sqlplus "<userName>/<passWord>@(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = ( PROTOCOL = TCP)(HOST = <IP or HostName>)(PORT = <port_number>))) (CONNECT_DATA = (SERVICE_NAME = <Service_Name>)))"
Sample command,
sqlplus "user1/user1@(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = ( PROTOCOL = TCP)(HOST =16.1.1.5)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = orcl)))"
Make a note of the double quotes which is absolutely necessary for the above command to work.