Tuesday, January 5, 2016

How to view the history of your Pluggable Databases?

Introduction

Let's say you have a 12c container database with multiple pluggable databases. Some of the PDBs were created during the initial container database installation, some were cloned later and some were unplugged/plugged over the time.
A question that can be raised is how to track the history of the PDBs?

Solution

Using CDB_PDB_HISTORY dictionary view, you can easily query the history of the PDBs and for each PDB you can see when it was created/cloned/plugged/unplugged and from which other PDB it was cloned from.

Demonstration

Following is a demonstration of the CDB_PDB_HISTORY from one of our Oracle 12c environments:
SQL> select pdb_name, operation, op_timestamp, cloned_from_pdb_name from cdb_pdb_history order by 3;

PDB_NAME   OPERATION        OP_TIMESTAMP         CLONED_FROM_PDB_NAME
---------- ---------------- -------------------- -------------------------
PDBTEST    CREATE           12-MAR-2015 14:58:52 PDB$SEED
PINIDB     CLONE            15-MAR-2015 15:00:07 PDBTEST
PDBTEST    UNPLUG           05-JAN-2016 15:01:39
PDBTEST    PLUG             05-JAN-2016 15:09:59 PDBTEST


Following is an explanation for the this example:

  • The first PDB named PDBTEST was created in 12-MAR-2015 14:58:52 from the PDB$SEED (a system-supplied template PDB).
  • The second PDB named PINIDB was cloned  in 15-MAR-2015 15:00:07 from PDBTEST.
  • On 05-JAN-2016 15:01:39 PDBTEST has been unplugged.
  • On 05-JAN-2016 15:09:59 PDBTEST has been plugged into the container database.

Summary

The CDB_PDB_HISTORY view can be useful for investigating the history of your PDBs. 
I hope you can find it useful in your Oracle 12c environments.

No comments:

Post a Comment