Clone a PDB


lego

When you want to clone a PDB (in the same CDB) then there few simple steps to do.

  • Check your Database Parameters
  • Connect to your CDB
  • Stop the source PDB (hope this step will not be necessary in future releases)
  • Clone the PDB
  • Open the PDB

Step 1: Check your Database Parameters

We want to do a simple clone. So check DB_CREATE_FILE_DEST or PDB_FILE_NAME_CONVERT for correct setting.

SQL> show parameter db_create_file_dest

NAME                     TYPE     VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest             string     /u01/app/oracle/oradata
SQL> show parameter pdb

NAME                     TYPE     VALUE
------------------------------------ ----------- ------------------------------
pdb_file_name_convert             string

Step 2: Connect to your CDB

Very simple

[oracle@# admin]$ . oraenv
ORACLE_SID = [CDB1] ? CDB1
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@vmsvrocm01 admin]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Sat Jul 13 16:41:57 2013

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing option

Step 3: Stop the source PDB

SQL>  ALTER PLUGGABLE DATABASE PDB_db1211 OPEN READ ONLY;

Pluggable database altered.

Step 4: Clone the PDB

SQL> CREATE PLUGGABLE DATABASE PDB_clone FROM PDB_db1211;

Pluggable database created.

Step 5: Open the PDB

SQL> ALTER PLUGGABLE DATABASE PDB_clone open;

Pluggable database altered.

The new Database is ready for use. After the creating the clone the source PDB is automaticly started so if you try to start it then you will get a error.

SQL> ALTER PLUGGABLE DATABASE PDB_db1211 open;
ALTER PLUGGABLE DATABASE PDB_db1211 open
*
ERROR at line 1:
ORA-65019: pluggable database PDB_DB1211 already open

Be carefull if you clone a PDB where a datafile is Offline. There will no error during clone but the datafile is left in a recover state.

NAME                                                     STATUS
---------------------------------------------------------------------------------------------------- -------
/u01/app/oracle/oradata/CDB1/undotbs01.dbf                                                           ONLINE
/u01/app/oracle/oradata/CDB1/E166AB5F5E7C2755E0436919A8C1B546/datafile/o1_mf_system_8y2sz2w9_.dbf    SYSTEM
/u01/app/oracle/oradata/CDB1/E166AB5F5E7C2755E0436919A8C1B546/datafile/o1_mf_sysaux_8y2sz2ow_.dbf    ONLINE
/u01/app/oracle/oradata/CDB1/E166AB5F5E7C2755E0436919A8C1B546/datafile/o1_mf_users_8y2sz2vw_.dbf     ONLINE
/u01/app/oracle/oradata/CDB1/E166AB5F5E7C2755E0436919A8C1B546/datafile/o1_mf_example_8y2sz2py_.dbf   ONLINE
/u01/app/oracle/product/12.1.0/dbhome_1/dbs/MISSING00019                                             RECOVER
Advertisements

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s