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. Mar 8 '17 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 Mar 8 '17 at 13:16
  • When I switch ORACLE_SID to pdborcl2 i do not have sqlplus. "bash: sqlplus: command not found..." – Bart Ch. Mar 8 '17 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 Mar 8 '17 at 13:54
  • show parameter service showed NAME: service_name TYPE: string VALUE: orcl2.localdomain – Bart Ch. Mar 8 '17 at 14:04

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. Mar 13 '17 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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