Create Snapshot Copy Clone


Overview

Create a pluggable databases using the CLONEDB feature.

Reference

Procedure

Overview

The procedure to follow is in “ Create a PDB by cloning an existing PDB or non-CDB ”.

A version of the full script can be found here on GitHub.

Conflict in Documentation

The Reference Manual says:

CLONEDB should be set on Direct NFS Client CloneDB databases. When this parameter is set, the CloneDB database uses the database backup as the backing store for the datafiles.

Emphasis Mine

However, the DBA Guide says:

When you use the SNAPSHOT COPY clause to create a clone of a source PDB and the CLONEDB initialization parameter is set to TRUE , the underlying file system for the source PDB's files can be any local file system , network file system (NFS), or clustered file system that has Direct NFS enabled. However, the source PDB must remain in open read-only mode as long as any clones exist.

Emphasis Mine

Set System Parameter

In order to use the SNAPSHOT COPY method of PDB cloning, the CLONEDB system parameter must be set to TRUE . This is not a dynamic parameter. The container instance has to be in TRUE state for this parameter to be changed. This is done through the following SQL*Plus commands:

connect / as sysdba
startup nomount
alter system set clonedb=true scope=spfile;
startup force

Make Source PDB Read Only

While any clones exist, the source PDB has to be in READ ONLY mode. In this example, I am using the VEGEMITE PDB as the source PDB. I put this PDB in READ ONLY mode as follows:

connect / as sysdba
alter pluggable database vegemite close;
alter pluggable database vegemite open read only;

Create Snapshot Clone

Now that the source PDB (VEGEMITE) is open in READ ONLY mode, I can create the clone PDB (VEGEMITER) as follows:

connect / as sysdba
create pluggable database vegemiter from vegemite snapshot copy;
alter pluggable database vegemiter open read write;

Save PDB States

To ensure the proper open states are kept across startups, I used the following commands:

connect / as sysdba
alter pluggable database vegemite save state;
alter pluggable database vegemiter save state;