Wednesday, January 15, 2014

Pluggable Database Concepts

An Oracle Database instance is combination of SGA and group of background processes. An Oracle database is a group of files that contain data. In a single instance db, there  is a 1 to 1 relationship between an instance and a database. In a RAC environment, there are many to 1 relationship between instance and DB.

To have multiple DB on the same machine, you need to run multiple DB instance. So, in a single instance DB, if you have 3 mounted DB, you will need 3 DB instances. With PDB, the idea is to remove this duplication of resources and to share one DB instance with multiple DBs now referred to as CDBs.


A container Database (CDB) contains Plugable database (PDB)

A container database consists of following three components each of which is called a container
  • the root container (CDB$ROOT) which contains metadata for Oracle supplied objects
  • Seed PDB (PBD$SEED) which contains metadata for user supplied objects
  • PDBs which are generated by cloning seed PBD and assigned a unique ID upon creation.


At a physical level, the CDB has a database instance and database files, just as a non-CDB does.

The following files exist only in root container:
  • The redo log files
    • The redo log files are common for the whole CDB and therefore the information it contains is annotated with the identity of the PDB where a change occurs. All PDBs in a CDB share the ARCHIVELOG mode of the CDB
  • The control file
    • The control files are also common for the whole CDB. The control files are updated to reflect any additional tablespaces and datafiles of plugged PDBs.
    • Add info about undo tbsp ??
Following files exist either  in  both root container and user container or in one of them(PDBs and seed PDBs together form user container)
  • Temporary tbsp (required in root ;optional in user container):
    • A temporary tbsp is required in the root container.  This tbsp is optional in PDB. Each PDB can hold its own temporary tbsp for its own local users.
  • System and SysAux tablespace (required in both containers)
    • Each container has its own data dictionary stored in its proper SYSTEM tbsp ,containing its own metadata and a SYSAUX tbsp.
  • User tablespace (only in user container)
    • The PDBs can create their tbsp according to its application needs
Each datafile is associated with a specific container , named CON_ID.



There are four ways to provision a PDB:
  • Create a new PDB from seed PDB
  • Plug in a non-CDB as a PDB
  • Clone a PDB from another PDB (in same or another CDB)
  • Plug a unplugged PDB into another CDB. (However, a PDB can be plugged into only one CDB at a time)
You can plug or unplug a PDB from a CDB. A PDB can be plugged into only one CDB at a time.A CDB has a common users which can log in as root and adminster the PDB.You can create a CDB by either DBCA tool or by create database sql.

When you create a CDB, you can specify how many PDBs it will contain. Once the CDB is created, you can use DBCA to plug and unplug PDBs

When you create a CDB using a CREATE DATABASE sql statement, you must enable PDBs (by specifying enable PLUGGABLE DATABASE clause) and specify the names and locations of the seed's files.



Backup and Recovery:
  • Backup :
RMAN will support backup and recovery of a CDB that contains zero or more PDBs. All RMAN operations will be performed while connected as root of a CDB. An individual PDB is not a valid RMAN target  db. New syntax, namely Pluggable Database, is introduced to allow backup of CDB.
  • Recovery:
On a CDB, the recovery can be done for the entire CDB, for a PDB, a tbsp, a datafile or even a block.
If the files in the root container are lost (namely redo log file, control files, temp tbsp, ...)the only possible  recovery is once CDB is in a mounted state.





No comments:

Post a Comment