Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

Create Pluggable Database Tips

Oracle Database Tips by Donald BurlesonOctober 15, 2015

Question:  What are the Oracle 12c Pluggable databases?  How does a pluggable database work?

Answer:  A pluggable database is a new construct whereby you can encapsulate a sub-set of Oracle data tables and indexes along with its associated metadata from the data dui dictionary.  You start by creating a "root" instance database, called a container database (CDB).  This container is used to hold many pluggable database "tenants" (PDB's), in a type of architectural separation.

The most important part of this separation is the "split" data dictionary, whereby everything needed for a PDB is self-contained in this sub-set of the metadata.

 Unlike a traditional database where only one database can exist per instance, the Oracle 12c pluggable databases allow multiple databases within an instance.  Oracle pluggable databases ease the movement into database consolidation because the data dictionary information (obj$, tab$ and source$) are independent of any container database.  All PDB's within the container share a common LGWR process.

This container can then be populated with sub-sets of a schema and then be can be un-plugged from one instance and re-added to another instance quickly.  Because the table definitions, index definitions, constraints and data all reside within the PDB, they can be easily copied and moved between instances and servers.   Oracle has termed "multi-tenancy" to describe the process of creating a CDB that contains many "tenant" PDB's.

The pluggable databases provide significant reduction in overhead on systems (like Exadata) where we'd like to host multiple databases, but can't consolidate them due to conflicts that prevent them running under the same instance (public synonyms / database links, schema name collision, etc). There are several benefits to pluggable databases:

1 - Easy fast cloning:  Simply copy the PDB very quickly

2 - Easy upgrades:  Just copy/move the PDB to a container running a higher release of Oracle

There is a new pluggable database administrator role in 12c called the CDB Administrator role.  The new CDB interface has the v$active_services view to tell you which container you are currently attached to:

SQL> show con_name

select
   name,
   con_id
from
   v$active_services
order by
   name;

select
   pdb
from
   dba_services;

select
   sys_context('userenv','con_name') "CONTAINER_NAME" FROM dual;

This is the syntax for creating a PDB:

create pluggable database
  cont01_plug01
admin user
   app_admin identified by mypass
file_name_convert = ('/pdbseed/', '/cont01plug01/');

alter pluggable database cont01_plug01 open;
-- alter pluggable database ALL open;

Oracle guru Mike Rajendran offers up these syntax examples of Oracle pluggable databases and notes the new data dictionary views v$pdbs

--*************************************
-- Check current environment of CDB and PDB
-- ************************************

set echo on
SET LINESIZE 200
SET PAGESIZE 10000
SET SERVEROUTPUT ON
COLUMN "DB DETAILS" FORMAT A100\
SELECT
 'DB_NAME: ' ||sys_context('userenv', 'db_name')||
 ' / CDB?: ' ||(select cdb from v$database)||
 ' / AUTH_ID: ' ||sys_context('userenv', 'authenticated_identity')||
 ' / USER: ' ||sys_context('userenv', 'current_user')||
 ' / CONTAINER: '||nvl(sys_Context('userenv', 'con_Name'), 'NON-CDB')
 "DB DETAILS"
 FROM DUAL
 /

DB DETAILS
---------------------------------------------------------------------------
DB_NAME: c02p / CDB?: YES / AUTH_ID: SYS / USER: SYS / CONTAINER: CDB$ROOT

-- ******************************************
REM Check how many PDBs are in the current container
-- ******************************************
SET SERVEROUTPUT ON
COLUMN "RESTRICTED" FORMAT A10
select
   v.name,
   v.open_mode,
   nvl(v.restricted, 'n/a') "RESTRICTED",
   d.status
from
   v$pdbs     v
inner join
   dba_pdbs d
using (GUID)
order by v.create_scn;

NAME                            OPEN_MODE RESTRICTED STATUS
------------------------------ ---------- ---------- -------------
PDB$SEED                        READ ONLY  NO         NORMAL
C0NT1PLUG1                      READ WRITE NO         NORMAL

Next, we can use the new cdb_data_files view to display the data files associated with our PDB:

select
   con_id,
   tablespace_name,
   file_Name
from
   cdb_data_files
where
   file_name like '%/c01p/pdbseed/%'
or
   file_name like '%/c01p/c01p01p/%'
order by 1, 2;


CON_ID TABLESPACE_NAME FILE_NAME
---------- --------------- -----------------------------------------
2          SYSAUX /u01/app/oracle/oradata/cib01p/pdbseed/sysaux01.dbf
2          SYSTEM /u01/app/oracle/oradata/cib01p/pdbseed/system01.dbf
3          SYSAUX /u01/app/oracle/oradata/cib01p/c01p01p/sysaux01.dbf
3          SYSTEM /u01/app/oracle/oradata/cib01p/c01p01p/system01.dbf

You can also drop a PDB with these commands:

SQL> alter pluggable database CONT1PLUG1 close;

Pluggable database altered.

SQL> drop pluggable database CONT1PLUG1 including datafiles;


Pluggable database dropped.

You can unplug a PDB from a CDB with this syntax:

alter pluggable database
   CONT1PLUG1
unplug into
   '/u01/app/oracle/oradata/c01p/c01p01p/c01p01pxml';

There is also a new dbms_pdb package used for verifying PDB information:

-- check PDB compatibility

begin
2 if not
3 dbms_pdb.check_plug_compatibility(
4 pdb_descr_file =>
5 '/u01/app/oracle/oradata/c01p/c01p01p/c01p01p.xml')
6 then
7 raise_application_error(-20000, 'PDB is not compatible to plug in');
8 end if;
9 end;
10 /

Some DBA's wonder of all of the container databases will need to have the same characteristics (i.e. character set) as the template. Jim Demitriou's Enterprise Architect contact at Oracle provided the following response:

The 12c product management team has received this request from multiple customers so it's definitely on their radar. It's my understanding in the initial release of 12c the character set does need to be the same in the Pluggable Databases (PDBs) as the main Container DB.

I believe there are on going discussions about the capability to have different characters sets for the CDB and PDBs in future releases of 12c so hopefully we'll see this capability added to a major dot release of 12c.

So, I think it's safe to say that we should prepare (at least initially) that character sets will have to align in order to coexist under a 12c server as a pluggable instance.

 
Get the Complete
Oracle SQL Tuning Information 

The landmark book "Advanced Oracle SQL Tuning  The Definitive Reference"  is filled with valuable information on Oracle SQL Tuning. This book includes scripts and tools to hypercharge Oracle 11g performance and you can buy it for 30% off directly from the publisher.

 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster