How to connect to PDB in Oracle 12c
<p>I'm running a fresh installation of Oracle 12c on Solaris 10 and I can connect to the CDB using toad just fine, please tell me how can I now connect to the PDB database named PDBORCL as mentioned in the guide: <a href="https://oracle-base.com/articles/12c/multitenant-connecting-to-cdb-and-pdb-12cr1" rel="nofollow">https://oracle-base.com/articles/12c/multitenant-connecting-to-cdb-and-pdb-12cr1</a></p>

<p>Following are the contents of my tnsnames.ora file:</p>

<pre><code># tnsnames.ora Network Configuration File: /bkofa/oracle/app/oracle  

/product/12.1.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ORCL12 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = afxortsts)(PORT = 1523))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl12)
    )
  )
pdbORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = afxortsts)(PORT = 1523))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = pdborcl)
    )
  )
</code></pre>

<p>Here are the contents of my listener.ora file:</p>

<pre><code># listener.ora Network Configuration File: /bkofa/oracle/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = afxortsts)(PORT = 1523))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = orcl12)
      (SID_NAME = orcl12)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = pdborcl)      
      (SID_NAME = pdborcl)
    )
  )
</code></pre>

<p>These are the containers by the way:</p>

<pre><code>SELECT name, pdb    
FROM   v$services    
ORDER BY name;    

NAME              PDB    

SYS$BACKGROUND    CDB$ROOT    
SYS$USERS         CDB$ROOT    
orcl12            CDB$ROOT    
orcl12XDB         CDB$ROOT    
pdborcl           PDBORCL    
</code></pre>

<p>Still when I try to connect to PDB using any combination of commands this is what I get:</p>

<pre><code>bash-3.2$ lsnrctl status  

LSNRCTL for Solaris: Version 12.1.0.2.0 - Production on 13-APR-2016 15:42:28  

Copyright (c) 1991, 2014, Oracle.  All rights reserved.  

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=afxortsts)(PORT=1523)))  
STATUS of the LISTENER  
------------------------  
Alias                     LISTENER  
Version                   TNSLSNR for Solaris: Version 12.1.0.2.0 - Production  
Start Date                12-APR-2016 13:56:56  
Uptime                    1 days 1 hr. 45 min. 36 sec  
Trace Level               off  
Security                  ON: Local OS Authentication  
SNMP                      OFF  
Listener Parameter File   /bkofa/oracle/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora  
Listener Log File         /bkofa/oracle/app/oracle/diag/tnslsnr/afxortsts/listener/alert/log.xml  
Listening Endpoints Summary...  
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=afxortsts)(PORT=1523)))  
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))  
Services Summary...  
Service "orcl12" has 1 instance(s).  
  Instance "orcl12", status UNKNOWN, has 1 handler(s) for this service...  
Service "pdborcl" has 1 instance(s).  
  Instance "pdborcl", status UNKNOWN, has 1 handler(s) for this service...  
The command completed successfully  
bash-3.2$ sqlplus '/ as sysdba'  

SQL*Plus: Release 12.1.0.2.0 Production on Wed Apr 13 15:42:44 2016  

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


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&gt; connect sys/oracle123@172.16.1.118:1523/pdborcl as sysdba  
ERROR:  
ORA-01017: invalid username/password; logon denied  


Warning: You are no longer connected to ORACLE.  
SQL&gt; connect sys@pdborcl  
Enter password:  
ERROR:  
ORA-01034: ORACLE not available  
ORA-27101: shared memory realm does not exist  
SVR4 Error: 2: No such file or directory  
Additional information: 2581  
Additional information: -2057892281  
Process ID: 0  
Session ID: 0 Serial number: 0  


SQL&gt; connect sys@172.16.1.118:1523/pdborcl as sysdba  
ERROR:  
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA  


SQL&gt;  
</code></pre>

<p>Oh I should make this clear that I'm using port 1523 because there is another instance of older Oracle 10g already running on the system that uses this port so I wanted to avoid any conflict with that.</p>