Top Banner
REMINDER Check in on the COLLABORATE mobile app PDB Cloning Using SQL Commands Prepared by: Leighton L. Nelson Lead Database Administrator World Wide Technology, Inc. Session ID#: 799 @leight0nn
30
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

REMINDER

Check in on the COLLABORATE mobile app

PDB Cloning Using SQL Commands

Prepared by:Leighton L. NelsonLead Database AdministratorWorld Wide Technology, Inc.

Session ID#: 799

@leight0nn

Page 2: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

About me

■ Oracle DBA■ Oracle ACE■ Speaker ■ Co-Author – Expert Oracle Enterprise Manager

Cloud Control 12c

http://blogs.griddba.com

linkedin.com

@leight0nn

Page 3: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Agenda

■ Oracle Multi-tenant Overview■ PDB Cloning Options■ PDB Cloning Methods■ PDB Cloning Using SQL■ DEMO

Page 4: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Oracle Multi-tenant Architecture

Page 5: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

PDB Cloning Options

■ From a PDB seed■ Cloning an existing PDB▪ Full local

▪ Snapshot local

▪ Remote Full

▪ Remote local

■ Clone non-CDB to PDB

Page 6: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

PDB Cloning Methods

■ Oracle Enterprise Manager 12c Cloud Control/OEM Express 12c

■ SQL Developer 3.x▪ http://www.thatjeffsmith.com/archive/2013/06/oracle-

database-12c-by-example-sql-developer-and-multitenant/

■ SQL*Plus▪ SQL> CREATE PLUGGABLE DATABASE…FROM

■ DBCA▪ dbca –createPluggableDatabase

■ Third-party tools▪ Delphix

Page 7: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

■ Source database should be in READ ONLY mode

▪ Downtime (Clone from Standby Database)

— Thanks Franck

■ Create PDB from Source

■ Create Thin Clone from Source

▪ CREATE PLUGGABLE DATABASE PDB2 FROM PDB1 SNAPSHOT COPY

▪ Near Instantaneous space efficient copies

▪ ACFS, ZFS, CLONEDB, Third party storage

Clone local PDB from source PDB

Page 8: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

■ CREATE PLUGGABLE DATABASE <CLONE> FROM <SOURCE>

▪ FILE_NAME_CONVERT

▪ CREATE_FILE_DEST

▪ DB_CREATE_FILE_DEST

▪ PDB_FILE_NAME_CONVERT

▪ STORAGE

▪ TEMP_FILE_REUSE

Clone local PDB from source PDB

Page 9: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

■ Other Options

■ EXCLUDE TABLESPACES

■ METADATA ONLY

Clone PDB from source PDB

Page 10: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

SQL> CREATE PLUGGABLE DATABASE SOECDB2 FROM SOE@CDB2TOCDB1

2 create_file_dest='/opt/oracle/oradata';

Pluggable database created.

SQL> alter pluggable database SOECDB2 open;

Warning: PDB altered with errors.

Clone PDB from remote source PDB

Page 11: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

SQL> select con_id,name,open_mode

2 from v$pdbs;

CON_ID NAME OPEN_MODE

---------- ------------------------------ ----------

2 PDB$SEED READ ONLY

3 SOECDB2 READ WRITE

Clone PDB from remote source PDB

Page 12: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

SQL> create pluggable database soepdb3 from CDB3@CDB2TOCDB3;

Pluggable database created.

SQL> @$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql

Clone PDB from remote source non-CDB

Page 13: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

SQL> alter pluggable database soepdb3 open;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME OPEN_MODE

------------------------------ ----------

SOEPDB3 READ WRITE

1 row selected.

Clone PDB from remote source non-CDB

Page 14: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

Clone PDB with NO DATA source PDB

Page 15: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

Clone PDB and exclude tablespace source

Page 16: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

Clone local PDB from source PDB

Page 17: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

Clone local PDB from source PDB

Page 18: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

Clone local PDB from source PDB

Page 19: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

Clone local PDB from source PDB

SQL> create pluggable database ORCL2 FROM ORCLFILE_NAME_CONVERT=('/home/oracle/app/oracle/oradata/cdb1/orcl','/home/oracle/app/oracle/oradata/cdb1/orcl2') ;

Pluggable database created.

Page 20: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

Clone local PDB from source PDB

SQL> create pluggable database ORCL2 FROM ORCLFILE_NAME_CONVERT=('/home/oracle/app/oracle/oradata/cdb1/orcl','/home/oracle/app/oracle/oradata/cdb1/orcl2') ;

Pluggable database created.

Page 21: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

Clone local PDB from source PDB

Page 22: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

Clone local PDB from source PDB

Page 23: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

Clone local PDB from source PDB

■ SQL> alter pluggable database orcl2 open; Pluggable database altered.

Page 24: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

Clone local PDB from source PDB

Page 25: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

Clone local PDB from source PDB

Page 26: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

Clone local PDB from source PDB using Snapshot Copy

SQL> create pluggable database SLOB4 from SLOB file_name_convert=('/acfs/oradata/ORCLCDB/SLOB','/acfs/oradata/ORCLCDB/SLOB4')

2 snapshot copy;

Pluggable database created.

SQL> alter pluggable database SLOB4 open;

Pluggable database altered.

Page 27: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Cloning using SQL Commands

Clone local PDB from source PDB using Snapshot Copy

SQL> host acfsutil snap info /acfs

snapshot name: 14347B97CF8B632BE053D7E0FF0ACB11

snapshot location: /acfs/.ACFS/snaps/14347B97CF8B632BE053D7E0FF0ACB11

RO snapshot or RW snapshot: RW

parent name: /acfs

snapshot creation time: Mon Apr 20 22:17:37 2015

number of snapshots: 1

snapshot space usage: 315527168 ( 300.91 MB )

Page 28: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

DEMO

Page 29: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

The End

Page 30: IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

Please complete the session evaluationWe appreciate your feedback and insight

You may complete the session evaluation either on paper or online via the mobile app