SlideShare a Scribd company logo
1 of 22
Download to read offline
1
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Exploring Oracle Database 12c
Multitenant Best Practices
for your Cloud
Ami Aharonovich
Oracle ACE & OCP
Ami@Brillix.co.il
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.2
About Me
 Oracle ACE
 Oracle Certified Professional DBA (OCP)
 Founder and CEO, DBAces
 President, Israel Oracle User Group
 Oracle DBA consultant and instructor, dealing with
Oracle database core technologies
 Frequent speaker at Oracle Open World annual event
and various user group conferences around the globe
2
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.3
About Brillix-DBAces
We are committed to provide the highest quality of services
delivered by our dedicated team of industry’s top experts.
We offer:
 Complete end-to-end solutions based on best-of-breed
innovations in database, security and big data technologies
 On-site professional customized trainings led by our team of
Oracle ACEs and Oracle Certified Professionals
 Comprehensive security solutions and services for leading
database platforms and business applications, leveraging a
world-class team of security experts
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.4
Our Customers
3
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.5
Database (Storage Structures)
Oracle Database in 11g Release 2
Server
Database
Instance
System Global Area
Process Structures
Instance
Multiple non-CDBs share nothing:
• Too many background processes
• High shared/process memory
• Many copies of Oracle metadata
Pre-12c
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.6
Multitenant Container Database
Instance
System Global Area
Process Structures
Server
Single Instance
Multitenant
container
database
root
Data files Redo Log filesControl files
Application1
Data files
SALES
Data files
Single DB shares:
• Background
processes
• Shared/process
memory
• Oracle metadata
HR
Data files
Multitenant Container Database CDB
4
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.7
Separating SYSTEM and User Data
…
OBJ$ TAB$ SOURCE$
…
EMP DEPT
User metadata only User Data
…
OBJ$ TAB$ SOURCE$
Oracle metadata only
Multitenant
Container Database
Container
for
system
Container for application
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.8
Provisioning a Pluggable Database
Seed
PDB
New
empty
PDB
Imagine this
when the data files
are on a file system
that supports
copy-on-change.
root
Different methods:
• Create new PDB from PDB$SEED pluggable database.
• Plug in a non-CDB.
• Clone a non-CDB into a CDB, or a PDB into the same or
another CDB.
• Plug an unplugged PDB into a CDB.
Multitenant Container Database
5
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.9
Interacting Within Multitenant Container Database
PDB_1 PDB_2 PDB_n
fast intra-CDB db link
root
Multitenant Container Database
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.10
Multitenant Container Database Architecture
Instance
System Global Area
Process Structures
Server
Instance
Multitenant
container
database
root container
Data files Redo Log
files
Control files
UNDO
TEMP
SYSTEM
SYSAUX
seed PDB
Data files
SYSTEM
SYSAUX
SALES PDB
SYSTEM
SYSAUX TBS2
HR PDB
Data files
TEMP1
Data files
TEMP2
PDBid2 PDBid3 PDBid4 PDBid2 PDBid4
Single DB shares:
• Background
processes
• Shared/process
memory
• Oracle metadata
• Redo log files
• Control files
• Undo tablespace
6
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.11
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 1024 services in a CDB
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.12
Questions: Root Versus PDBs
What belongs to the CDB and not to a specific container?
• Control files and redo log files
What is in the root that is not in PDBs?
• UNDO tablespace (for each instance)
• System-supplied metadata
• Shared Oracle-supplied data
– PL/SQL Oracle-supplied packages
(DBMS_SQL …)
– PDBs service names
• CDB dictionary views providing information
across PDBs
• CDB Resource Manager plan
UNDO
NAME
PDB_SALES
PDB_HR
TABLE_NAME CON_ID
EMPLOYEES 1
TEST 2
Views CDB_xxx
NAME TYPE
TAB$ 2
USER$ 2
Table SYS.OBJ$
Table SYS.SERVICE$
CDBA
7
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.13
Questions: PDBs Versus Root
What is in a PDB that is not in the root nor in another PDB?
• Application tablespaces
• Local temporary tablespaces
• Local users and local roles
– Local users connect to the PDB where they exist.
• Non-shared local metadata
• Non-shared application data with other PDBs
• PDB Resource Manager plan
HR_TBS
TEMP1
EMP_NAME
SMITH
JOHNTable HR.EMPLOYEES
NAME TYPE
EMPLOYEES 2
JOBS 2
Table SYS.OBJ$
PDBA
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.14
Common and Local Users
Multitenant Container Database
root
PDB_HR
PDB_SALES
Table
HR.REGIONS
USERNAME COMMON
SYS YES
SYSTEM YES
C##DBA YES
C##HR YES
View CDB_USERS
Adding a common user involves adding a
description of that user in the root and in
every PDB.
A local user is a traditional user, known only
in its own PDB.
View DBA_USERS
USERNAME COMMON
SYS YES
SYSTEM YES
C##DBA YES
C##HR YES
SALES NO
USERNAME COMMON
SYS YES
SYSTEM YES
C##DBA YES
C##HR YES
HR_MGR NO
View DBA_USERS
Table
SALES.COUNTRIES
Tablespace
EXAMPLE
Tablespace
EXAMPLE
Tablespace
EXAMPLE
8
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.15
Common and Local Privileges and Roles
Multitenant Container Database
root
PDB_HR
Common users Local users
Common Priv (granted commonly)
Local Priv (granted locally)
Common roles
Local roles
SQL> GRANT c##_r1 TO C##DBA
CONTAINER=ALL;
SQL> GRANT l_priv TO C##DBA
CONTAINER=CURRENT;
Common privilege
Local privilege
Common Role (granted commonly)
Common Role (granted locally)
COMMON role LOCAL role
X
LOCAL role COMMON role
X
Priv/role granted locally
Priv/role granted commonlyX
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.16
CDB_xxx All objects in the multitenant container database across all PDBs
USER_xxx Objects owned by the current user
ALL_xxx Objects accessible by the current user
DBA_xxx All of the objects in a container or pluggable database
Data Dictionary Views
• 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 view_name FROM dba_views WHERE view_name like 'CDB%';
SQL> SELECT table_name FROM dict WHERE table_name like 'DBA%';
9
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.17
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 levels
• Oracle Scheduler
• Oracle GoldenGate
• Oracle Streams
• Oracle XStream both at CDB and PDB levels
Impacts
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.18
SQL*Plus OUI DBCA
EM
Cloud
Control
EM
Database
Express
SQL
Developer
DBUA
Create a
new CDB or
PDB
Yes Yes Yes
Yes
(PDB only)
Yes
(PDB only)
Yes
(PDB only)
Explore
CDB
instance,
architecture
and PDBs
Yes Yes Yes Yes
Upgrade a
12.1 CDB
to 12.x CDB
Yes Yes
Tools
10
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.19
Instance
SGA
Process Structures
Instance
Container
Database
CDB1
root container
seed pluggable database
Steps to Create a Container Database
2
1
Container Database CDB1
Datafiles
Control
files
UNDOSYSTEM
SYSAUX
Redo Log
files
SYSTEM
TEMP1
TEMP
SYSAUX
initCDB1.ora
3
4
Execute scripts from root
catcdb.sql
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.20
Creating a Container Database: Using SQL*Plus
1. Instance startup:
a. Set ORACLE_SID=CDB1
b. Set in initCDB1.ora:
– Set CONTROL_FILES to CDB control file names.
– Set DB_NAME to CDB name.
– Set ENABLE_PLUGGABLE_DATABASE to TRUE.
2. Create the database:
– CDB$ROOT container
– PDB$SEED pluggable database
3. Run the catcdb.sql script.
SQL> CONNECT / AS SYSDBA
SQL> STARTUP NOMOUNT
SQL> CREATE DATABASE CDB1 ENABLE PLUGGABLE DATABASE …
SEED FILE_NAME_CONVERT ('/oracle/dbs','/oracle/seed');
11
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.21
Creating a Container Database: Using DBCA
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.22
After CDB Creation: What Is New in CDBs
A CDB has new characteristics compared to non-CDBs:
• Two containers:
– The root (CDB$ROOT)
– The seed PDB (PDB$SEED)
• Several services: One per container
– Name of root service = name of the CDB (cdb1)
• Common users in root and seed: SYS,SYSTEM …
• Common privileges granted to common users
• Pre-defined common roles
• Tablespaces and data files associated to each container:
– root: SYSTEM (system-supplied metadata and no user data),
SYSAUX, TEMP
– seed: SYSTEM, SYSAUX , TEMP
12
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.23
USER_xxx Objects owned by the current user in a PDB
ALL_xxx Objects accessible by the current user in a PDB
DBA_xxx All of the objects in the root or a pluggable database
Data Dictionary Views: DBA_xxx
DBA dictionary views providing information within PDB:
• DBA_tablespaces: All tablespaces of the PDB
• DBA_data_files: All data files of the PDB
• DBA_tables: All tables in the PDB
• DBA_users: All common and local users of the PDB
SQL> SELECT table_name FROM dict WHERE table_name like 'DBA%';
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.24
CDB_xxx All of the objects in the container database (new column CON_ID)
USER_xxx Objects owned by the current user in a PDB
ALL_xxx Objects accessible by the current user in a PDB
DBA_xxx All of the objects in the root or a pluggable database
Data Dictionary Views: CDB_xxx
CDB dictionary views provide information across PDBs:
• CDB_pdbs: All PDBS within the CDB
• CDB_tablespaces: All tablespaces within the CDB
• CDB_data_files: All data files within the CDB
• CDB_users: All users within the CDB (common and local)
SQL> SELECT view_name FROM dba_views WHERE view_name like 'CDB%';
13
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.25
Data Dictionary Views: Examples
• Comparisons:
• Access to data in V$ or GV$ views showing data from
multiple PDBs can be secured using privilege.
SQL> SELECT name, open_mode FROM v$pdbs;
NAME OPEN_MODE
---------------- ----------
PDB$SEED READ ONLY
PDB1 READ WRITE
PDB2 READ WRITE
SQL> CONNECT / AS SYSDBA
SQL> SELECT role, common, con_id FROM cdb_roles;
SQL> SELECT role, common FROM dba_roles;
1
2
SQL> CONNECT sys@PDB1 AS SYSDBA
SQL> SELECT role, common, con_id FROM cdb_roles;
SQL> SELECT role, common FROM dba_roles;
3
4
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.26
After CDB Creation: To-Do List
After CDB creation, the CDBA has to:
• Set a separate default tablespace for the root and for each
PDB
• Set a default temporary tablespace for each container
• Start the listener
• Plug non-CDBs
• Test startup/shutdown procedures
• Define default PDB state to automate PDBs opening
• Create backup and recovery procedures
12.1.0.2
14
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.27
Provisioning New Pluggable Databases
Different methods:
• Create a new PDB from the seed PDB.
• Plug or clone a non-CDB into a CDB.
• Clone:
– A local PDB into the same CDB
– A remote PDB into a CDB
• Plug an unplugged PDB into another CDB.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.28
Tools
To provision new PDBs, you can use:
• SQL*Plus
• SQL Developer
• Enterprise Manager Cloud Control
• Enterprise Manager Database Express
• DBCA
– Copy from seed
– By unplugging/plugging method
15
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.29
Method 1: Create New PDB from PDB$SEED
Container Database CDB1
root
Data files/
Tempfiles
Redo Log
files
Control
files
UNDO
TEMP
PDB$SEED
Data files
PDB1
Data files
Create
PDB1
from
PDB$SEED
• Copies the data files from
PDB$SEED data files
• Creates SYSTEM and SYSAUX
tablespaces
• Creates a full catalog including
metadata pointing to Oracle-
supplied objects
• Creates a temporary tablespace,
TEMP
• Creates common users:
– Superuser SYS
– SYSTEM
• Creates a local user (PDBA)
granted local PDB_DBA role
• Creates a new default service
TEMP
SYSAUX
SYSTEM
SYSTEM
USERS
SYSAUX
SYSAUX
SYSTEM
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.30
Steps: With Location Clauses
Connect to the root as a common user with the CREATE
PLUGGABLE DATABASE privilege:
• Use FILE_NAME_CONVERT:
• Use CREATE_FILE_DEST:
• Use views to verify:
SQL> CREATE PLUGGABLE DATABASE pdb1
ADMIN USER admin1 IDENTIFIED BY p1 ROLES=(CONNECT)
FILE_NAME_CONVERT = ('PDB$SEEDdir', 'PDB1dir');
SQL> CONNECT / AS SYSDBA
SQL> SELECT * FROM cdb_pdbs;
SQL> SELECT * FROM cdb_tablespaces;
SQL> SELECT * FROM cdb_data_files;
SQL> CONNECT sys@pdb1 AS SYSDBA
SQL> CONNECT admin1@pdb1
SQL> CREATE PLUGGABLE DATABASE pdb2
ADMIN USER admin2 IDENTIFIED BY p2 ROLES=(CONNECT)
CREATE_FILE_DEST = 'PDB2dir';
12.1.0.2
16
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.31
Synchronization
• If the PDB is in MOUNTED or READ-ONLY mode
• If customer-created common users or roles are created /
modified / dropped
→The PDB needs to be resynchronized with the root.
– Open the PDB in READ-WRITE mode to synchronize the
PDB with the target CDB.
– If you open the PDB in READ-ONLY mode, an error is
returned.
→A compatibility check is automatically performed:
– Any violation is reported in the PDB_PLUG_IN_VIOLATIONS
view.
– If there is no violation, the PDB status is changed to
NORMAL.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.32
Method 2: Plug a Non-CDB into a CDB
Three possible methods:
• TTS or TDB or full export/import
• XML file definition with DBMS_PDB
• Replication
Entities are created in the new PDB:
• Tablespaces: SYSTEM, SYSAUX,
TEMP
• A full catalog
• Common users: SYS, SYSTEM
• A local administrator (PDBA)
• A new default service
Container Database CDB1
root
Data files/
Temp files
Redo Log
files
Control
files
PDB$SEED
Data files / Temp files
Create
PDB2
from
ORCL
ORCL
Data files Control
files
Redo Log
files
Dump file
PDB2
Data files
impdp TTS
12.1
expdp TTS
ReplicationXML file
DBMS_PDB
Plug
17
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.33
Plug a Non-CDB in to CDB Using DBMS_PDB
Container Database CDB1
root
Data files/
Temp files
Redo Log
files
Control
files
PDB$SEED
PDB2
Data files
Create
PDB2
from
ORCL
DBMS_PDB.DESCRIBE
Plug
XML metadata file
1. Open ORCL in READ ONLY mode.
2.
3. Connect to the target CDB1 CDB as a
common user with CREATE PLUGGABLE
DATABASE privilege.
4. Plug in the unplugged ORCL as PDB2.
5. Run the noncdb_to_pdb.sql script.
6. Open PDB2.
SQL> CREATE PLUGGABLE DATABASE
PDB2 USING '/tmp/ORCL.xml';
SQL> EXEC DBMS_PDB.DESCRIBE
('/tmp/ORCL.xml')
SQL> CONNECT sys@PDB2 AS SYSDBA
SQL> @$ORACLE_HOME/rdbms/admin/noncdb_to_pdb
Data files / Tempfiles
ORCL
Datafiles Control
files
Redo Log
files
12.1
SQL> ALTER PLUGGABLE DATABASE
PDB2 OPEN;
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.34
Method 3: Clone Local PDBs
Container Database CDB1
root
Data files/
Temp files
Redo Log
files
Control
files
PDB$SEED
Data files / Temp files
PDB1
Data files
Create
PDB3
from
PDB1
1. Set the DB_CREATE_FILE_DEST or
DB_FILE_NAME_CONVERT instance
parameter or
use the CREATE_FILE_DEST clause.
2. Connect to the root.
3. Quiesce PDB1:
4. Clone PDB3 from PDB1:
5. Open PDB3 in read-write mode.
6. Reopen PDB1.
PDB3
Data files
PDB3 owns:
• SYSTEM, SYSAUX tablespaces
• Full catalog
• A temporary tablespace
• SYS, SYSTEM common users
• Same local administrator name
• New service name
SQL> ALTER PLUGGABLE DATABASE
pdb1 CLOSE;
SQL> ALTER PLUGGABLE DATABASE
pdb1 OPEN READ ONLY;
SQL> CREATE PLUGGABLE DATABASE
pdb3 FROM pdb1;
SQL> ALTER PLUGGABLE DATABASE
pdb3 OPEN;
12.1.0.2
18
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.35
Method 4: Plug Unplugged PDB in to CDB
Unplug PDB1 from CDB1:
1. Connect to CDB1 as a common user.
2. Verify that PDB1 is closed.
3.
4. Optionally, drop PDB1 from CDB1.
Plug PDB1 in to CDB2:
1. Connect to CDB2 as a common user.
2. Use DBMS_PDB package to check the
compatibility of PDB1 with CDB2.
3.
4. Open PDB1 in read-write mode.
Container Database CDB1
root
PDB$SEED
PDB1
Data files
XML file
USERS
Unplug PDB1
Container Database CDB2
root
PDB$SEED
PDB1
Data files
Plug PDB1
SQL> ALTER PLUGGABLE DATABASE
pdb1 UNPLUG INTO
'xmlfile1.xml';
SQL> CREATE PLUGGABLE DATABASE
pdb1 USING 'xmlfile1.xml'
NOCOPY;
SYSAUX
SYSTEM
USERSSYSAUX
SYSTEM
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.36
Method 4: Flow
Are new PDB files based on
same files that were used to
create existing PDB in CDB?
If not, AS CLONE clause is required and so, it ensures
that Oracle Database generates unique PDB DBID,
GUID, and other identifiers expected for the new PDB.
XML file accurately describes
current locations of files?
Are files in correct location?
Do you want to specify
storage limits for PDB?
If not, the SOURCE_FILE_NAME_CONVERT clause is
required.
If not, specify COPY to copy files to new location or MOVE
to move them to another location.
If yes, use NOCOPY. COPY as the default.
If yes, specify the STORAGE clause.
• FILE_NAME_CONVERT or CREATE_FILE_DEST
clauses of CREATE PLUGGABLE DATABASE statement
• Instances DB_CREATE_FILE_DEST or
PDB_FILE_NAME_CONVERT parameters
Several clauses can be used in conjunction:
19
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.37
Plug Sample Schemas PDB: Using DBCA
1
2
3
4
Plug a new PDB with
Sample Schemas
using a PDB File Set
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.38
Dropping a PDB
Container Database CDB1
root
Data files/
Temp files
Redo Log
files
Control
files
File2
TEMP
PDB$SEED
Data files
File5
File6 File7
File4
File1
File3
PDB1
Data files
File8 Drop PDB1
• Updates control files
• If INCLUDING DATAFILES:
– Removes PDB1 datafiles
• If KEEP DATAFILES (default):
– Retain data files
– Can be plugged in another or
the same CDB
• Requires SYSDBA privilege
• Cannot drop seed PDB
File9 File10
PDB4
Data files
SQL> ALTER PLUGGABLE DATABASE
pdb1 CLOSE;
SQL> DROP PLUGGABLE DATABASE
pdb1 [INCLUDING DATAFILES];…
File7
File8
File9
File10
…
20
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.39
Migrating pre-12.1 Databases to 12.1 CDB
There are two methods:
1. Upgrade an existing pre-12.1
database to 12c.
2. Plug-in non-CDB into a CDB.
Or
1. Pre-create a PDB in CDB.
2. Use 11g expdp / 12c impdp
or replication between non-CDB
and PDB.
CDB CDB1
root
Data files/
Temp files
Redo Log
files
Control
files
ORCL
Data files Control
files
Redo Log
files
expdp
Dump file
PDB1
Data files
impdp
ORCL
Data files Control
files
Redo Log
files
1
2
11g
12c
Replication XML file
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.40
MOUNT
NOMOUNT
SHUTDOWN
Instance
started
– CDB control files opened for
the instance
– Root mounted
– PDBs mounted
– Root opened
– PDBs still mounted,
except seed in RO
OPEN
SQL> STARTUP
SQL> ALTER DATABASE cdb1 OPEN;
Or
SQL> SELECT name,open_mode
2 FROM v$pdbs;
NAME OPEN_MODE
---------------- ----------
PDB$SEED READ ONLY
PDB1 MOUNTED
PDB2 MOUNTED
Opening a CDB
21
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.41
OPEN
MOUNT
NOMOUNT
SHUTDOWN
Instance
started
– CDB control files opened for the
instance
– Root mounted
– PDBs mounted
– Root opened
– PDBs still mounted,
except seed in RO
PDB OPEN
PDBs opened RW,
except seed in RO
SQL> CONNECT sys@CDB1 AS SYSDBA
SQL> ALTER PLUGGABLE DATABASE pdb1 OPEN;
SQL> ALTER PLUGGABLE DATABASE ALL OPEN;
Or
SQL> SELECT name,open_mode
2 FROM v$pdbs;
NAME OPEN_MODE
---------------- ----------
PDB$SEED READ ONLY
PDB1 READ WRITE
PDB2 READ WRITE
Opening a PDB
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.42
CDB OPEN
MOUNT
NOMOUNT
SHUTDOWN
Instance
started
– CDB control files opened for the instance
– Root mounted
– PDBs mounted
– Root opened
– PDBs mounted, except
seed still RO
PDB CLOSE
PDBs closed
SQL> CONNECT / AS SYSDBA
SQL> ALTER PLUGGABLE DATABASE pdb1
CLOSE IMMEDIATE;
SQL> ALTER PLUGGABLE DATABASE
ALL EXCEPT pdb1 CLOSE;
SQL> ALTER PLUGGABLE DATABASE
ALL CLOSE;
SQL> CONNECT sys@pdb1 AS SYSDBA
SQL> ALTER PLUGGABLE DATABASE CLOSE;
Or
SQL> SHUTDOWN IMMEDIATE;
Closing a PDB
22
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.43
SQL> CONNECT sys@CDB1 AS SYSDBA
SQL> SHUTDOWN IMMEDIATE
Shutting Down a CDB Instance
• All PDBs closed (no new specific message)
• CDB closed
• CDB dismounted
• Instance shut down
• PDB closed
SQL> CONNECT sys@PDB1 AS SYSDBA
SQL> SHUTDOWN IMMEDIATE
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
Exploring Oracle Database 12c
Multitenant Best Practices
for your Cloud
Ami Aharonovich
Oracle ACE & OCP
Ami@Brillix.co.il

More Related Content

What's hot

2. Introduction-to-MSSQL-Server.pptx
2. Introduction-to-MSSQL-Server.pptx2. Introduction-to-MSSQL-Server.pptx
2. Introduction-to-MSSQL-Server.pptxAyobamiAdelekeMDM
 
Amazon Redshift Deep Dive - Serverless, Streaming, ML, Auto Copy (New feature...
Amazon Redshift Deep Dive - Serverless, Streaming, ML, Auto Copy (New feature...Amazon Redshift Deep Dive - Serverless, Streaming, ML, Auto Copy (New feature...
Amazon Redshift Deep Dive - Serverless, Streaming, ML, Auto Copy (New feature...Amazon Web Services Korea
 
DB2 for z/OS Architecture in Nutshell
DB2 for z/OS Architecture in NutshellDB2 for z/OS Architecture in Nutshell
DB2 for z/OS Architecture in NutshellCuneyt Goksu
 
Jenkins Pipeline meets Oracle
Jenkins Pipeline meets OracleJenkins Pipeline meets Oracle
Jenkins Pipeline meets OracleOliver Lemm
 
Microsoft SQL Server Database Administration.pptx
Microsoft SQL Server Database Administration.pptxMicrosoft SQL Server Database Administration.pptx
Microsoft SQL Server Database Administration.pptxsamtakke1
 
AWS S3 Tutorial For Beginners | Edureka
AWS S3 Tutorial For Beginners | EdurekaAWS S3 Tutorial For Beginners | Edureka
AWS S3 Tutorial For Beginners | EdurekaEdureka!
 
Amazon Relational Database Service (Amazon RDS)
Amazon Relational Database Service (Amazon RDS)Amazon Relational Database Service (Amazon RDS)
Amazon Relational Database Service (Amazon RDS)Amazon Web Services
 
Scaling on AWS for the First 10 Million Users
Scaling on AWS for the First 10 Million UsersScaling on AWS for the First 10 Million Users
Scaling on AWS for the First 10 Million UsersAmazon Web Services
 
Building High Availability Apps on Lightsail: Load Balancing and Block Storag...
Building High Availability Apps on Lightsail: Load Balancing and Block Storag...Building High Availability Apps on Lightsail: Load Balancing and Block Storag...
Building High Availability Apps on Lightsail: Load Balancing and Block Storag...Amazon Web Services
 
MySQL Group Replication
MySQL Group ReplicationMySQL Group Replication
MySQL Group ReplicationUlf Wendel
 
AWS Global Infrastructure Foundations
AWS Global Infrastructure Foundations AWS Global Infrastructure Foundations
AWS Global Infrastructure Foundations Amazon Web Services
 
Implementing High Availability Caching with Memcached
Implementing High Availability Caching with MemcachedImplementing High Availability Caching with Memcached
Implementing High Availability Caching with MemcachedGear6
 
SQL Server High Availability and Disaster Recovery
SQL Server High Availability and Disaster RecoverySQL Server High Availability and Disaster Recovery
SQL Server High Availability and Disaster RecoveryMichael Poremba
 
Migration to Oracle Multitenant
Migration to Oracle MultitenantMigration to Oracle Multitenant
Migration to Oracle MultitenantJitendra Singh
 
Extending Spark SQL API with Easier to Use Array Types Operations with Marek ...
Extending Spark SQL API with Easier to Use Array Types Operations with Marek ...Extending Spark SQL API with Easier to Use Array Types Operations with Marek ...
Extending Spark SQL API with Easier to Use Array Types Operations with Marek ...Databricks
 
AWS Well-Architected Framework: Operational Excellence Pillar
AWS Well-Architected Framework: Operational Excellence PillarAWS Well-Architected Framework: Operational Excellence Pillar
AWS Well-Architected Framework: Operational Excellence PillarJonathan LaCour
 
Backup and archiving in the aws cloud
Backup and archiving in the aws cloudBackup and archiving in the aws cloud
Backup and archiving in the aws cloudAmazon Web Services
 

What's hot (20)

2. Introduction-to-MSSQL-Server.pptx
2. Introduction-to-MSSQL-Server.pptx2. Introduction-to-MSSQL-Server.pptx
2. Introduction-to-MSSQL-Server.pptx
 
Amazon Redshift Deep Dive - Serverless, Streaming, ML, Auto Copy (New feature...
Amazon Redshift Deep Dive - Serverless, Streaming, ML, Auto Copy (New feature...Amazon Redshift Deep Dive - Serverless, Streaming, ML, Auto Copy (New feature...
Amazon Redshift Deep Dive - Serverless, Streaming, ML, Auto Copy (New feature...
 
DB2 for z/OS Architecture in Nutshell
DB2 for z/OS Architecture in NutshellDB2 for z/OS Architecture in Nutshell
DB2 for z/OS Architecture in Nutshell
 
Jenkins Pipeline meets Oracle
Jenkins Pipeline meets OracleJenkins Pipeline meets Oracle
Jenkins Pipeline meets Oracle
 
Introduction to Amazon Redshift
Introduction to Amazon RedshiftIntroduction to Amazon Redshift
Introduction to Amazon Redshift
 
Microsoft SQL Server Database Administration.pptx
Microsoft SQL Server Database Administration.pptxMicrosoft SQL Server Database Administration.pptx
Microsoft SQL Server Database Administration.pptx
 
AWS S3 Tutorial For Beginners | Edureka
AWS S3 Tutorial For Beginners | EdurekaAWS S3 Tutorial For Beginners | Edureka
AWS S3 Tutorial For Beginners | Edureka
 
Amazon Relational Database Service (Amazon RDS)
Amazon Relational Database Service (Amazon RDS)Amazon Relational Database Service (Amazon RDS)
Amazon Relational Database Service (Amazon RDS)
 
Scaling on AWS for the First 10 Million Users
Scaling on AWS for the First 10 Million UsersScaling on AWS for the First 10 Million Users
Scaling on AWS for the First 10 Million Users
 
Building High Availability Apps on Lightsail: Load Balancing and Block Storag...
Building High Availability Apps on Lightsail: Load Balancing and Block Storag...Building High Availability Apps on Lightsail: Load Balancing and Block Storag...
Building High Availability Apps on Lightsail: Load Balancing and Block Storag...
 
MySQL Group Replication
MySQL Group ReplicationMySQL Group Replication
MySQL Group Replication
 
AWS Global Infrastructure Foundations
AWS Global Infrastructure Foundations AWS Global Infrastructure Foundations
AWS Global Infrastructure Foundations
 
Implementing High Availability Caching with Memcached
Implementing High Availability Caching with MemcachedImplementing High Availability Caching with Memcached
Implementing High Availability Caching with Memcached
 
SQL Server High Availability and Disaster Recovery
SQL Server High Availability and Disaster RecoverySQL Server High Availability and Disaster Recovery
SQL Server High Availability and Disaster Recovery
 
MySQL Security
MySQL SecurityMySQL Security
MySQL Security
 
Migration to Oracle Multitenant
Migration to Oracle MultitenantMigration to Oracle Multitenant
Migration to Oracle Multitenant
 
Extending Spark SQL API with Easier to Use Array Types Operations with Marek ...
Extending Spark SQL API with Easier to Use Array Types Operations with Marek ...Extending Spark SQL API with Easier to Use Array Types Operations with Marek ...
Extending Spark SQL API with Easier to Use Array Types Operations with Marek ...
 
AWS Well-Architected Framework: Operational Excellence Pillar
AWS Well-Architected Framework: Operational Excellence PillarAWS Well-Architected Framework: Operational Excellence Pillar
AWS Well-Architected Framework: Operational Excellence Pillar
 
Backup and archiving in the aws cloud
Backup and archiving in the aws cloudBackup and archiving in the aws cloud
Backup and archiving in the aws cloud
 
Data Lake,beyond the Data Warehouse
Data Lake,beyond the Data WarehouseData Lake,beyond the Data Warehouse
Data Lake,beyond the Data Warehouse
 

Viewers also liked

Oracle Database 12c Multitenant for Consolidation
Oracle Database 12c Multitenant for ConsolidationOracle Database 12c Multitenant for Consolidation
Oracle Database 12c Multitenant for ConsolidationYudi Herdiana
 
Oracle 12c and its pluggable databases
Oracle 12c and its pluggable databasesOracle 12c and its pluggable databases
Oracle 12c and its pluggable databasesGustavo Rene Antunez
 
Oracle 12c Multi Tenant
Oracle 12c Multi TenantOracle 12c Multi Tenant
Oracle 12c Multi TenantRed Stack Tech
 
Best New Features of Oracle Database 12c
Best New Features of Oracle Database 12cBest New Features of Oracle Database 12c
Best New Features of Oracle Database 12cPini Dibask
 
Oracle 12c Multitenant architecture
Oracle 12c Multitenant architectureOracle 12c Multitenant architecture
Oracle 12c Multitenant architecturenaderattia
 
Exploring Oracle Multitenant in Oracle Database 12c
Exploring Oracle Multitenant in Oracle Database 12cExploring Oracle Multitenant in Oracle Database 12c
Exploring Oracle Multitenant in Oracle Database 12cZohar Elkayam
 
Oracle database 12c new features
Oracle database 12c new featuresOracle database 12c new features
Oracle database 12c new featuresRemote DBA Services
 
Ensuring Data Protection Using Oracle Flashback Features - Presentation
Ensuring Data Protection Using Oracle Flashback Features - PresentationEnsuring Data Protection Using Oracle Flashback Features - Presentation
Ensuring Data Protection Using Oracle Flashback Features - PresentationPini Dibask
 
Simplify Consolidation with Oracle Pluggable Databases
Simplify Consolidation with Oracle Pluggable DatabasesSimplify Consolidation with Oracle Pluggable Databases
Simplify Consolidation with Oracle Pluggable Databasesomnidba
 
Simplify Consolidation with Oracle Database 12c
Simplify Consolidation with Oracle Database 12cSimplify Consolidation with Oracle Database 12c
Simplify Consolidation with Oracle Database 12cMaris Elsins
 
Webséminaire DBaaS (Novembre 2014)
Webséminaire DBaaS (Novembre 2014)Webséminaire DBaaS (Novembre 2014)
Webséminaire DBaaS (Novembre 2014)Jean-Philippe PINTE
 
Introduction to Oracle Data Guard Broker
Introduction to Oracle Data Guard BrokerIntroduction to Oracle Data Guard Broker
Introduction to Oracle Data Guard BrokerZohar Elkayam
 
Oracle Database 12c Feature Support in Oracle SQL Developer
Oracle Database 12c Feature Support in Oracle SQL DeveloperOracle Database 12c Feature Support in Oracle SQL Developer
Oracle Database 12c Feature Support in Oracle SQL DeveloperJeff Smith
 
Oracle 12c PDB insights
Oracle 12c PDB insightsOracle 12c PDB insights
Oracle 12c PDB insightsKirill Loifman
 
Exadata x4 for_sap
Exadata x4 for_sapExadata x4 for_sap
Exadata x4 for_sapFran Navarro
 
Cosas que “probablemente” no sabes pero deberías de saber en Oracle 12c
Cosas que “probablemente” no sabes pero deberías de saber en Oracle 12cCosas que “probablemente” no sabes pero deberías de saber en Oracle 12c
Cosas que “probablemente” no sabes pero deberías de saber en Oracle 12cGustavo Rene Antunez
 

Viewers also liked (20)

Oracle Database 12c Multitenant for Consolidation
Oracle Database 12c Multitenant for ConsolidationOracle Database 12c Multitenant for Consolidation
Oracle Database 12c Multitenant for Consolidation
 
Oracle 12c and its pluggable databases
Oracle 12c and its pluggable databasesOracle 12c and its pluggable databases
Oracle 12c and its pluggable databases
 
Oracle 12c Multi Tenant
Oracle 12c Multi TenantOracle 12c Multi Tenant
Oracle 12c Multi Tenant
 
Oracle 12c Architecture
Oracle 12c ArchitectureOracle 12c Architecture
Oracle 12c Architecture
 
Best New Features of Oracle Database 12c
Best New Features of Oracle Database 12cBest New Features of Oracle Database 12c
Best New Features of Oracle Database 12c
 
Oracle 12c Multitenant architecture
Oracle 12c Multitenant architectureOracle 12c Multitenant architecture
Oracle 12c Multitenant architecture
 
Exploring Oracle Multitenant in Oracle Database 12c
Exploring Oracle Multitenant in Oracle Database 12cExploring Oracle Multitenant in Oracle Database 12c
Exploring Oracle Multitenant in Oracle Database 12c
 
Oracle database 12c new features
Oracle database 12c new featuresOracle database 12c new features
Oracle database 12c new features
 
DB Forum 2012 - EM12c & DBaaS
DB Forum 2012 - EM12c & DBaaSDB Forum 2012 - EM12c & DBaaS
DB Forum 2012 - EM12c & DBaaS
 
Ensuring Data Protection Using Oracle Flashback Features - Presentation
Ensuring Data Protection Using Oracle Flashback Features - PresentationEnsuring Data Protection Using Oracle Flashback Features - Presentation
Ensuring Data Protection Using Oracle Flashback Features - Presentation
 
Simplify Consolidation with Oracle Pluggable Databases
Simplify Consolidation with Oracle Pluggable DatabasesSimplify Consolidation with Oracle Pluggable Databases
Simplify Consolidation with Oracle Pluggable Databases
 
EM12c - Chargeback
EM12c - ChargebackEM12c - Chargeback
EM12c - Chargeback
 
Simplify Consolidation with Oracle Database 12c
Simplify Consolidation with Oracle Database 12cSimplify Consolidation with Oracle Database 12c
Simplify Consolidation with Oracle Database 12c
 
Webséminaire DBaaS (Novembre 2014)
Webséminaire DBaaS (Novembre 2014)Webséminaire DBaaS (Novembre 2014)
Webséminaire DBaaS (Novembre 2014)
 
Introduction to Oracle Data Guard Broker
Introduction to Oracle Data Guard BrokerIntroduction to Oracle Data Guard Broker
Introduction to Oracle Data Guard Broker
 
Oracle Database 12c Feature Support in Oracle SQL Developer
Oracle Database 12c Feature Support in Oracle SQL DeveloperOracle Database 12c Feature Support in Oracle SQL Developer
Oracle Database 12c Feature Support in Oracle SQL Developer
 
Oracle 12c PDB insights
Oracle 12c PDB insightsOracle 12c PDB insights
Oracle 12c PDB insights
 
Exadata x4 for_sap
Exadata x4 for_sapExadata x4 for_sap
Exadata x4 for_sap
 
Oracle 12c - Multitenant Feature
Oracle 12c - Multitenant FeatureOracle 12c - Multitenant Feature
Oracle 12c - Multitenant Feature
 
Cosas que “probablemente” no sabes pero deberías de saber en Oracle 12c
Cosas que “probablemente” no sabes pero deberías de saber en Oracle 12cCosas que “probablemente” no sabes pero deberías de saber en Oracle 12c
Cosas que “probablemente” no sabes pero deberías de saber en Oracle 12c
 

Similar to Exploring Oracle Database 12c Multitenant best practices for your Cloud

Database Consolidation using the Oracle Multitenant Architecture
Database Consolidation using the Oracle Multitenant ArchitectureDatabase Consolidation using the Oracle Multitenant Architecture
Database Consolidation using the Oracle Multitenant ArchitecturePini Dibask
 
OOW 17 - database consolidation using the oracle multitenant architecture
OOW 17 - database consolidation using the oracle multitenant architectureOOW 17 - database consolidation using the oracle multitenant architecture
OOW 17 - database consolidation using the oracle multitenant architecturePini Dibask
 
Under The Hood of Pluggable Databases by Alex Gorbachev, Pythian, Oracle OpeW...
Under The Hood of Pluggable Databases by Alex Gorbachev, Pythian, Oracle OpeW...Under The Hood of Pluggable Databases by Alex Gorbachev, Pythian, Oracle OpeW...
Under The Hood of Pluggable Databases by Alex Gorbachev, Pythian, Oracle OpeW...Alex Gorbachev
 
Database Consolidation using Oracle Multitenant
Database Consolidation using Oracle MultitenantDatabase Consolidation using Oracle Multitenant
Database Consolidation using Oracle MultitenantPini Dibask
 
Winning Performance Challenges in Oracle Multitenant
Winning Performance Challenges in Oracle MultitenantWinning Performance Challenges in Oracle Multitenant
Winning Performance Challenges in Oracle MultitenantPini Dibask
 
RMOUG 18 - Winning Performance Challenges in Oracle Multitenant
RMOUG 18 - Winning Performance Challenges in Oracle MultitenantRMOUG 18 - Winning Performance Challenges in Oracle Multitenant
RMOUG 18 - Winning Performance Challenges in Oracle MultitenantPini Dibask
 
Winning performance challenges in oracle multitenant
Winning performance challenges in oracle multitenantWinning performance challenges in oracle multitenant
Winning performance challenges in oracle multitenantPini Dibask
 
Collaborate 17 - Database consolidation using the oracle multitenant architec...
Collaborate 17 - Database consolidation using the oracle multitenant architec...Collaborate 17 - Database consolidation using the oracle multitenant architec...
Collaborate 17 - Database consolidation using the oracle multitenant architec...Pini Dibask
 
Vijfhart thema-avond-oracle-12c-new-features
Vijfhart thema-avond-oracle-12c-new-featuresVijfhart thema-avond-oracle-12c-new-features
Vijfhart thema-avond-oracle-12c-new-featuresmkorremans
 
OUGN winning performnace challenges in oracle Multitenant
OUGN   winning performnace challenges in oracle MultitenantOUGN   winning performnace challenges in oracle Multitenant
OUGN winning performnace challenges in oracle MultitenantPini Dibask
 
TechEvent 2019: Oracle PDB Isolation and Security; Stefan Oehrli - Trivadis
TechEvent 2019: Oracle PDB Isolation and Security; Stefan Oehrli - TrivadisTechEvent 2019: Oracle PDB Isolation and Security; Stefan Oehrli - Trivadis
TechEvent 2019: Oracle PDB Isolation and Security; Stefan Oehrli - TrivadisTrivadis
 
Gloc gangler 2018._v4
Gloc gangler 2018._v4Gloc gangler 2018._v4
Gloc gangler 2018._v4Secure-24
 
Security Multitenant
Security MultitenantSecurity Multitenant
Security MultitenantArush Jain
 
Oracle Multitenant in 50 minutes
Oracle Multitenant in 50 minutesOracle Multitenant in 50 minutes
Oracle Multitenant in 50 minutesConnor McDonald
 
Multi-Tenancy: Da Teoria à Prática, do DB ao Middleware
Multi-Tenancy: Da Teoria à Prática, do DB ao MiddlewareMulti-Tenancy: Da Teoria à Prática, do DB ao Middleware
Multi-Tenancy: Da Teoria à Prática, do DB ao MiddlewareBruno Borges
 
Oracle database 12c introduction- Satyendra Pasalapudi
Oracle database 12c introduction- Satyendra PasalapudiOracle database 12c introduction- Satyendra Pasalapudi
Oracle database 12c introduction- Satyendra Pasalapudipasalapudi123
 
Using oracle12c pluggable databases to archive
Using oracle12c pluggable databases to archiveUsing oracle12c pluggable databases to archive
Using oracle12c pluggable databases to archiveSecure-24
 
Consolidate and prepare for cloud efficiencies
Consolidate and prepare for cloud efficienciesConsolidate and prepare for cloud efficiencies
Consolidate and prepare for cloud efficienciesDLT Solutions
 

Similar to Exploring Oracle Database 12c Multitenant best practices for your Cloud (20)

Database Consolidation using the Oracle Multitenant Architecture
Database Consolidation using the Oracle Multitenant ArchitectureDatabase Consolidation using the Oracle Multitenant Architecture
Database Consolidation using the Oracle Multitenant Architecture
 
OOW 17 - database consolidation using the oracle multitenant architecture
OOW 17 - database consolidation using the oracle multitenant architectureOOW 17 - database consolidation using the oracle multitenant architecture
OOW 17 - database consolidation using the oracle multitenant architecture
 
Under The Hood of Pluggable Databases by Alex Gorbachev, Pythian, Oracle OpeW...
Under The Hood of Pluggable Databases by Alex Gorbachev, Pythian, Oracle OpeW...Under The Hood of Pluggable Databases by Alex Gorbachev, Pythian, Oracle OpeW...
Under The Hood of Pluggable Databases by Alex Gorbachev, Pythian, Oracle OpeW...
 
Database Consolidation using Oracle Multitenant
Database Consolidation using Oracle MultitenantDatabase Consolidation using Oracle Multitenant
Database Consolidation using Oracle Multitenant
 
Winning Performance Challenges in Oracle Multitenant
Winning Performance Challenges in Oracle MultitenantWinning Performance Challenges in Oracle Multitenant
Winning Performance Challenges in Oracle Multitenant
 
RMOUG 18 - Winning Performance Challenges in Oracle Multitenant
RMOUG 18 - Winning Performance Challenges in Oracle MultitenantRMOUG 18 - Winning Performance Challenges in Oracle Multitenant
RMOUG 18 - Winning Performance Challenges in Oracle Multitenant
 
Winning performance challenges in oracle multitenant
Winning performance challenges in oracle multitenantWinning performance challenges in oracle multitenant
Winning performance challenges in oracle multitenant
 
Collaborate 17 - Database consolidation using the oracle multitenant architec...
Collaborate 17 - Database consolidation using the oracle multitenant architec...Collaborate 17 - Database consolidation using the oracle multitenant architec...
Collaborate 17 - Database consolidation using the oracle multitenant architec...
 
Cdb part i
Cdb part iCdb part i
Cdb part i
 
Oracle Database 12c : Multitenant
Oracle Database 12c : MultitenantOracle Database 12c : Multitenant
Oracle Database 12c : Multitenant
 
Vijfhart thema-avond-oracle-12c-new-features
Vijfhart thema-avond-oracle-12c-new-featuresVijfhart thema-avond-oracle-12c-new-features
Vijfhart thema-avond-oracle-12c-new-features
 
OUGN winning performnace challenges in oracle Multitenant
OUGN   winning performnace challenges in oracle MultitenantOUGN   winning performnace challenges in oracle Multitenant
OUGN winning performnace challenges in oracle Multitenant
 
TechEvent 2019: Oracle PDB Isolation and Security; Stefan Oehrli - Trivadis
TechEvent 2019: Oracle PDB Isolation and Security; Stefan Oehrli - TrivadisTechEvent 2019: Oracle PDB Isolation and Security; Stefan Oehrli - Trivadis
TechEvent 2019: Oracle PDB Isolation and Security; Stefan Oehrli - Trivadis
 
Gloc gangler 2018._v4
Gloc gangler 2018._v4Gloc gangler 2018._v4
Gloc gangler 2018._v4
 
Security Multitenant
Security MultitenantSecurity Multitenant
Security Multitenant
 
Oracle Multitenant in 50 minutes
Oracle Multitenant in 50 minutesOracle Multitenant in 50 minutes
Oracle Multitenant in 50 minutes
 
Multi-Tenancy: Da Teoria à Prática, do DB ao Middleware
Multi-Tenancy: Da Teoria à Prática, do DB ao MiddlewareMulti-Tenancy: Da Teoria à Prática, do DB ao Middleware
Multi-Tenancy: Da Teoria à Prática, do DB ao Middleware
 
Oracle database 12c introduction- Satyendra Pasalapudi
Oracle database 12c introduction- Satyendra PasalapudiOracle database 12c introduction- Satyendra Pasalapudi
Oracle database 12c introduction- Satyendra Pasalapudi
 
Using oracle12c pluggable databases to archive
Using oracle12c pluggable databases to archiveUsing oracle12c pluggable databases to archive
Using oracle12c pluggable databases to archive
 
Consolidate and prepare for cloud efficiencies
Consolidate and prepare for cloud efficienciesConsolidate and prepare for cloud efficiencies
Consolidate and prepare for cloud efficiencies
 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 

Recently uploaded (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 

Exploring Oracle Database 12c Multitenant best practices for your Cloud

  • 1. 1 Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Exploring Oracle Database 12c Multitenant Best Practices for your Cloud Ami Aharonovich Oracle ACE & OCP Ami@Brillix.co.il Copyright © 2014, Oracle and/or its affiliates. All rights reserved.2 About Me  Oracle ACE  Oracle Certified Professional DBA (OCP)  Founder and CEO, DBAces  President, Israel Oracle User Group  Oracle DBA consultant and instructor, dealing with Oracle database core technologies  Frequent speaker at Oracle Open World annual event and various user group conferences around the globe
  • 2. 2 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.3 About Brillix-DBAces We are committed to provide the highest quality of services delivered by our dedicated team of industry’s top experts. We offer:  Complete end-to-end solutions based on best-of-breed innovations in database, security and big data technologies  On-site professional customized trainings led by our team of Oracle ACEs and Oracle Certified Professionals  Comprehensive security solutions and services for leading database platforms and business applications, leveraging a world-class team of security experts Copyright © 2014, Oracle and/or its affiliates. All rights reserved.4 Our Customers
  • 3. 3 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.5 Database (Storage Structures) Oracle Database in 11g Release 2 Server Database Instance System Global Area Process Structures Instance Multiple non-CDBs share nothing: • Too many background processes • High shared/process memory • Many copies of Oracle metadata Pre-12c Copyright © 2014, Oracle and/or its affiliates. All rights reserved.6 Multitenant Container Database Instance System Global Area Process Structures Server Single Instance Multitenant container database root Data files Redo Log filesControl files Application1 Data files SALES Data files Single DB shares: • Background processes • Shared/process memory • Oracle metadata HR Data files Multitenant Container Database CDB
  • 4. 4 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.7 Separating SYSTEM and User Data … OBJ$ TAB$ SOURCE$ … EMP DEPT User metadata only User Data … OBJ$ TAB$ SOURCE$ Oracle metadata only Multitenant Container Database Container for system Container for application Copyright © 2014, Oracle and/or its affiliates. All rights reserved.8 Provisioning a Pluggable Database Seed PDB New empty PDB Imagine this when the data files are on a file system that supports copy-on-change. root Different methods: • Create new PDB from PDB$SEED pluggable database. • Plug in a non-CDB. • Clone a non-CDB into a CDB, or a PDB into the same or another CDB. • Plug an unplugged PDB into a CDB. Multitenant Container Database
  • 5. 5 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.9 Interacting Within Multitenant Container Database PDB_1 PDB_2 PDB_n fast intra-CDB db link root Multitenant Container Database Copyright © 2014, Oracle and/or its affiliates. All rights reserved.10 Multitenant Container Database Architecture Instance System Global Area Process Structures Server Instance Multitenant container database root container Data files Redo Log files Control files UNDO TEMP SYSTEM SYSAUX seed PDB Data files SYSTEM SYSAUX SALES PDB SYSTEM SYSAUX TBS2 HR PDB Data files TEMP1 Data files TEMP2 PDBid2 PDBid3 PDBid4 PDBid2 PDBid4 Single DB shares: • Background processes • Shared/process memory • Oracle metadata • Redo log files • Control files • Undo tablespace
  • 6. 6 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.11 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 1024 services in a CDB Copyright © 2014, Oracle and/or its affiliates. All rights reserved.12 Questions: Root Versus PDBs What belongs to the CDB and not to a specific container? • Control files and redo log files What is in the root that is not in PDBs? • UNDO tablespace (for each instance) • System-supplied metadata • Shared Oracle-supplied data – PL/SQL Oracle-supplied packages (DBMS_SQL …) – PDBs service names • CDB dictionary views providing information across PDBs • CDB Resource Manager plan UNDO NAME PDB_SALES PDB_HR TABLE_NAME CON_ID EMPLOYEES 1 TEST 2 Views CDB_xxx NAME TYPE TAB$ 2 USER$ 2 Table SYS.OBJ$ Table SYS.SERVICE$ CDBA
  • 7. 7 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.13 Questions: PDBs Versus Root What is in a PDB that is not in the root nor in another PDB? • Application tablespaces • Local temporary tablespaces • Local users and local roles – Local users connect to the PDB where they exist. • Non-shared local metadata • Non-shared application data with other PDBs • PDB Resource Manager plan HR_TBS TEMP1 EMP_NAME SMITH JOHNTable HR.EMPLOYEES NAME TYPE EMPLOYEES 2 JOBS 2 Table SYS.OBJ$ PDBA Copyright © 2014, Oracle and/or its affiliates. All rights reserved.14 Common and Local Users Multitenant Container Database root PDB_HR PDB_SALES Table HR.REGIONS USERNAME COMMON SYS YES SYSTEM YES C##DBA YES C##HR YES View CDB_USERS Adding a common user involves adding a description of that user in the root and in every PDB. A local user is a traditional user, known only in its own PDB. View DBA_USERS USERNAME COMMON SYS YES SYSTEM YES C##DBA YES C##HR YES SALES NO USERNAME COMMON SYS YES SYSTEM YES C##DBA YES C##HR YES HR_MGR NO View DBA_USERS Table SALES.COUNTRIES Tablespace EXAMPLE Tablespace EXAMPLE Tablespace EXAMPLE
  • 8. 8 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.15 Common and Local Privileges and Roles Multitenant Container Database root PDB_HR Common users Local users Common Priv (granted commonly) Local Priv (granted locally) Common roles Local roles SQL> GRANT c##_r1 TO C##DBA CONTAINER=ALL; SQL> GRANT l_priv TO C##DBA CONTAINER=CURRENT; Common privilege Local privilege Common Role (granted commonly) Common Role (granted locally) COMMON role LOCAL role X LOCAL role COMMON role X Priv/role granted locally Priv/role granted commonlyX Copyright © 2014, Oracle and/or its affiliates. All rights reserved.16 CDB_xxx All objects in the multitenant container database across all PDBs USER_xxx Objects owned by the current user ALL_xxx Objects accessible by the current user DBA_xxx All of the objects in a container or pluggable database Data Dictionary Views • 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 view_name FROM dba_views WHERE view_name like 'CDB%'; SQL> SELECT table_name FROM dict WHERE table_name like 'DBA%';
  • 9. 9 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.17 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 levels • Oracle Scheduler • Oracle GoldenGate • Oracle Streams • Oracle XStream both at CDB and PDB levels Impacts Copyright © 2014, Oracle and/or its affiliates. All rights reserved.18 SQL*Plus OUI DBCA EM Cloud Control EM Database Express SQL Developer DBUA Create a new CDB or PDB Yes Yes Yes Yes (PDB only) Yes (PDB only) Yes (PDB only) Explore CDB instance, architecture and PDBs Yes Yes Yes Yes Upgrade a 12.1 CDB to 12.x CDB Yes Yes Tools
  • 10. 10 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.19 Instance SGA Process Structures Instance Container Database CDB1 root container seed pluggable database Steps to Create a Container Database 2 1 Container Database CDB1 Datafiles Control files UNDOSYSTEM SYSAUX Redo Log files SYSTEM TEMP1 TEMP SYSAUX initCDB1.ora 3 4 Execute scripts from root catcdb.sql Copyright © 2014, Oracle and/or its affiliates. All rights reserved.20 Creating a Container Database: Using SQL*Plus 1. Instance startup: a. Set ORACLE_SID=CDB1 b. Set in initCDB1.ora: – Set CONTROL_FILES to CDB control file names. – Set DB_NAME to CDB name. – Set ENABLE_PLUGGABLE_DATABASE to TRUE. 2. Create the database: – CDB$ROOT container – PDB$SEED pluggable database 3. Run the catcdb.sql script. SQL> CONNECT / AS SYSDBA SQL> STARTUP NOMOUNT SQL> CREATE DATABASE CDB1 ENABLE PLUGGABLE DATABASE … SEED FILE_NAME_CONVERT ('/oracle/dbs','/oracle/seed');
  • 11. 11 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.21 Creating a Container Database: Using DBCA Copyright © 2014, Oracle and/or its affiliates. All rights reserved.22 After CDB Creation: What Is New in CDBs A CDB has new characteristics compared to non-CDBs: • Two containers: – The root (CDB$ROOT) – The seed PDB (PDB$SEED) • Several services: One per container – Name of root service = name of the CDB (cdb1) • Common users in root and seed: SYS,SYSTEM … • Common privileges granted to common users • Pre-defined common roles • Tablespaces and data files associated to each container: – root: SYSTEM (system-supplied metadata and no user data), SYSAUX, TEMP – seed: SYSTEM, SYSAUX , TEMP
  • 12. 12 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.23 USER_xxx Objects owned by the current user in a PDB ALL_xxx Objects accessible by the current user in a PDB DBA_xxx All of the objects in the root or a pluggable database Data Dictionary Views: DBA_xxx DBA dictionary views providing information within PDB: • DBA_tablespaces: All tablespaces of the PDB • DBA_data_files: All data files of the PDB • DBA_tables: All tables in the PDB • DBA_users: All common and local users of the PDB SQL> SELECT table_name FROM dict WHERE table_name like 'DBA%'; Copyright © 2014, Oracle and/or its affiliates. All rights reserved.24 CDB_xxx All of the objects in the container database (new column CON_ID) USER_xxx Objects owned by the current user in a PDB ALL_xxx Objects accessible by the current user in a PDB DBA_xxx All of the objects in the root or a pluggable database Data Dictionary Views: CDB_xxx CDB dictionary views provide information across PDBs: • CDB_pdbs: All PDBS within the CDB • CDB_tablespaces: All tablespaces within the CDB • CDB_data_files: All data files within the CDB • CDB_users: All users within the CDB (common and local) SQL> SELECT view_name FROM dba_views WHERE view_name like 'CDB%';
  • 13. 13 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.25 Data Dictionary Views: Examples • Comparisons: • Access to data in V$ or GV$ views showing data from multiple PDBs can be secured using privilege. SQL> SELECT name, open_mode FROM v$pdbs; NAME OPEN_MODE ---------------- ---------- PDB$SEED READ ONLY PDB1 READ WRITE PDB2 READ WRITE SQL> CONNECT / AS SYSDBA SQL> SELECT role, common, con_id FROM cdb_roles; SQL> SELECT role, common FROM dba_roles; 1 2 SQL> CONNECT sys@PDB1 AS SYSDBA SQL> SELECT role, common, con_id FROM cdb_roles; SQL> SELECT role, common FROM dba_roles; 3 4 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.26 After CDB Creation: To-Do List After CDB creation, the CDBA has to: • Set a separate default tablespace for the root and for each PDB • Set a default temporary tablespace for each container • Start the listener • Plug non-CDBs • Test startup/shutdown procedures • Define default PDB state to automate PDBs opening • Create backup and recovery procedures 12.1.0.2
  • 14. 14 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.27 Provisioning New Pluggable Databases Different methods: • Create a new PDB from the seed PDB. • Plug or clone a non-CDB into a CDB. • Clone: – A local PDB into the same CDB – A remote PDB into a CDB • Plug an unplugged PDB into another CDB. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.28 Tools To provision new PDBs, you can use: • SQL*Plus • SQL Developer • Enterprise Manager Cloud Control • Enterprise Manager Database Express • DBCA – Copy from seed – By unplugging/plugging method
  • 15. 15 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.29 Method 1: Create New PDB from PDB$SEED Container Database CDB1 root Data files/ Tempfiles Redo Log files Control files UNDO TEMP PDB$SEED Data files PDB1 Data files Create PDB1 from PDB$SEED • Copies the data files from PDB$SEED data files • Creates SYSTEM and SYSAUX tablespaces • Creates a full catalog including metadata pointing to Oracle- supplied objects • Creates a temporary tablespace, TEMP • Creates common users: – Superuser SYS – SYSTEM • Creates a local user (PDBA) granted local PDB_DBA role • Creates a new default service TEMP SYSAUX SYSTEM SYSTEM USERS SYSAUX SYSAUX SYSTEM Copyright © 2014, Oracle and/or its affiliates. All rights reserved.30 Steps: With Location Clauses Connect to the root as a common user with the CREATE PLUGGABLE DATABASE privilege: • Use FILE_NAME_CONVERT: • Use CREATE_FILE_DEST: • Use views to verify: SQL> CREATE PLUGGABLE DATABASE pdb1 ADMIN USER admin1 IDENTIFIED BY p1 ROLES=(CONNECT) FILE_NAME_CONVERT = ('PDB$SEEDdir', 'PDB1dir'); SQL> CONNECT / AS SYSDBA SQL> SELECT * FROM cdb_pdbs; SQL> SELECT * FROM cdb_tablespaces; SQL> SELECT * FROM cdb_data_files; SQL> CONNECT sys@pdb1 AS SYSDBA SQL> CONNECT admin1@pdb1 SQL> CREATE PLUGGABLE DATABASE pdb2 ADMIN USER admin2 IDENTIFIED BY p2 ROLES=(CONNECT) CREATE_FILE_DEST = 'PDB2dir'; 12.1.0.2
  • 16. 16 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.31 Synchronization • If the PDB is in MOUNTED or READ-ONLY mode • If customer-created common users or roles are created / modified / dropped →The PDB needs to be resynchronized with the root. – Open the PDB in READ-WRITE mode to synchronize the PDB with the target CDB. – If you open the PDB in READ-ONLY mode, an error is returned. →A compatibility check is automatically performed: – Any violation is reported in the PDB_PLUG_IN_VIOLATIONS view. – If there is no violation, the PDB status is changed to NORMAL. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.32 Method 2: Plug a Non-CDB into a CDB Three possible methods: • TTS or TDB or full export/import • XML file definition with DBMS_PDB • Replication Entities are created in the new PDB: • Tablespaces: SYSTEM, SYSAUX, TEMP • A full catalog • Common users: SYS, SYSTEM • A local administrator (PDBA) • A new default service Container Database CDB1 root Data files/ Temp files Redo Log files Control files PDB$SEED Data files / Temp files Create PDB2 from ORCL ORCL Data files Control files Redo Log files Dump file PDB2 Data files impdp TTS 12.1 expdp TTS ReplicationXML file DBMS_PDB Plug
  • 17. 17 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.33 Plug a Non-CDB in to CDB Using DBMS_PDB Container Database CDB1 root Data files/ Temp files Redo Log files Control files PDB$SEED PDB2 Data files Create PDB2 from ORCL DBMS_PDB.DESCRIBE Plug XML metadata file 1. Open ORCL in READ ONLY mode. 2. 3. Connect to the target CDB1 CDB as a common user with CREATE PLUGGABLE DATABASE privilege. 4. Plug in the unplugged ORCL as PDB2. 5. Run the noncdb_to_pdb.sql script. 6. Open PDB2. SQL> CREATE PLUGGABLE DATABASE PDB2 USING '/tmp/ORCL.xml'; SQL> EXEC DBMS_PDB.DESCRIBE ('/tmp/ORCL.xml') SQL> CONNECT sys@PDB2 AS SYSDBA SQL> @$ORACLE_HOME/rdbms/admin/noncdb_to_pdb Data files / Tempfiles ORCL Datafiles Control files Redo Log files 12.1 SQL> ALTER PLUGGABLE DATABASE PDB2 OPEN; Copyright © 2014, Oracle and/or its affiliates. All rights reserved.34 Method 3: Clone Local PDBs Container Database CDB1 root Data files/ Temp files Redo Log files Control files PDB$SEED Data files / Temp files PDB1 Data files Create PDB3 from PDB1 1. Set the DB_CREATE_FILE_DEST or DB_FILE_NAME_CONVERT instance parameter or use the CREATE_FILE_DEST clause. 2. Connect to the root. 3. Quiesce PDB1: 4. Clone PDB3 from PDB1: 5. Open PDB3 in read-write mode. 6. Reopen PDB1. PDB3 Data files PDB3 owns: • SYSTEM, SYSAUX tablespaces • Full catalog • A temporary tablespace • SYS, SYSTEM common users • Same local administrator name • New service name SQL> ALTER PLUGGABLE DATABASE pdb1 CLOSE; SQL> ALTER PLUGGABLE DATABASE pdb1 OPEN READ ONLY; SQL> CREATE PLUGGABLE DATABASE pdb3 FROM pdb1; SQL> ALTER PLUGGABLE DATABASE pdb3 OPEN; 12.1.0.2
  • 18. 18 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.35 Method 4: Plug Unplugged PDB in to CDB Unplug PDB1 from CDB1: 1. Connect to CDB1 as a common user. 2. Verify that PDB1 is closed. 3. 4. Optionally, drop PDB1 from CDB1. Plug PDB1 in to CDB2: 1. Connect to CDB2 as a common user. 2. Use DBMS_PDB package to check the compatibility of PDB1 with CDB2. 3. 4. Open PDB1 in read-write mode. Container Database CDB1 root PDB$SEED PDB1 Data files XML file USERS Unplug PDB1 Container Database CDB2 root PDB$SEED PDB1 Data files Plug PDB1 SQL> ALTER PLUGGABLE DATABASE pdb1 UNPLUG INTO 'xmlfile1.xml'; SQL> CREATE PLUGGABLE DATABASE pdb1 USING 'xmlfile1.xml' NOCOPY; SYSAUX SYSTEM USERSSYSAUX SYSTEM Copyright © 2014, Oracle and/or its affiliates. All rights reserved.36 Method 4: Flow Are new PDB files based on same files that were used to create existing PDB in CDB? If not, AS CLONE clause is required and so, it ensures that Oracle Database generates unique PDB DBID, GUID, and other identifiers expected for the new PDB. XML file accurately describes current locations of files? Are files in correct location? Do you want to specify storage limits for PDB? If not, the SOURCE_FILE_NAME_CONVERT clause is required. If not, specify COPY to copy files to new location or MOVE to move them to another location. If yes, use NOCOPY. COPY as the default. If yes, specify the STORAGE clause. • FILE_NAME_CONVERT or CREATE_FILE_DEST clauses of CREATE PLUGGABLE DATABASE statement • Instances DB_CREATE_FILE_DEST or PDB_FILE_NAME_CONVERT parameters Several clauses can be used in conjunction:
  • 19. 19 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.37 Plug Sample Schemas PDB: Using DBCA 1 2 3 4 Plug a new PDB with Sample Schemas using a PDB File Set Copyright © 2014, Oracle and/or its affiliates. All rights reserved.38 Dropping a PDB Container Database CDB1 root Data files/ Temp files Redo Log files Control files File2 TEMP PDB$SEED Data files File5 File6 File7 File4 File1 File3 PDB1 Data files File8 Drop PDB1 • Updates control files • If INCLUDING DATAFILES: – Removes PDB1 datafiles • If KEEP DATAFILES (default): – Retain data files – Can be plugged in another or the same CDB • Requires SYSDBA privilege • Cannot drop seed PDB File9 File10 PDB4 Data files SQL> ALTER PLUGGABLE DATABASE pdb1 CLOSE; SQL> DROP PLUGGABLE DATABASE pdb1 [INCLUDING DATAFILES];… File7 File8 File9 File10 …
  • 20. 20 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.39 Migrating pre-12.1 Databases to 12.1 CDB There are two methods: 1. Upgrade an existing pre-12.1 database to 12c. 2. Plug-in non-CDB into a CDB. Or 1. Pre-create a PDB in CDB. 2. Use 11g expdp / 12c impdp or replication between non-CDB and PDB. CDB CDB1 root Data files/ Temp files Redo Log files Control files ORCL Data files Control files Redo Log files expdp Dump file PDB1 Data files impdp ORCL Data files Control files Redo Log files 1 2 11g 12c Replication XML file Copyright © 2014, Oracle and/or its affiliates. All rights reserved.40 MOUNT NOMOUNT SHUTDOWN Instance started – CDB control files opened for the instance – Root mounted – PDBs mounted – Root opened – PDBs still mounted, except seed in RO OPEN SQL> STARTUP SQL> ALTER DATABASE cdb1 OPEN; Or SQL> SELECT name,open_mode 2 FROM v$pdbs; NAME OPEN_MODE ---------------- ---------- PDB$SEED READ ONLY PDB1 MOUNTED PDB2 MOUNTED Opening a CDB
  • 21. 21 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.41 OPEN MOUNT NOMOUNT SHUTDOWN Instance started – CDB control files opened for the instance – Root mounted – PDBs mounted – Root opened – PDBs still mounted, except seed in RO PDB OPEN PDBs opened RW, except seed in RO SQL> CONNECT sys@CDB1 AS SYSDBA SQL> ALTER PLUGGABLE DATABASE pdb1 OPEN; SQL> ALTER PLUGGABLE DATABASE ALL OPEN; Or SQL> SELECT name,open_mode 2 FROM v$pdbs; NAME OPEN_MODE ---------------- ---------- PDB$SEED READ ONLY PDB1 READ WRITE PDB2 READ WRITE Opening a PDB Copyright © 2014, Oracle and/or its affiliates. All rights reserved.42 CDB OPEN MOUNT NOMOUNT SHUTDOWN Instance started – CDB control files opened for the instance – Root mounted – PDBs mounted – Root opened – PDBs mounted, except seed still RO PDB CLOSE PDBs closed SQL> CONNECT / AS SYSDBA SQL> ALTER PLUGGABLE DATABASE pdb1 CLOSE IMMEDIATE; SQL> ALTER PLUGGABLE DATABASE ALL EXCEPT pdb1 CLOSE; SQL> ALTER PLUGGABLE DATABASE ALL CLOSE; SQL> CONNECT sys@pdb1 AS SYSDBA SQL> ALTER PLUGGABLE DATABASE CLOSE; Or SQL> SHUTDOWN IMMEDIATE; Closing a PDB
  • 22. 22 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.43 SQL> CONNECT sys@CDB1 AS SYSDBA SQL> SHUTDOWN IMMEDIATE Shutting Down a CDB Instance • All PDBs closed (no new specific message) • CDB closed • CDB dismounted • Instance shut down • PDB closed SQL> CONNECT sys@PDB1 AS SYSDBA SQL> SHUTDOWN IMMEDIATE Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Exploring Oracle Database 12c Multitenant Best Practices for your Cloud Ami Aharonovich Oracle ACE & OCP Ami@Brillix.co.il