I created container orcl2 database with pluggable database pdborcl2. When I try to connect

SQL> connect system@pdborcl2

I get this error:

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

My tnsnames.ora look as follows:

(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
  (SERVICE_NAME = orcl2.localhost))) 
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
      (SERVICE_NAME = pdborcl2.localhost)))

I can normally connect to orcl2 with:

SQL> connect system@orcl2
  • btw. I can normally connect [SQL> connect system@orcl2] and it works
    – Bart Ch.
    Commented Mar 8, 2017 at 13:11
  • When you set your ORACLE_SID to pdborcl2 can you connect to the instance? If so what does the command show parameter service show? What does the (shell) command lsnrctl statusgive?
    – Marco
    Commented Mar 8, 2017 at 13:16
  • When I switch ORACLE_SID to pdborcl2 i do not have sqlplus. "bash: sqlplus: command not found..."
    – Bart Ch.
    Commented Mar 8, 2017 at 13:35
  • You used oraenv to switch? If so then your oratab file is missing pdborcl2. Try to set the ORACLE_SID from the command line and execute sqlplus right after.
    – Marco
    Commented Mar 8, 2017 at 13:54
  • show parameter service showed NAME: service_name TYPE: string VALUE: orcl2.localdomain
    – Bart Ch.
    Commented Mar 8, 2017 at 14:04

1 Answer 1


You have CONNECT DATA instead of CONNECT_DATA (space instead of underscore). Fix that, and try again.

  • Also I was missing some information in listener.ora file. I used netca command to configure listener. Thank you!
    – Bart Ch.
    Commented Mar 13, 2017 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.