sqlplus username/password@hostname:port/sid
1.if you don't provide password, it may give you below error
ERROR:
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
in linux
use sqlplus username@\"hostname:port/sid\"
2. you can provide the whole tns info for command line connection
for example
sqlplus username/password@(description = (address=(protocol = TCP)(HOST=hostname)(port = 1521))(connect_data=(server = dedicated)(service_name = sid)))
in linux, put quote on because parentheses is taken differently in shell.
sqlplus 'username/password@(description = (address=(protocol = TCP)(HOST=hostname)(port = 1521))(connect_data=(server = dedicated)(service_name = sid)))'
reference:
http://oradim.blogspot.com/2009/07/sqlplus-ezconnect-password-prompt-and.html
thanks
ReplyDelete