Alexey Starinsky
Alexey Starinsky

Reputation: 4339

Connected to an Oracle Database from Oracle SQL Developer, but cannot connect from the command line

I connect successfully to an Oracle Database from Oracle SQL Developer with the following settings:

enter image description here

but if I connect with the same settings from the command line

sqlplus [email protected]:1521/ORCLPDB1

I get

ERROR:
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA

what does this mean?

Upvotes: 0

Views: 256

Answers (1)

Dave Costa
Dave Costa

Reputation: 48121

As indicated in the SQLPlus documentation, to use this form of connect string on the command line, you need to enclose the whole thing in double quotes:

sqlplus PDBADMIN@"172.28.59.199:1521/ORCLPDB1"

(Depending on your OS, you may also need to escape those quotes with a backslash.)

I think syntactically this is necessary to distinguish /servicename from /password.

Upvotes: 1

Related Questions