Sunteți pe pagina 1din 30

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

The following is intended to outline our general product


direction. It is intended for information purposes only, and
may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality,
and should not be relied upon in making purchasing
decisions. The development, release, and timing of any
features or functionality described for Oracle's products
remains at the sole discretion of Oracle.

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


Provisioning Multitenant
Databases
Agenda

• Creating CDBs
• Creating PDBs
• Cloning PDBs
• Plugging/Unplugging PDBs
• Cloning with Snapshot Clones
• Migrating to a CDB from Non-CDB

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


Agenda

• Creating CDBs
• Creating PDBs
• Cloning PDBs
• Plugging/Unplugging PDBs
• Cloning with Snapshot Clones
• Migrating to a CDB from Non-CDB

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


Creating a Container Database
• CDB is consolidation platform for potentially diverse PDBs
– Needs to have all options – binary and dictionary – available
• The CDB creation procedure is similar to non-CDB
– You may create a CDB either during or after Database software installation
• The methods for creating a CDB are:
– DBCA (recommended)
– CREATE DATABASE SQL statement & catcdb.sql
• Don’t attempt to hack catcdb.sql to install subset of options

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


Creating a Container Database
• In PDB you don’t need all options
– PDB created from seed will have all options
– Don’t hack seed!
– Can create PDB, de-install options, use this as clone master

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


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

• Creating CDBs
• Creating PDBs
• Cloning PDBs
• Plugging/Unplugging PDBs
• Cloning with Snapshot Clones
• Migrating to a CDB from Non-CDB

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


PDB Creation Methods

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


Creating a PDB from the SEED
• Use the CREATE PLUGGABLE DATABASE statement to create a new
PDB by using the files of the seed
– The statement copies these files to a new location and associates them with
the new PDB
• Specify an administrator for the PDB using ADMIN USER clause
– Creates the administrator as a local user and grants the PDB_DBA role locally
• After the PDB gets created, it is in mounted mode, and its status is NEW
– It must be opened in READ WRITE mode to complete the integration
• A service with the same name as the PDB gets created

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


Creating a PDB from the SEED
• You may use the following CREATE PLUGGABLE DATABASE statement
clauses:
• STORAGE: To limit the total PBD storage
• DEFAULT TABLESPACE: Default permanent tablespace for the PDB
• FILE_NAME_CONVERT: To convert the destination file locations

CREATE PLUGGABLE DATABASE salespdb ADMIN USER salesadm IDENTIFIED BY


password
STORAGE (MAXSIZE 2G MAX_SHARED_TEMP_SIZE 100M)
DEFAULT TABLESPACE sales
DATAFILE '/disk1/oracle/dbs/salespdb/sales01.dbf' SIZE 250M AUTOEXTEND ON
FILE_NAME_CONVERT = ('/disk1/oracle/dbs/pdbseed/', '/disk1/oracle/dbs/salespdb/');

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


Agenda

• Creating CDBs
• Creating PDBs
• Cloning PDBs
• Plugging/Unplugging PDBs
• Cloning with Snapshot Clones
• Migrating to a CDB from Non-CDB

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


Multitenant Cloning with Full Copy
Efficient, simple & reliable process
• Orchestration entirely from SQL
– DBA skills only
– No o/s access required
• Parallel Execution Servers
– Fast and efficient
• Clones have unique GUIDs
• Source PDB must be open read only

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


Cloning of a Pluggable Database

• Fast cloning of a PDB


PDB$
PDB1 PDB2
– Local: SEED

create pluggable database


PDB2 from PDB1; CDB1
– Remote:
create pluggable database
PDB1 from PDB1@CDB1;
PDB$
• Planned for a future patch set or release PDB1
SEED

CDB2

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


Creating a PDB by Cloning
• Use the CREATE PLUGGABLE DATABASE statement to clone a PDB
– The statement copies the files associated with the source PDB to a new
location and associates the files with the target PDB
• A source PDB gets cloned and plugged into the CDB
• Include a FROM clause that specifies the source PDB
• The source PDB can be in the local CDB or in a remote CDB
– Specify a database link to the remote CDB in the FROM clause

create pluggable database HCMBI from HCM

create pluggable database HCMBI from HCM@ORCL;

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


Agenda

• Creating CDBs
• Creating PDBs
• Cloning PDBs
• Plugging/Unplugging PDBs
• Cloning with Snapshot Clones
• Migrating to a CDB from Non-CDB

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


Unplug / plug
Simply unplug from the old CDB…

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


Unplug / plug
…and plug in to the new CDB…

• Moving between CDBs is a simple case


of moving a PDB’s metadata
• An unplugged PDB carries with it lineage,
opatch, encryption key info etc

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


Unplug / plug
Example
Unplug
alter pluggable database HCM
unplug into '/u01/app/oracle/oradata/…/hcm.xml'

Plug
create pluggable database My_PDB
using '/u01/app/oracle/oradata/…/hcm.xml'

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


Agenda

• Creating CDBs
• Creating PDBs
• Cloning PDBs
• Plugging/Unplugging PDBs
• Cloning with Snapshot Clones
• Migrating to a CDB from Non-CDB

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


Multitenant Cloning with Snapshot Copy
Thin provisioning of database clones in seconds

create pluggable database DEV44


from CRM_MASTER snapshot copy

• Still SQL with new “as snapshot” clause


• Where not supported receive error
ORA-17517: Database cloning using storage snapshot failed
• Built on copy-on-write capability of underlying file system
• Storage admin’s credentials stored in secure wallet once per CDB
• No subsequent requirement for intervention of storage administrator

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


Traditional File System
Full copy duplicates all data blocks
my_file

 File is collection of data blocks


my_file_copy
 And headers
 Copy duplicates header & data blocks
 Effective & simple, but expensive!

cp my_file my_file_copy

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


Copy-on-Write Basics
Much more efficient storage of substantially similar files
my_file

 File is collection of data blocks


 And headers
 Copy file requires only copy of header
 Much more efficient storage
 Minimal IO to create copy

my_file_copy

cp my_file my_file_copy

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


Copy-on-Write Basics
Much more efficient storage of substantially similar files
my_file

 File is collection of data blocks


 And headers
 Copy file requires only copy of header
 Much more efficient storage
 Minimal IO to create copy
 Copy block only when change needed
my_file_copy

cp my_file my_file_copy

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


Agenda

• Creating CDBs
• Creating PDBs
• Cloning PDBs
• Plugging/Unplugging PDBs
• Cloning with Snapshot Clones
• Migrating to a CDB from Non-CDB

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


Migrating to Oracle Multitenant
How Do I Migrate a 11g & 12c Non-CDB to a CDB?
Non-CDBs
Non-CDBs of version 11.2.0.4 or earlier.
01001011001001001 Ideal for direct migration of departmental databases
11g Data
00101110010010101
00100101010100110
Pump Downtime is a function of the number of database objects
TTS
10100101010010010
0
CDB
Upgrade
01001011001001001
12c 00101110010010101
GoldenGate
00100101010100110
Least downtime
Heterogeneous platforms
11g 10100101010010010
0

PDBs
01001011001001001
00101110010010101
12c Plug
00100101010100110 as a PDB
10100101010010010 Non-CDBs of version DB 12.1 or later.
0 Faster than Data Pump, simpler than GoldenGate

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


Upgrade and Plugin as PDB

• Database upgrade
PDB$
PDB1
• Start database read-only SEED

• Create XML description file


exec DBMS_PDB.DESCRIBE('PDB1.xml'); CDB
• Shutdown database
PDB1
• Plugin database
xml
create pluggable database PDB1
using ('PDB1.xml') nocopy tempfile reuse;
DB1
• Sanity operations
start ?/rdbms/admin/noncdb_to_pdb.sql

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


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