patternCritical
Connect with sqlplus from the command line using a connection string
Viewed 0 times
fromtheconnectlinewithusingcommandsqlplusstringconnection
Problem
Let's say I have an Oracle database. I have a username = x, password = y, database = z, port = a, SID = b, and Hostname = c.
So, how do I connect correctly? I used many options like:
But they usually give me the following errors:
ORA-12560: TNS:protocol adapter error
ORA-12514: TNS:listener does not currently know of service
So, how do I connect correctly? I used many options like:
sqlplus x/y@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=c)(PORT=a))(CONNECT_DATA=(SID=z)(SERVER=DEDICATED)))'
sqlplus (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=c)(PORT=a))(CONNECT_DATA=(SID=b)))But they usually give me the following errors:
ORA-12560: TNS:protocol adapter error
ORA-12514: TNS:listener does not currently know of service
Solution
Did you try:
Modern versions of sqlplus (11 and higher) understand this syntax and you don't need a
sqlplus username/password@host:port/service
sqlplus x/y@c:a/bModern versions of sqlplus (11 and higher) understand this syntax and you don't need a
tnsnames.ora file.Code Snippets
sqlplus username/password@host:port/service
sqlplus x/y@c:a/bContext
StackExchange Database Administrators Q#65032, answer score: 113
Revisions (0)
No revisions yet.