12c Containers
Submitted by dave on Thu, 08/04/2016 - 15:54
Working with PDBs
Set your ORACLE_SID and log into the CDB instance using normal oraenv and sqlplus "/ as sysdba" method.
Is current DB a CDB?
SQL> select cdb from v$database; CDB --- YES
- or -
SQL> show con_name CON_NAME ------------------------------ PDB1
View available PDBs
SQL> SELECT name, open_mode FROM v$pdbs; NAME OPEN_MODE ------------------------------ ---------- PDB1 READ WRITE
- or -
SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 3 PDB1 READ WRITE NO
Startup a PDB, persist open state when CDB opens
ALTER PLUGGABLE DATABASE PDB_NAME OPEN; SELECT name, open_mode FROM v$pdbs; ALTER PLUGGABLE DATABASE PDB SAVE STATE;
Switch Container Databases
ALTER SESSION SET CONTAINER=CDB$ROOT; SHOW CON_NAME ALTER SESSION SET CONTAINER=PDB_NAME; SHOW CON_NAME
References
Viewing Information About CDBs and PDBs with SQL*Plus