Sie sind auf Seite 1von 31

Basics of Multitenant Container Database and

Pluggable Databases

Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Oracle Database 12c New and Enhanced Features
Enterprise Manager Enterprise Manager Enterprise Manager
Database Express
Other tools
and other tools Cloud Control
Day 1-2

Basics CDB and PDB Creation CDB and PDB Mgt


CDB and PDBs
Tablespaces and Users B&R and Flashback

ADO and Heat Map and Automatic Data Optimization Online Datafile Move
Storage
In-Database Archiving and Temporal Validity Temporal History

Security Unified Audit Privilege Analysis Data Redaction


Day 3

HA RMAN

Manageability DB Operations Schema Change Plans Data Comparisons


Day 5 Day 4

Performance SQL Real-Time Compare Period Resource Index,


Tuning ADDM ADDM Mgr Table, ADR

Data Pump, SQL*Loader & External Tables


Miscellaneous
Partitioning SQL Other topics in referenced courses

2-2 Copyright 2013, Oracle and/or its affiliates. All rights reserved.
Objectives

After completing this lesson, you should be able to:


Describe the multitenant architecture
Describe the root and pluggable database containers
Differentiate the root from a pluggable database
Explain pluggable database plugging
List impacts in various areas

2-3 Copyright 2013, Oracle and/or its affiliates. All rights reserved.
Challenges

Many Oracle customers have large numbers of departmental


applications built on Oracle RDBMS. They:
Do NOT use a significant percentage of the hardware on
which they are deployed
Have instance and storage overhead preventing large
numbers of departmental databases from being placed
on the same physical and storage server
Are NOT sufficiently complex to require 100% of the
attention of a full time administrator
Do require significant time to patch or upgrade all
applications

2-4 Copyright 2013, Oracle and/or its affiliates. All rights reserved.
Pre-12c

Oracle Database in 11g Release 2

Instance
System Global Area

Server
Process Structures

Instance

Database

Database (Storage Structures)

Multiple monolithic or non-CDBs share nothing:


Too many background processes
High shared/process memory
Many copies of Oracle metadata

2-5 Copyright 2013, Oracle and/or its affiliates. All rights reserved.
12c

New Multitenant Architecture: Benefits

Operates multiple databases in a centrally managed


platform to lower costs:
Less instance overhead
Less storage cost
Reduces DBA resources costs and maintains security
No application changes
Fast and easy provisioning
Time saving for patching and upgrade
Separation of duties between:
Different application administrators
Application administrators and DBA
Users within application
Provides isolation

2-6 Copyright 2013, Oracle and/or its affiliates. All rights reserved.
Other Benefits of Multitenant Architecture

Ensures full backwards-compatibility with non-CDBs


Fully operates with RAC
Is integrated with Enterprise Manager and Resource
Manager
Allows central management and administration of
multiple databases
Backups / disaster recovery
Patching and upgrades

2-8 Copyright 2013, Oracle and/or its affiliates. All rights reserved.
Configurations

RAC Services
Instance

hr sale acct
PDB I1 I2 I3
Services
CDB
Instance

pdba Non-CDB RAC PDB


Instance PRODDB Instance Services
pdbb
iprod
pdbc Non-CDB
icdb1 pdba pdbb pdbc
crac1 crac2 crac3
PDB

PDBA PDBB PDBC


CDB CDB1 PDB

PRODDB PDBA PDBB PDBC


Non-CDB CDB CRAC

2 - 10 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


12c

Multitenant Container Database


Instance
Server System Global Area
Single Instance
Process Structures

Multitenant
container Multitenant Container
database Database CDB
Datafiles Control files Redo Log files

Single DB shares:
Background
processes root
Shared/process
Datafiles Datafiles Datafiles
memory
Oracle metadata

Application1 SALES HR

2 - 11 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Pristine Installation

After the initial database creation, the only objects are Oracle-
supplied objects.
OBJ$ TAB$ SOURCE$

Oracle System data

2 - 12 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Adding User Data

In a non-CDB, user data is added:


The metadata is mixed with the Oracle supplied data in the
data dictionary.

OBJ$ TAB$ SOURCE$ EMP DEPT

Oracle System data mixed with User Data


User metadata

2 - 13 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Separating SYSTEM and User Data
Multitenant
OBJ$ TAB$ SOURCE$ Container Database
Container
for
System

Oracle Metadata only Container for Application

OBJ$ TAB$ SOURCE$ EMP DEPT

User Metadata only User Data

2 - 14 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


SYSTEM Objects in the USER Container
Multitenant Container
OBJ$ TAB$ SOURCE$ Database

The Oracle-supplied objects


must be visible from the user
container.

Oracle Metadata only

OBJ$ TAB$ SOURCE$ EMP DEPT

User Metadata only User Data

2 - 15 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Naming the Containers
Multitenant Container Database
The Oracle-supplied
container is called the root
root container.
User container is a
pluggable database (PDB).
Oracle Metadata only

PDB

User Metadata only User Data

2 - 16 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Provisioning a Pluggable Database
Multitenant Container Database

root

New Imagine this


Seed when the data files
PDB empty are on a file system
PDB that supports
copy-on-change.

Four methods:
Create new PDB from PDB$SEED pluggable database.
Plug in a non-CDB.
Clone a PDB from another PDB into the same or another
CDB.
Plug an unplugged PDB into another CDB.

2 - 17 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Interacting Within Multitenant Container Database
Multitenant Container Database

root

PDB_1 PDB_2 PDB_n


fast intra-CDB db link

2 - 18 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Multitenant Container Database Architecture
Instance
Server System Global Area
PDBid2 PDBid3 PDBid4 PDBid2 PDBid4
Instance
Process Structures

Multitenant
container
database Data files Control files Redo Log files
UNDO
SYSTEM

Single DB shares: TEMP


SYSAUX
Background
processes root container
Shared/process
memory Data files Data files Data files

Oracle metadata SYSTEM SYSTEM


Redo log files TEMPO TEMP2
Control files SYSAUX SYSAUX TBS2
Undo tablespace seed PDB SALES PDB HR PDB

2 - 19 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Containers

Two types of containers in V$CONTAINERS:


The root container
The first container created at CDB creation
Mandatory
Oracle system-supplied common objects and metadata
Oracle system-supplied common users and roles
Pluggable database containers (PDBs)
A container for an application:
Tablespaces (permanent and temporary)
Schemas / Objects / Privileges
Created / cloned / unplugged / plugged
Particular seed PDB
PDB$SEED provides fast provisioning of a new PDB
Limit of 253 PDBs in a CDB including the seed
Limit of 512 services in a CDB
2 - 20 Copyright 2013, Oracle and/or its affiliates. All rights reserved.
Questions: Root Versus PDBs
What belongs to the CDB and not to a specific container?
CDBA Control files and redo log files

What is in the root that is not in PDBs?


UNDO and default TEMP tablespace UNDO TEMP

System supplied metadata Table SYS.OBJ$ NAME TYPE


TAB$ 2
Shared Oracle-supplied data USER$ 2

PL/SQL Oracle-supplied packages NAME


(DBMS_SQL ) PDB_SALES
PDBs service names Table SYS.SERVICE$ PDB_HR

CDB dictionary views providing information Views CDB_xxx


across PDBs TABLE_NAME CON_ID
EMPLOYEES 1
CDB RM plan TEST 2

2 - 21 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Questions: PDBs Versus Root
What is in a PDB that is not in the root nor in another PDB?
PDBA Application tablespaces HR_TBS
Local temporary tablespaces TEMP1

Local users and local roles


Local users connect to the PDB where they exist

Table SYS.OBJ$
Non-shared local metadata NAME TYPE
EMPLOYEES 2
JOBS 2
Table
Non-shared application data with other PDBs HR.EMPLOYEES
EMP_NAME
SMITH
PDB RM plan JOHN

2 - 22 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Terminology

Common versus Local:


Users
Roles
Privileges
CDB versus PDB level:
CDB Resource Manager plan versus PDB RM plan
Unified audit at CDB or PDB level
XStream at CDB or PDB level

2 - 23 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Common and Local Users
Multitenant Container Database

root PDB_SALES
View CDB_USERS View DBA_USERS
USERNAME COMMON USERNAME COMMON Tablespace
EXAMPLE
SYS YES SYS YES
SYSTEM YES SYSTEM YES
Table
C##DBA YES C##DBA YES
SALES.COUNTRIES
C##HR YES Tablespace C##HR YES
EXAMPLE
SALES NO

View DBA_USERS PDB_HR


USERNAME COMMON
Tablespace
Adding a common user, involves adding a
SYS YES description of that user in the root and in every
EXAMPLE
SYSTEM YES PDB.
C##DBA YES
Table
C##HR YES HR.REGIONS A local user is a traditional user, known only
HR_MGR NO in its own PDB.

2 - 24 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Common and Local Privileges and Roles
Multitenant Container Database
PDB_HR
root LOCAL role COMMON role
COMMON role LOCAL role
X
X
X
Priv/role granted commonly

Common Priv (granted commonly)

Priv/role granted locally

Local Priv (granted locally)


Common privilege Common roles
SQL> GRANT c##_r1 TO C##DBA
CONTAINER=ALL;
Common Role (granted commonly)
Local privilege Local roles

Common Role (granted locally) SQL> GRANT l_priv TO C##DBA


CONTAINER=CURRENT;

Common users Local users

2 - 25 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Shared and Non-Shared Objects
Multitenant Container Database

root Datafiles PDB_SALES Datafiles

Tablespace SYSTEM Tablespace USERS


Tablespace SYSTEM
Table SYS.TAB$ Table
Table SYS.TAB$
NAME TYPE SALES.COUNTRIES
NAME T Table
Y COUNTRIES 2
P
E AUDIT_ACTIONS AUDIT_ACTIONS 2

TAB$ 2 NAME

USER$ 2 CREATE TABLE

INSERT
CLU$ 2 Metadata linked stores metadata about dictionary
AUDIT_ACTIONS 2
objects only in root.
Each PDB has a private data copy pointing to a
metadata linked object stored in root.
PDB_HR Datafiles
An object link and its data resides in root only
Tablespace and is shared by all PDBs.
Tablespace SYSTEM
EXAMPLE Example: the list of audit actions is in
Table SYS.TAB$ AUDIT_ACTIONS table in root, thereby making
Table
NAME TYPE
AUDIT_ACTIONS accessible in each separate
HR.REGIONS REGIONS 2 container.
AUDIT_ACTIONS 2
A local object contains private data that resides in
the PDB where it is created.

2 - 26 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Data Dictionary Views
CDB_xxx All objects in the multitenant container database across all PDBs

DBA_xxx All of the objects in a container or pluggable database

ALL_xxx Objects accessible by the current user

USER_xxx Objects owned by the current user

SQL> SELECT view_name FROM dba_views WHERE view_name like 'CDB%';

CDB_pdbs: All PDBS within CDB


CDB_tablespaces : All tablespaces within CDB
CDB_users : All users within CDB (common and local)
DBA dictionary views providing information within PDB:
SQL> SELECT table_name FROM dict WHERE table_name like 'DBA%';

2 - 27 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Impacts
Impacts

One character set for all PDBs (Unicode recommended)


PDB initialization parameters but a single SPFILE
No PDB qualified database object names
SELECT * FROM HR:apps.tab1
Use DB Links: SELECT * FROM apps.tab1@HR
Oracle Data Guard at CDB level
Oracle Database Vault per PDB only
One master key per PDB to encrypt PDB data
Unified audit both at CDB and PDB level
Oracle Scheduler
Oracle GoldenGate
Oracle Streams
Oracle XStream both at CDB and PDB level

2 - 28 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Quiz

Which of the following are true?


a. Oracle-supplied metadata resides only in the root
container.
b. The seed PDB can sometimes be opened for very
particular operations.
c. A PDB can have the same name in different CDBs.

2 - 30 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Quiz

Which of the following are true? There is:


a. Only one SYSTEM tablespace per CDB
b. Only one instance per PDB
c. A set of redo log files per PDB
d. Only one UNDO tablespace per CDB
e. One SYSAUX tablespace per PDB

2 - 31 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Quiz

You can create common users in a PDB.


a. True
b. False

2 - 32 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Summary

In this lesson, you should have learned how to:


Describe the multitenant architecture
Describe the root and pluggable database containers
Differentiate the root from a pluggable database
Explain pluggable database plugging
List impacts in various areas

2 - 33 Copyright 2013, Oracle and/or its affiliates. All rights reserved.


Practice 2 Overview:
Exploring a Multitenant Container Database
These practices cover the following topics:
Exploring the CDB processes and files
Displaying CDB_xxx views

2 - 34 Copyright 2013, Oracle and/or its affiliates. All rights reserved.