4.7.4 Cloning a Container Database
Oracle Database contains integrated snapshot and cloning functionality
for Oracle multitenant pluggable databases (PDBs), which is primarily available
through the CREATE PLUGGABLE DATABASE and ALTER PLUGGABLE
DATABASE SQL commands. When Oracle Database uses Exascale storage, the PDB snapshot and
snapshot copy (cloning) functions automatically use native Exascale snapshots and clones to create
space-efficient copies of the required files.
However, cloning an entire container database (CDB) requires more than just cloning the database files. The clone requires a unique database name and separate configuration settings for the database instances, requiring coordination of various operations apart from the original database.
To facilitate efficient CDB cloning, Oracle provides a generic database
cloning utility called gDBClone. Historically,
gDBClone provides support for various methods of CDB
duplication. With the introduction of Exascale, the gDBClone utility is enhanced to facilitate
efficient CDB cloning in conjunction with Exascale storage.
Creating a CDB clone using the gDBClone utility and Exascale storage is:
-
Easy. The utility requires only a few inputs.
-
Reliable. The entire procedure is automated, reducing the risk of errors.
-
Flexible. Using
gDBClone, you can clone:-
Single-instance and Oracle RAC databases.
-
Unencrypted databases and databases using Oracle Transparent Data Encryption (TDE).
-
Stand-alone databases, Oracle Data Guard primary databases, and Oracle Data Guard standby databases.
-
To use the gDBClone utility, you must first ensure that the source
CDB is running in ARCHIVELOG mode.
Then, to create a CDB clone on Exascale storage, use the gDBClone utility with the
following syntax and options:
# /opt/gDBClone/gDBClone.bin { clone | snap } -sdbname source-db-name -tdbname target-db-name
[ -tdbhome target-db-home ]
[[[ -sga_max_size size-MB ] [ -sga_target size-MB ]] | -pfile file-name ]
[ -sdbport source-listener-port ]
[ -racmod { 0 | 1 | 2 }]
[ -syspwf sys-password-file ]
[ -walletpwf wallet-password-file ]
In the command:
-
clone: InstructsgDBCloneto create a CDB clone using a complete (not thinly provisioned) database copy. This option is recommended for copying a database into Exascale storage from elsewhere. -
snap: After the source database resides in an Exascale vault, thesnapoption instructsgDBCloneto create a thinly provisioned space-efficient CDB clone in the same Exascale vault.Using this option, Exascale uses redirect-on-write techniques to efficiently create and maintain data file clones using minimal storage space. As a result, you can clone an entire CDB in minutes, with the underlying Exascale file cloning operation occurring instantaneously, regardless of the source database size.
-
-sdbname source-db-name: Specifies thedb_unique_nameof the source CDB being cloned. -
-tdbname target-db-name: Specifies thedb_unique_nameto use for the new thinly provisioned target CDB. -
-tdbhome target-db-home: Optionally specifies theORACLE_HOMElocation for the target CDB. If not specified, the target CDB automatically uses the same Oracle Database binaries as the source CDB. -
-sga_max_size size-MB: Optionally specifies the maximum size (in megabytes) of the target database system global area (SGA). If not specified, the target CDB automatically uses the same size as the source database. -
-sga_target size-MB: Optionally specifies the nominal total size (in megabytes) of the target database system global area (SGA). If not specified, the target CDB automatically uses the same size as the source database. -
-pfile file-name: Optionally specifies a file that contains one or more supported parameter settings for use by the target database. See thegDBClonereference (Oracle Support Document 2099214.1) for the list of supported parameters. You can use this option as an alternative to specifying-sga_max_sizeand-sga_targeton the command line. -
-sdbport source-listener-port: Optionally specifies the Oracle Net listener port number for the source CDB. If not specified, the default value is 1521. -
-racmod { 0 | 1 | 2 }: Optionally specifies the target CDB configuration using one of the following values:-
0- Single instance. This is thegDBClonedefault value. -
1- Oracle RAC One Node. -
2- Oracle RAC. This is the typical setting for databases on Oracle Exadata Exascale.
-
-
-syspwf sys-password-file: Optionally specifies a file containing an encrypted version of the source database SYS user password, previously created usinggDBClonewith thesyspwfoption.If this option is not specified,
gDBClonechecks the default location (/opt/gDBClone/SYSpasswd_file) for a usable password file, and if that is not successful,gDBCloneprompts to supply the password during command execution. -
-walletpwf wallet-password-file: Optionally specifies a file containing an encrypted version of the source database keystore (wallet) password. This option must be specified if the source database uses Oracle Transparent Data Encryption (TDE).
For example, the following command shows the simple case of thin cloning
the SOURCE CDB to create the THIN CDB.
# /opt/gDBClone/gDBClone.bin snap -sdbname SOURCE -tdbname THIN -racmod 2
In the previous example:
-
The
SOURCECDB was previously copied into an Exascale vault, and theTHINCDB resides in the same vault. -
The
SOURCECDB is an Oracle RAC database and theTHINCDB is also configured as an Oracle RAC database. -
Both CDBs share the same Oracle binaries and the
THINCDB inherits Oracle Database parameter settings from theSOURCECDB. -
The
gDBCloneutility looks for an encrypted file containing theSOURCECDB SYS user password at/opt/gDBClone/SYSpasswd_file. If the file doesn't exist or doesn't contain the required password,gDBCloneprompts for the password at runtime. -
The
SOURCECDB is not encrypted using Oracle Transparent Data Encryption (TDE). If the source database contains TDE-encrypted tablespaces, then additional steps are required to configure the TDE keystore (wallet) before creation of the CDB thin clone.
The gDBClone utility provides many additional functions.
For example, you can view the databases created with gDBClone and
display the relationships between them by running:
# /opt/gDBClone/gDBClone.bin listdbs -tree
You can also remove a database quickly and easily by using the deldb
option. For example:
# /opt/gDBClone/gDBClone.bin deldb -tdbname THIN
For a complete list of functions and further details, see the
gDBClone reference at Oracle Support Document
2099214.1.
Parent topic: Using Oracle Database with Exascale Snapshots and Clones