Linux – How to create and start a PDB for RCU in Oracle 12c

linuxoracle

So I've made a fresh install on a virtual machine based on OEL 6.5 x64.
All my installs are in /opt/apps

I installed a Oracle Database 12c, with the Desktop Version selected (not server), UNICODE encoding, Enterprise Edition. If I get it right, from this point I only have a CDB named orcl that is running.

Now I want to run the Repository Creation Utility to initialize the database for OIM and OAM but when I do so it tells me it won't run on a CDB.
So I checked the Oracle documentation and created a PDB from the default seed with :

CREATE PLUGGABLE DATABASE PDBFMW ADMIN USER fmw IDENTIFIED BY Passw0rd 
FILE_NAME_CONVERT=(
'/opt/apps/oradata/orcl/pdbseed/system01.dbf',
'/opt/apps/oradata/orcl/pdbfmw/system01.dbf',
'/opt/apps/oradata/orcl/pdbseed/sysaux01.dbf',
'/opt/apps/oradata/orcl/pdbfmw/sysaux01.dbf',
'/opt/apps/oradata/orcl/pdbseed/pdbseed_temp01.dbf',
'/opt/apps/oradata/orcl/pdbfmw/pdbfmw_temp01.dbf')
STORAGE UNLIMITED;

ALTER PLUGGABLE DATABASE PDBFMW OPEN READ WRITE;
GRANT ALL PRIVILEGES TO fmw WITH ADMIN OPTION;
GRANT SYS TO fmw;

So far my PDB is not started and won't start with the orcl instance so I made this trigger :

CREATE OR REPLACE TRIGGER open_pdbs 
AFTER STARTUP ON DATABASE 
BEGIN 
EXECUTE IMMEDIATE 'ALTER PLUGGABLE DATABASE ALL OPEN READ WRITE'; 
END open_pdbs;
\

Which, I was told, was supposed to automatically start my PDBFMW along with ORCL.
So I checked it out with :

SELECT name, open_mode from v$pdbs;

Which tells me that it's correctly opened and in READ WRITE mode.

But when I try to connect with this :

export ORACLE_SID=pdbfmw
sqlplus / as sysdba

It says connected to an idle instance.

Best Answer

Look at: http://docs.oracle.com/database/121/DBSEG/authentication.htm#DBSEG99827

Operating system authentication is not supported in a multitenant environment.

You can't connect with "sqlplus / as sysdba" to a PDB. It only works with the CDB.

If you change environment variable ORACLE_SID to that of a PDB, you'll connect to the binaries to what he expects to be a CDB that doesn't exist, and you'll get the message "connected to an idle instance"

Fun fact: If you are logged as the oracle binaries owner (or someone in the dba group) and try to connect with:

sqlplus pdbuser/pdbpass@pdb as sysdba

Even if the pdbuser doesn't exist in the CDB, you'll log in it, as pdbuser, with SYSDBA permissions, on the CDB, because of OS Authentication.

Or at least that's what happens in my test/experiment environment...