I happened to install the Oracle Instant Client (instructions here) to quickly connect to a database using sqlplus.

Problem

After installation, I simply tried to connect to my database as follows:

./sqlplus scott@dbhost:1521/dsoa.revelationtech.com

And got the ORA-12504 error shown here:

SQL*Plus: Release 18.0.0.0.0 - Production on Sun Apr 24 17:37:43 2022
Version 18.5.0.0.0

Copyright (c) 1982, 2018, Oracle.  All rights reserved.

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


Enter user-name:

Solution

Include the slash and double quotes in the sqlplus command as shown:

./sqlplus scott@\"dbhost:1521/dsoa.revelationtech.com\"

Voila!

SQL*Plus: Release 18.0.0.0.0 - Production on Sun Apr 24 17:39:32 2022
Version 18.5.0.0.0

Copyright (c) 1982, 2018, Oracle.  All rights reserved.

Enter password:
Last Successful login time: Sun Apr 24 2022 17:37:03 -04:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL>

References