Oracle – Cloning Pluggable Database

Smart Panda - PeopleSoft in the CloudCloning Pluggable Database

Well, the first question is what is a pluggable database. In Oracle 12c, Oracle has introduced a multi-tenancy database methodology, and you will see two acronyms all the time “CDB” meaning “Container Database” and PDB is an acronym for “Pluggable Database”. A quick analogy would be to think of a train to understand the difference, you have a train with an engine “CDB” and lets say up to 250 rail cars the “PDB” as working databases. Each car has specific content targeted for specific customers and they are packed and sealed independently specific to the customer. This methodology allows for a better use of resources and controls for large Enterprise setups or to be able to run multiple large enterprise setups within the same architecture. So cloning a database within this type of environment is actually very straight forward.

The Steps:

  1. Log into your container database.
  2. Close the Pluggable Database you want to clone: alter pluggable database <pdb_name> close immediate;
  3. Open the Pluggable Database in read only mode: alter pluggable database <pdb_name> open read only;
  4. Create a new directory to place the oracle database files: /u01/newpdb
  5. In SQL*Plus: alter system set db_create_file_dest=’/u01/newpdb’;
  6. Now its time to clone:

    CREATE PLUGGABLE DATABASE newpdb FROM oldpdb
    FILE_NAME_CONVERT=(‘/u01/oldpdb/’,’/u01/newpdb/’)
    PATH_PREFIX = ‘/u01/newpdb’;

  7. alter pluggable database newpdb open;