Visit Counter

Thursday, November 14, 2013

Startup and Shutdown Container Databases (CDB) and Pluggable Databases (PDB) in Oracle Database 12c R1



Startup and shutdown of the container database is the same as it has always been 
for regular instances. The SQL*Plus STARTUP and SHUTDOWN commands are 
available when connected to the CDB as a privileged user.
Some typical values are shown below.



Starting CDB (container database) will NOT OPEN PDB (pluggable database)

Use SHOW CON_NAME to know where you are at, i.e. CDB or PDB

Use ALL to have OPEN/CLOSE all PDB, i.e. ALTER PLUGGABLE DATABASE ALL OPEN;

Use ALTER SESSION to switch to PDB, i.e. alter session set container=PDB01;

$
SQL> SHOW CON_NAME

CON_NAME
----------------------------
CDB$ROOT


SQL> SHOW PDBS

CON_ID CON_NAME                                         OPEN MODE RESTRICTED
-----------------------------------------------------------------------

    2          PDB$SEED                                                 READ ONLY NO                  
    3          PDB1                                                         MOUNTED
    4          PDB2                                                         MONUTED


SQL> ALTER PLUGGABLE DATABASE ALL OPEN;

pluggable database altered.

SQL> SHOW PDBS

CON_ID CON_NAME                                         OPEN MODE RESTRICTED
-----------------------------------------------------------------------

    2          PDB$SEED                                                 READ ONLY NO                  
    3          PDB1                                                         READ WRITE NO
    4          PDB2                                                         READ WRITE NO

SQL> alter pluggable database all close;


CON_ID CON_NAME                                         OPEN MODE RESTRICTED
-------------------------------------------------------------------------------------
    2          PDB$SEED                                                 READ ONLY NO     
    3          PDB1                                                         MOUNTED
    4          PDB2                                                         MONUTED
SQL> ALTER PLUGGABLE DATABASE PDB1 OPEN;
pluggable database altered.
Accessing a Container in a CDB with SQL*Plus
SQL> alter session set container=PDB1;
session altered.
SQL> show con_name
con_name
--------------------------
PDB1

No comments:

Post a Comment