I was finally able to start with 12C!! So once I finish the installation, I tried to connect to the DB and create a user. That is when I discover that you need to connect to a special Database in order to perform that.
I got an error message creating a user. Well, I figured out how to create a new user and a few other things. I’m working with the DB12C database that comes with the install and all the parameters, etc. that come with it.
Evidently the default install comes with a PDB called PDBORCL. So, I have two tns entries one for the parent CBD and one for the child PDB and they look like this:
DB12C = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1) (PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = DB12C) ) ) PDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1) (PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pdborcl) ) )
So, if I connect as SYSTEM/password@DB12C I’m connected to the CDB and if I connect to SYSTEM/password@pdb I’m connected to the PDB. When I connected to the PDB I could create a new user without getting an error.
But, when I first tried connecting to the PDB I got this error, even though the database was up:
ORA-01033: ORACLE initialization or shutdown in progress
So, to bring the database up (by the way, I’m on 64 bit Linux) after booting the Linux VM the following steps were required:
lsnrctl start sqlplus / as sysdba startup alter session set container=PDBORCL; startup
Interestingly there is only one pmon:
$ ps -ef | grep pmon oracle 11865 1 0 09:12 ? 00:13:46 ora_pmon_DB12C
But you get different results when you query dba_data_files depending on whether connected to the CDB or PDB:
DB12C
FILE_NAME ------------------------------------------ /u01/app/oracle/oradata/DB12C/system01.dbf /u01/app/oracle/oradata/DB12c/sysaux01.dbf /u01/app/oracle/oradata/DB12C/undotbs01.dbf /u01/app/oracle/oradata/DB12C/users01.dbf
PDB
FILE_NAME -------------------------------------------------------------- /u01/app/oracle/oradata/DB12C/pdborcl/system01.dbf /u01/app/oracle/oradata/DB12C/pdborcl/sysaux01.dbf /u01/app/oracle/oradata/DB12C/pdborcl/SAMPLE_SCHEMA_users01.dbf /u01/app/oracle/oradata/DB12C/pdborcl/example01.dbf /u01/app/oracle/oradata/DB12C/pdborcl/dbfs01.dbf
So, I guess each PDB has its own SYSTEM and SYSAUX tablespaces?
Lastly when running my scripts to poke around I edited my sqlplus header script to report which container you are in. It looks like this now:
set linesize 32000 set pagesize 1000 set long 2000000000 set longchunksize 1000 set head off; set verify off; set termout off; column u new_value us noprint; column n new_value ns noprint; column c new_value cs noprint; select name n from v$database; select user u from dual; SELECT SYS_CONTEXT('USERENV', 'CON_NAME') c FROM DUAL; set sqlprompt &ns:&cs:&us> set head on set echo on set termout on set trimspool on
It puts out a prompt like this:
CDB
DB12C:CDB$ROOT:SYSTEM>
PDB
DB12C:CDB$ROOT:SYSTEM>