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
: InstructsgDBClone
to 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, thesnap
option instructsgDBClone
to 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_name
of the source CDB being cloned. -
-tdbname target_db_name
: Specifies thedb_unique_name
to use for the new thinly provisioned target CDB. -
-tdbhome target_db_home
: Optionally specifies theORACLE_HOME
location 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 thegDBClone
reference (Oracle Support Document 2099214.1) for the list of supported parameters. You can use this option as an alternative to specifying-sga_max_size
and-sga_target
on 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 thegDBClone
default 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 usinggDBClone
with thesyspwf
option.If this option is not specified,
gDBClone
checks the default location (/opt/gDBClone/SYSpasswd_file
) for a usable password file, and if that is not successful,gDBClone
prompts 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
SOURCE
CDB was previously copied into an Exascale vault, and theTHIN
CDB resides in the same vault. -
The
SOURCE
CDB is an Oracle RAC database and theTHIN
CDB is also configured as an Oracle RAC database. -
Both CDBs share the same Oracle binaries and the
THIN
CDB inherits Oracle Database parameter settings from theSOURCE
CDB. -
The
gDBClone
utility looks for an encrypted file containing theSOURCE
CDB SYS user password at/opt/gDBClone/SYSpasswd_file
. If the file doesn't exist or doesn't contain the required password,gDBClone
prompts for the password at runtime. -
The
SOURCE
CDB 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