Oracle Database 12.1.0.2c : Hot Cloning of Non-Container Databases

In the initial release of Oracle 12c (12.1.0.1c), a non-Container Database (non-CDB) could be converted to a pluggable database (PDB) using any of the following methods: Using DBMS_PDB Using datapump (expdb, impdp) Using GoldenGate replication The 12.1.0.2 patchset has introduced the ability to clone a remote non-CDB as a PDB directly over the network. Remote Cloning of a Non-CDB is a

In the initial release of Oracle 12c (12.1.0.1c), a non-Container Database (non-CDB) could be converted to a pluggable database (PDB) using any of the following methods:

  • Using DBMS_PDB
  • Using datapump (expdb, impdp)
  • Using GoldenGate replication

The 12.1.0.2 patchset has introduced the ability to clone a remote non-CDB as a PDB directly over the network. Remote Cloning of a Non-CDB is a simple procedure which utilizes a database link to transfer the data as part of running the CREATE PLUGGABLE DATABASE command. Moreover, non-CDBs can be hot cloned, i.e. it is not required to put the source non-CDB in READ ONLY mode for cloning so that it can be cloned online. It is a pre-requisite that both the CDB and the non-CDB must be running Oracle Database 12c Release 1 (12.1.0.2) or later.

In this article, I will demonstrate hot cloning of a remote non-container ASM database (non-CDB) to create a new pluggable database (PDB) with file system storage in Oracle Database 12.1.0.2c. For the purpose of this demonstration, I have two virtual machines, host01 and host02. We will clone the non-cdb orcl on host host01 to PDB orclclone in the CDB destcdb on remote host host02.

Source:
Host : host01
Non-CDB : orcl having ASM storage

Destination:
Host : host02
Container Database : destcdb
Pluggable database : orclclone having file system storage

Demonstration

Let’s confirm that our source database orcl is a Non-CDB:

We need to make sure that both the source non-CDB orcl and the destination CDB destcdb are running Oracle Database 12c Release 1 (12.1.0.2) or later.

On the target container database destcdb, we need to create a database link to connect to source non-CDB orcl which will be used in the CREATE PLUGGABLE DATABASE statement:

Verify that target container database destcdb currently has two PDB’s – PDB$SEED and PDB1:

Let’s execute the CREATE PLUGGABLE DATABASE statement using the previously-defined database link (orcl_link) to create target PDB orclclone in CDB destcdb.

In order to specify FILE_NAME_CONVERT, let’s find out the location of database files for source non-CDB orcl on host01:

Since source database files are on ASM and hence use OMF, we will have to employ OMF for the destination PDB also by specifying CREATE_FILE_DEST clause in CREATE PLUGGABLE DATABASE statement in addition to the database link (orcl_link):

Note that when the source database is a non-CDB, we can substitute NON$CDB for the name of the non-CDB. For example, the following statement is equivalent to the above statement:

Verify that the new pluggable database orclclone is created in MOUNTED state and its status is NEW:

DESTCDB>sho pdbs

Verify that OMF data files of orclclone have been created on host02 in the location specified using FILE_NAME_CONVERT.

Prior to opening the PDB for the first time, we need to log in to the destination PDB orclclone as SYS user and run the script $ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql in order to modify some metadata and convert the Non-CDB to PDB. The script opens the PDB, performs changes, and closes the PDB when the changes are complete.

We will now open the new PDB orclclone in READ WRITE mode to complete the integration of the new PDB into the CDB. After the PDB is opened in READ WRITE mode, its status changes from NEW to NORMAL.

Let’s check the user data in the new PDB:

Hence, we have been able to hot clone a non-CDB remotely and during this process:

  • The source non-CDB remained in READ WRITE mode
  • Data files were migrated from ASM to non-ASM

Although the process is quite simple, it may not be feasible for large databases or situations involving slow or unreliable network links since it depends on transporting the data over a database link. Hence, you must consider the size of your source database and the speed of your internet connection in order to decide if it is a feasible migration approach in your case.

Summary:

  • The 12.1.0.2 patchset introduces the ability to create a PDB as a clone of a remote non-CDB over a database link.
  • Non-CDB’s can be hot cloned i.e. the source non-CDB need not be put in READ ONLY mode for cloning.
  • Remote cloning of non-CDB may not be feasible for large databases or situations involving slow or unreliable network links.