Monday, October 6, 2014

Use “pdb_save_or_discard_state” clause to instruct the database to save or discard the open mode of the PDB when the CDB restarts.

SQL> select name,open_mode from v$pdbs;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
PDB1                           MOUNTED


SQL>  alter pluggable database pdb1 open;

Pluggable database altered.

SQL>  alter pluggable database pdb1 save state;

Pluggable database altered.

SQL> startup force;
ORACLE instance started.

Total System Global Area 1061158912 bytes
Fixed Size                  3011736 bytes
Variable Size             708840296 bytes
Database Buffers          343932928 bytes
Redo Buffers                5373952 bytes
Database mounted.
Database opened.


SQL> select name,open_mode from v$pdbs;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
PDB1                           READ WRITE

SQL> col con_name for a10
SQL> col state for a20

SQL> select con_name,state from dba_pdb_saved_states;

CON_NAME   STATE
---------- --------------------
PDB1       OPEN

Description of pdb_save_or_discard_state.gif follows