IOUG Collaborate 2015 - PDB Cloning Using SQL Commands

30
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

Transcript of 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

About me

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

Cloud Control 12c

http://blogs.griddba.com

linkedin.com

@leight0nn

Agenda

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

Oracle Multi-tenant Architecture

PDB Cloning Options

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

▪ Snapshot local

▪ Remote Full

▪ Remote local

■ Clone non-CDB to PDB

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

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

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

Cloning using SQL Commands

■ Other Options

■ EXCLUDE TABLESPACES

■ METADATA ONLY

Clone PDB from source PDB

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

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

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

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

Cloning using SQL Commands

Clone PDB with NO DATA source PDB

Cloning using SQL Commands

Clone PDB and exclude tablespace source

Cloning using SQL Commands

Clone local PDB from source PDB

Cloning using SQL Commands

Clone local PDB from source PDB

Cloning using SQL Commands

Clone local PDB from source PDB

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.

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.

Cloning using SQL Commands

Clone local PDB from source PDB

Cloning using SQL Commands

Clone local PDB from source PDB

Cloning using SQL Commands

Clone local PDB from source PDB

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

Cloning using SQL Commands

Clone local PDB from source PDB

Cloning using SQL Commands

Clone local PDB from source PDB

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.

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 )

DEMO

The End

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