Sie sind auf Seite 1von 3

20/6/2018 ORACLE-BASE - Multitenant : Startup and Shutdown Container Databases (CDB) and Pluggable Databases (PDB) in Oracle Database

(PDB) in Oracle Database 12c Release 1 (12.1)

Preserve PDB Startup State (12.1.0.2 onward)


The 12.1.0.2 patchset introduced the ability to preserve the startup state of PDBs through a CDB restart. This is done using the ALTER
PLUGGABLE DATABASE command.

We will start off by looking at the normal result of a CDB restart. Notice the PDBs are in READ WRITE mode before the restart, but
in MOUNTED mode after it.

SELECT name, open_mode FROM v$pdbs;

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

SQL>

SHUTDOWN IMMEDIATE;
STARTUP;

SELECT name, open_mode FROM v$pdbs;

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

SQL>

Next, we open both pluggable databases, but only save the state of PDB1.

https://oracle-base.com/articles/12c/multitenant-startup-and-shutdown-cdb-and-pdb-12cr1#preserve-pdb-startup-state 1/3
20/6/2018 ORACLE-BASE - Multitenant : Startup and Shutdown Container Databases (CDB) and Pluggable Databases (PDB) in Oracle Database 12c Release 1 (12.1)

ALTER PLUGGABLE DATABASE pdb1 OPEN;


ALTER PLUGGABLE DATABASE pdb2 OPEN;
ALTER PLUGGABLE DATABASE pdb1 SAVE STATE;

The DBA_PDB_SAVED_STATES view displays information about the saved state of containers.

COLUMN con_name FORMAT A20


COLUMN instance_name FORMAT A20

SELECT con_name, instance_name, state FROM dba_pdb_saved_states;

CON_NAME INSTANCE_NAME STATE


-------------------- -------------------- --------------
PDB1 cdb1 OPEN

SQL>

Restarting the CDB now gives us a different result.

SELECT name, open_mode FROM v$pdbs;

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

SQL>

SHUTDOWN IMMEDIATE;
STARTUP;

https://oracle-base.com/articles/12c/multitenant-startup-and-shutdown-cdb-and-pdb-12cr1#preserve-pdb-startup-state 2/3
20/6/2018 ORACLE-BASE - Multitenant : Startup and Shutdown Container Databases (CDB) and Pluggable Databases (PDB) in Oracle Database 12c Release 1 (12.1)

SELECT name, open_mode FROM v$pdbs;

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

SQL>

The saved state can be discarded using the following statement.

ALTER PLUGGABLE DATABASE pdb1 DISCARD STATE;

COLUMN con_name FORMAT A20


COLUMN instance_name FORMAT A20

SELECT con_name, instance_name, state FROM dba_pdb_saved_states;

no rows selected

SQL>

Here is a brief list of some of the usage notes explained in the documentation.
The state is only saved and visible in the DBA_PDB_SAVED_STATES view if the container is in READ ONLY or READ WRITE mode.
The ALTER PLUGGABLE DATABASE ... SAVE STATE command does not error when run against a container in MOUNTED mode, but
nothing is recorded, as this is the default state after a CDB restart.
Like other examples of the ALTER PLUGGABLE DATABASE command, PDBs can be identified individually, as a comma separated list,
using the ALL or ALL EXCEPT keywords.
The INSTANCES clause can be added when used in RAC environments. The clause can identify instances individually, as a comma
separated list, using the ALL or ALL EXCEPT keywords. Regardless of the INSTANCES clause, the SAVE/DISCARD STATE commands
only affect the current instance.
For more information see:

https://oracle-base.com/articles/12c/multitenant-startup-and-shutdown-cdb-and-pdb-12cr1#preserve-pdb-startup-state 3/3

Das könnte Ihnen auch gefallen