Oracle has introduced to save state of pluggable database in order to save time, effort and efficiency, suppose you want to keep pluggable database to open state even after restart of root container database then you can simple instruct to database the same.
Let see, how we can do this with example, first we see how to save state for open state and discard it as well
Currently pluggable database is in open mode and we want to save the same state after restart, this how we can do it
SQL>
show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
----------
------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 TECHNOPDB READ WRITE NO
SQL>
select con_name, instance_name, state from dba_pdb_saved_states;
no
rows selected
SQL>
alter pluggable database technopdb save state;
Pluggable
database altered.
SQL>
select con_name, instance_name, state from dba_pdb_saved_states;
CON_NAME INSTANCE_NAME STATE
--------------------
------------------------------ --------------
TECHNOPDB technodb OPEN
Now we will see how it really works and we will restart the database and if see it works
SQL>
startup
ORACLE
instance started.
Total
System Global Area 2365584120 bytes
Fixed
Size 9270008 bytes
Variable
Size 587202560 bytes
Database
Buffers 1761607680 bytes
Redo
Buffers 7503872 bytes
Database
mounted.
Database
opened.
SQL>
SQL>
show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
----------
------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 TECHNOPDB READ WRITE NO
SQL>
select con_name, instance_name, state from dba_pdb_saved_states;
CON_NAME INSTANCE_NAME STATE
--------------------
------------------------------ --------------
TECHNOPDB technodb OPEN
SQL>
Here we see, pluggable database got started in read write open.
Now we will see how to discard the state.
SQL>
select con_name, instance_name, state from dba_pdb_saved_states;
CON_NAME INSTANCE_NAME STATE
--------------------
------------------------------ --------------
TECHNOPDB technodb OPEN
SQL>
SQL>
alter pluggable database technopdb discard state;
Pluggable
database altered.
SQL>
select con_name, instance_name, state from dba_pdb_saved_states;
no
rows selected
SQL>
these are mostly steps we need to perform if we need to save state of pluggable database