14 Cloning Oracle Databases and Pluggable Databases

Enterprise Manager Cloud Control enables you to clone databases using the Full Clone method, or by using the classic cloning wizard which enables you clone databases using RMAN backup, staging areas, or an existing backup.

This chapter outlines the following procedures which you can use to create a database clone. For other advanced cloning methods, see Enterprise Manager Cloud Administration Guide.

Creating a Full Clone Database

To create a Full Clone database, you can use either of the following solutions:

Creating a Full Clone Database Using the Clone Wizard

To create a full clone database, follow these steps:

  1. On the Databases page, you can access the Full Clone database wizard by following any one method:
    • Select the database that you want to clone from the list of the databases displayed. On the Database home page, click the Database menu, select Cloning, and then select Create Full Clone.
    • Right click on the database target name, select Database, select Cloning, and then select Create Full Clone.
    • Right click on the database target name, select Database, select Cloning, and then select Clone Management. On the Clone Management page, in the Full Clone Databases box, click Create.
  2. On the Create Full Clone Database: Source and Destination page, do the following:
    • In the Source section, launch the credentials selector by selecting the search icons for SYSDBA Database and Database Host credentials. Click OK. If the source database is Transparent Data Encryption (TDE) enabled, then enter the wallet password.
    • In the Data Time Series section, select Now or Prior Point in Time. If you selected Now, specify or search and select the SYSASM ASM Credentials. Now refers to Live Clone.

      Note:

      • Live clone (RMAN duplicate) is supported only if the source is in ARCHIVELOG mode.
      • For a Container database only Now option (live clone) in data-time series is supported.
      If you selected Prior Point in Time, a carousel of RMAN Backup images appear. Select the appropriate RMAN backup by clicking Select on the image. You can create full clones by selecting a backup and optionally modify the time and SCN to do a point in time restore. The Select Time option has the minimum limit set to the current backups time and maximum time limit set to the next backup time. You can modify this in case you have to create a new clone between these two time periods. Similarly, you can do the same for SCN by selecting the Select SCN option.
  3. In the Destination Database Definition section, do the following:
    • Specify a display name.
    • Specify a Global Database Name and SID: A database is uniquely identified by a Global Database Name. The typical form of a name is name.domain. A database is referenced by at least one Oracle instance which is uniquely identified by SID.
    • Select one of the following types of databases:
      • Single Instance Database: In the Hosts section, specify the Oracle Home location. The host gets specified by default. Next, select the Database Home credentials and the SYSASM ASM credentials.
      • RAC Database: In the Hosts section, specify or select the cluster target. The Oracle Home location gets specified by default. Next, specify the Database Host credentials, and the SYSASM ASM credentials. In the Nodes section, select the cluster and Oracle Home to display one or more hosts on which the administrator managed Oracle RAC database will be created.
      • RAC One Node Database: In the Hosts section, specify or select the cluster target. The Oracle Home location gets specified by default. Next, specify the Database Host credentials, and the SYSASM ASM credentials. In the Nodes section, select the cluster and Oracle Home to display one or more hosts on which the administrator managed Oracle RAC database will be created.

        Note:

        Oracle supports inline patching as part of clones. When the destination home selected has patches applied such as the latest CPU or PSU, then the cloned database is automatically brought up with that level.
      Click Next.
  4. On the Create Full Clone Database: Configuration page, do the following:
    • In the Database Files Location, specify the location where you want the data files, temp files, redo log files, and control files to be created. You can select File System or Automatic Storage Management (ASM), and then specify the common location for the database files.

      The Use Oracle Optimal Flexible Architecture-compliant directory structure (OFA) option enables you to configure different locations for:

      • Archive and Redo logs
      • Data files
      • Control file
      • Temporary file
    • In the Recovery Files location, specify the location where you want the recovery files, such as archived redo logs, RMAN backups, and other related files to be created. You can choose to use the fast area recovery by selecting Use Fast Recovery Area. If you do, specify the fast recovery area size. The fast recovery area size is defaulted to that of source.
    • In the Listener Configuration section, select the listener targets running under the new Oracle Home, to register the clone database.
    • In the Database Credentials section, specify passwords for the SYS, SYSTEM, and DBSNMP administrative users in the clone database. You can choose to have the same password for all the three users or a different password for each.
    • If the source database is TDE enabled, then indicate if the wallet password should be the same for the cloned database by selecting the Use same wallet password as source check box and specifying the password.

      If the source database is not TDE enabled, then you can opt to configure wallet at destination by selecting the corresponding check box and specifying a password.

    • In the Parallelism section, enter the number of parallel channels used by Recovery Manager (RMAN) to copy the database files in the Degree of Parallelism text box.

      Degree of parallelism is the number of parallel channels used by Recovery Manager (RMAN) to copy the database files. It is calculated as the CPU count of the host. Increased parallelism may speed the process if sufficient system resources are available.

    Click Next.
  5. On the Create Full Clone Database: Initialization Parameters page, you can configure the values of various initialization parameters that affect the operation of the database instance. Select the parameter and click Edit to modify the value of the parameter.
    Click Next.
  6. On the Create Full Clone Database: Post Processing page, specify the following:
    • Masking Definition: Data masking is the process of masking sensitive data in test or non-production databases. The masking definition defines the columns to be masked in the format of the masked data. Specify the masking definition to be applied after the database is cloned.

      Note:

      The masking definition can be used only when you have a Subset-Masking license pack.

    • Custom Scripts: Specify the custom scripts that need to be executed before and after the database is created.

      For more information on how to store and use custom scripts in the Software Library, see Using Custom Scripts Stored in the Software Library in Oracle Enterprise Manager Middleware Lifecycle Management Administrator's Guide.

      You can view sample scripts in the Database as a Service/Samples/Pre or Post Database Script folder in the Software Library.

    • Create Data Profile: This option enables you to automatically take a backup of the new cloned instance once it is created. When the clone or the Test Master is refreshed, this section displays the existing profiles created for the database. You can select the profile that has to be refreshed along with the database.
    • Create as Test Master: This option if you want to create the cloned database as a Test Master database.
    Click Next.
  7. On the Create Full Clone Database: Schedule page, specify a unique deployment procedure instance name. You can choose to start the deployment procedure immediately or at a later time,
    In the Notification Details section, you can choose to set the following notifications:
    • Scheduled
    • Running
    • Action Required
    • Suspended
    • Succeeded
    • Problems
    Click Next.
  8. On the Create Full Clone Database: Review page, verify the details of the source database, the data source of the clone, and the destination database.
    Click Submit.

Creating a Full Clone Database Using EM CLI

Database Cloning Using EM CLI

To create a full clone of a database you will need to execute the db_clone_management verb. See the following verb sample with parameters:
emcli db_clone_management 
-createFullClone 
-target_name="<DB_target_name>" 
-target_type="<oracle_database/rac_database>" 
-clone_type="<LIVE/POINT_IN_TIME>"
-input_file="<Input_file_path>"
Furthermore you can view the different parameters that need to be included in an input file for a live clone, or a point in time clone; and also the different parameters needed when cloning a Single Instance Database or a RAC Database Clone. To view this information you will need to run the db_clone_management with the -print_properties flag:
emcli db_clone_management 
-createFullClone 
-target_name="<DB_target_name>" 
-target_type="<oracle_database/rac_database>" 
-clone_type="<LIVE/POINT_IN_TIME>"
-print_properties

Note:

If the source database is TDE enabled, then you must also specify the SRC_WALLET_PWD and DEST_WALLET_PWD properties.

Database Cloning Using Pre and Post Scripts

The following is a list of accepted Deployment Procedure Variables that can be incorporated into Pre and Post scripts for Database cloning workflows. For more information on Pre and Post scripts see: Custom Pre and Post Scripts for Fleet Operations
Variable Name Description
SRC_DB_TARGET_NAME Source database target name
SRC_DB_TARGET_TYPE Source database target type
COMMON_GLOBAL_DB_NAME Global database name of clone
COMMON_DB_SID Clone database SID
DB_TARGET_NAME Name of the clone database target
DB_TARGET_DISPLAY_NAME Display name of the clone database target
DATABASE_TYPE Name of the clone database.

Values: dbTypeSI or dbTypeRAC

TARGET_HOST_LIST Destination host name
ORACLE_HOME_LOC Destination Oracle Home location
ORACLE_BASE_LOC Destination Oracle Base location
DB_STORAGE_TYPE Destination storage type.

Values: FS or ASM

DB_FILE_LOC Destination database files storage location
FLASH_REC_AREA Location at destination where recovery related files will be created
FLASH_REC_AREA_SIZE Fast Recovery area size
ARCHIVE_LOG_MODE Indicates if the clone database is in ARCHIVELOG mode
LISTENER_PORT Listener port with which the clone database is configured
DB_TEMPLATE_STAGE Temporary work directory at the destination
ENABLE_DATA_MASK Indicates if data masking definition is applied on clone database

Sample Variables:

COMMON_GLOBAL_DB_NAME=CLONEDB
COMMON_DB_SID=CLONEDB
DATABASE_TYPE=dbTypeSI
DB_STORAGE_TYPE=FS
DB_FILE_LOC=/scratch/app/oradata
FLASH_REC_AREA=/scratch/user/app/fra
FLASH_REC_AREA_SIZE=3780
ARCHIVE_LOG_MODE=YES
LISTENER_PORT=<Port number>
DB_TEMPLATE_STAGE=/tmp
SRC_DB_TARGET_NAME=xyz.example.com
SRC_DB_TARGET_TYPE=oracle_database
ORACLE_BASE_LOC=/scratch/app/base
ORACLE_HOME_LOC=/scratch/app/product/<DB Version>/dbhome_1
ORACLE_HOME_NAME=OraDBHome_Example
DB_TARGET_NAME=clonedb.xyz.example.com
TARGET_HOST_LIST=desthost.example.com
CONFIGURE_WITH_ORACLE_RESTART=<Y/N>
FRA_STORAGE_TYPE=FS
DEGREE_OF_PARALLELISM=8
ENABLE_DATA_MASK=<True/False>
DB_TARGET_DISPLAY_NAME=SAMPLE_CloneDB

Verify Status of a Database Clone

To verify the status of the database clone creation, execute the verb emcli get_instance_status -instance={instance GUID}.

Refresh a Cloned Database

If you are managing a PDB on OCI resources make sure that all OCI required prerequistes and discovery have been performed. For more information, see: Deploying Agents on OCI Resources.

Once the Enterprise Manager Plugins are deployed, the ‘Refresh’ option is enabled. To deploy the plugins perform the following steps:
  1. Go to Setup and select Extensibility, and then click Plugins.
  2. From Servers, Storage and Network menu, deploy the Oracle Virtualization plugin on the Management Server and Management Agents.
  3. From the Cloud menu, deploy the Oracle Cloud Application plugin on the Management Server.
When these plugins are successfully deployed you can refresh a cloned database by performing the following steps:
  1. Navigate to Oracle Database and click Cloning.
  2. Click Cloning Management, and then select a cloned database from the list.
  3. Click Refresh.

Cloning Databases Using the Classic Cloning Wizard

You can clone databases using the older cloning wizard. This section consists of the following:

Overview of Classic Cloning Methods

You can use the Enterprise Manager Clone Database wizard to clone an Oracle database instance to an existing Oracle home. After you have an Oracle database instance in a known state (for example, you've configured it, tuned it, and tested it), you may want to clone that database to another existing Oracle home.

The following table lists the cloning methods and their cloning process:

Table 14-1 Oracle Database Cloning Methods

Cloning Method Cloning Process

Cloning an Oracle Database Using Recovery Manager (RMAN) Backup

  • Connects source and destination Oracle instances

  • Copies database files using RMAN duplicate feature

  • Recovers and opens the cloned database

Cloning an Oracle Database Using Staging Areas

  • Backs up each database file and stores it in a staging area

  • Transfers each backup file from source to destination

  • Restores each backup file to the specified locations

  • Recovers and opens the cloned database

Cloning an Oracle Database Using an Existing Backup

  • Creates cloned database as of specified point-in-time or SCN

  • Validates backups prior to the clone operation

  • Transfers required archived redo log files to destination host

  • Recovers and opens the cloned database

Cloning an Oracle Database Using Recovery Manager (RMAN) Backup

To clone an Oracle database using RMAN backup, follow these steps:

  1. From the Targets menu, select Databases.
  2. On the Databases page, select a database that you want to clone.
  3. On the Database target page, from the Oracle Database menu, select Cloning and then click Clone Management.
  4. On the Clone and Refresh page, click the Switch to Classic Clone link.
  5. On the Database Login page, enter your credentials. Click Login.

    The Clone Database wizard opens.

  6. On the Clone Database page: Source Type page, select Online Backup and Use Recovery Manager (RMAN) to copy database files.

    Click Continue.

    Note:

    When you use RMAN backup to clone a database, the source database will be duplicated directly to the specified destination Oracle Home. No staging areas are required.

  7. On the Clone Database: Source Options page, in the Degree of Parallels box, enter the number of parallel channels to be used by RMAN to copy the database files. The default number is 2.

    Note:

    Degree of parallelism is the number of parallel channels used by Recovery Manager (RMAN) to copy the database files. It is calculated as the CPU count of the host. Increased parallelism may speed the process if sufficient system resources are available.

  8. In the Source Host Credentials section, enter the credentials of the user who owns the source database Oracle server installation. You can either select Named credential or New credential.

    If you select New credential, enter the Username and Password. You can select the Set as Preferred Credentials checkbox, if you want to use these set of credentials again. Click Test to check if your credentials are valid.

    Click Next.

  9. On the Clone Database: Select Destinations page, in the Destination Oracle Home section, click Search .

    Note:

    The Oracle Home should exist on the specified host and should match the version of the source database.

    On the Destination Oracle Home page that appears, search and select the destination Oracle Home. Click Next.

  10. In the Destination Host Credentials section, enter the credentials of the user who owns the Oracle Home specified in the Destination Oracle Home section.
  11. In the Destination Database section, do the following: specify the global database name, the instance name, and for select file system as the database storage. Click Next.
    • Specify the global database name.

      For example: clone1.example.com

    • Specify a unique instance name.

      For example: clone1

    • Select File System as the database storage.

    • Click Next.

  12. On the Clone Database: Destination Options page, select Use Database Area and Fast Recovery Area.

    Click Next.

  13. On the Clone Database: Database Configuration page, in the Listener Configuration section, specify the name and port of the listener that will be used for the cloned database. If a new name and port are specified that are not in use by an exiting listener, a new listener using the specified port will be created.

    In the Database Registration section, select Register the cloned database as an Enterprise Manager target monitored by using DBSNMP. Enter the target database name.

    Click Next.

  14. On the Clone Database: Schedule page, specify a name description for the clone job. You can choose to run the clone job immediately or you can specify a later time and date for the job to run.

    Click Next.

  15. On the Clone Database: Review page, review the details and configuration of the source database, the destination database, and the database storage. You can view the database storage files by clicking on View Source Database Files.

    Click Submit Job.

    he clone database job is now submitted. When the job completes, a Clone Database: Confirmation page appears. To view the status of the job, click View Status. To exit the page click OK.

Cloning an Oracle Database Using Staging Areas

To clone an Oracle database by copying database files via staging areas, follow these steps:

  1. From the Targets menu, select Databases.
  2. On the Databases page, select a database that you want to clone.
  3. On the Database target page, from the Oracle Database menu, select Provisioning, and then click Clone Database.
  4. On the Clone and Refresh page, click the Switch to Classic Clone link.
  5. On the Database Login page, enter your credentials. Click Login.

    The Clone Database wizard opens.

  6. On the Clone Database page: Source Type page, select Online Backup and Copy database files via staging areas.

    Click Continue.

    Note:

    This method requires staging areas on both the source and the destination hosts.

  7. On the Clone Database: Source Options page, in the Staging Area section, enter the Staging Area Location.

    Note:

    A staging area on the source host is required in order to clone a running database. A backup is performed on the database and the backup files are stored in the staging area.

  8. Select if you want to delete or retain the staging area after the cloning operation.

    By retaining the staging area after a cloning operation, you avoid doing another backup later. However, this option requires a minimum disk space of 2230 MB.

  9. In the Source Host Credentials section, enter the credentials of the user who owns the source database Oracle server installation. You can either select Named credential or New credential.

    If you select New credential, enter the Username and Password. You can select the Set as Preferred Credentials checkbox, if you want to use these set of credentials again. Click Test to check if your credentials are valid.

    Click Next.

  10. On the Clone Database: Select Destinations page, in the Destination Oracle Home section, click the Search icon.

    Note:

    The Oracle Home should exist on the specified host and should match the version of the source database.

    On the Destination Oracle Home page that appears, search and select the destination Oracle Home. Click Next.

  11. In the Destination Host Credentials section, enter the credentials of the user who owns the Oracle Home specified in the Destination Oracle Home section.
  12. In the Destination Database section, do the following: specify the global database name, the instance name, and for select file system as the database storage. Click Next.
    • Specify the global database name.

      For example: clone1.example.com

    • Specify a unique instance name.

      For example: clone1

    • Select File System as the database storage.

    • Click Next.

  13. On the Clone Database: Destination Options page, select Use Database Area and Fast Recovery Area.

    Click Next.

  14. On the Clone Database: Database Configuration page, in the Listener Configuration section, specify the name and port of the listener that will be used for the cloned database. If a new name and port are specified that are not in use by an exiting listener, a new listener using the specified port will be created.

    In the Database Registration section, select Register the cloned database as an Enterprise Manager target monitored by using DBSNMP. Enter the target database name.

    Click Next.

  15. On the Clone Database: Schedule page, specify a name description for the clone job. You can choose to run the clone job immediately or you can specify a later time and date for the job to run.

    Click Next.

  16. On the Clone Database: Review page, review the details and configuration of the source database, the destination database, and the database storage. You can view the database storage files by clicking on View Source Database Files.

    Click Submit Job.

    he clone database job is now submitted. When the job completes, a Clone Database: Confirmation page appears. To view the status of the job, click View Status. To exit the page click OK.

Cloning an Oracle Database Using an Existing Backup

To clone an Oracle database using an existing backup, follow these steps:

  1. From the Targets menu, select Databases.
  2. On the Databases page, select a database that you want to clone.
  3. On the Database target page, from the Oracle Database menu, select Provisioning, and then click Clone Database.
  4. On the Clone and Refresh page, click the Switch to Classic Clone link.
  5. On the Database Login page, enter your credentials. Click Login.

    The Clone Database wizard opens.

  6. On the Clone Database page: Source Type page, select Existing BackUp.

    Click Continue.

  7. On the Clone Database: Source Host Credentials page, select the backup that you want to use.
  8. In the Source Host Credentials section, enter the credentials of the user who owns the source database Oracle server installation. You can either select Preferred, Named or New credential.

    If you select New credential, enter the Username and Password. You can select the Set as Preferred Credentials checkbox, if you want to use these set of credentials again. Click Test to check if your credentials are valid.

    Click Next.

  9. On the Clone Database: Backup Details page, in the Point In Time section, specify a time or System Change Number (SCN). This will help identify backups necessary to create the clone database.

    Note:

    If the existing backup does not have all necessary archive logs, Enterprise Manager will transfer them from the source host to the destination host as part of the clone operation.

  10. Oracle database backups are can be encrypted using a database wallet, password, or both. If the backups are encrypted, specify the encryption mode and password as needed, in the Encryption section. By default, the encryption mode is set as None.

    Click Next.

  11. In the Destination Host Credentials section, enter the credentials of the user who owns the Oracle Home specified in the Destination Oracle Home section.
  12. In the Destination Database section, do the following: specify the global database name, the instance name, and for select file system as the database storage. Click Next.
    • Specify the global database name.

      For example: clone1.example.com

    • Specify a unique instance name.

      For example: clone1

    • Select File System as the database storage.

  13. In the Parallelism section, in the Degree of Parallels box, enter the number of parallel channels to be used by RMAN to copy the database files. The default number is 2.

    Note:

    Degree of parallelism is the number of parallel channels used by Recovery Manager (RMAN) to copy the database files. It is calculated as the CPU count of the host. Increased parallelism may speed the process if sufficient system resources are available.

    Click Next.

  14. On the Clone Database: Destination Database Settings page, in the Memory Parameters section, select Configure Memory Management and then from the drop-down list select Automatic Shared Memory Management.

    The database automatically sets the optimal distribution of memory across the System Global Area (SGA) components. The distribution of memory will change from time to time to accommodate changes in the workload. Also, specify the aggregate Program Global Area (PGA) size.

  15. In the Listener Configuration section, specify the name and port of the listener to be configured for the database. If the listener specified does not exist at the destination Oracle Home, it will be created.

    Note:

    If you are going to convert the cloned database RAC at a later point, it is recommended that you specify storage location shared across all hosts in the cluster.

  16. In the Recovery Files section, specify the location where recovery-related files such as, archived redo log files, RMAN backups, and the like are to be created.

    Click Next.

  17. On the Clone Database: Storage Locations page, in Database Files Location section, specify the location where datafiles, tempfiles, redo log files, and control files are to be created.

    In the Database Registration section, select Register the cloned database as an Enterprise Manager target monitored by using DBSNMP. Enter the target database name.

    Click Next.

  18. On the Clone Database: Schedule page, specify a name description for the clone job. You can choose to run the clone job immediately or you can specify a later time and date for the job to run.

    Click Next.

  19. On the Clone Database: Review page, review the details and configuration of the source database, the destination database, and the database storage. You can view the database storage files by clicking on View Source Database Files.

    Click Submit Job.

    The clone database job is now submitted. When the job completes, a Clone Database: Confirmation page appears. To view the status of the job, click View Status. To exit the page click OK.

Creating a Full Clone Pluggable Database

There are two methods to create a Full Clone Pluggable Database, you can use the Clone Wizard in Enterprise Manager or via command line with EM CLI.

If you are managing a PDB on OCI resources make sure that all OCI required prerequistes and discovery have been performed. For more information, see: Deploying Agents on OCI Resources.

Note:

From Enterprise Manager 13.4 Release Update 3 onwards users will have the ability to clone and upgrade Pluggable Databases (PDB) by plugging a PDB into a higher version Container Database (CDB), the PDB will be automatically upgraded to the higher CDB version.

Creating a Full Clone Pluggable Database Using the Clone Wizard

You can create a full clone of a PDB using the new Clone PDB Wizard. To create a full clone PDB, follow these steps:

  1. From the Targets menu, select Databases.
  2. For View, select Search List. From the View menu, select Expand All.
  3. Look for the source CDB (the CDB that the source PDB is a part of) in the list, then click the name of the PDB that you want to clone.
  4. From the Oracle Database menu, select Cloning, then select Create Full Clone.
    Alternatively, in Step 3, you can right click the name of the PDB that you want to clone, select Oracle Database, select Cloning, then select Create Full Clone.
  5. On the Source and Destination: Create Full Clone Pluggable Database page, do the following:
    • Specify the SYSDBA credentials for the source CDB. You can choose to use the preferred credentials, use a saved set of named credentials, or specify a new set of credentials.
    • In the Pluggable Database Destination section, specify a name, and a display name for the PDB clone. Enterprise Manager uses the display name to identify the PDB clone target.
    • Select the Refreshable clone check box to create a manually Refreshable PDB.

      Note:

      • Refreshable clone feature is only applicable to Oracle Database version 12.2 and above.
      • To create a Refreshable clone you have to select a different Container Database (CDB). You will not be able to create one in the same CDB.
      • The Refreshable PDB clone is created in read-only mode and can only be either in read-only or mounted state. The clone cannot be opened in read-write mode. Therefore, data masking and post SQL scripts cannot be run on the clone.
    • In the PDB Administrator Credentials section, specify the credentials of the admin user account that you want to use to administer the PDB clone.
    • To clone the PDB to a CDB different from the source CDB, select Clone the Pluggable Database into a different Container Database, then specify the destination CDB.

      Note:

      If the destination CDB is a of higher version than the PDB clone, then the cloned PDB will be upgraded to the CDB version as part of the deployment procedure. The pre-upgrade SQL script will be executed on the source PDB.

      Before cloning a PDB version 12.1.0.2.0 to a higher CDB version using the Database Link Mechanism make sure you have deployed patch 18633374 as detailed in MOS NOTE 2090019.1.

    • In the Credentials section, specify the destination CDB host credentials. If you chose to clone the PDB to a CDB different from the source CDB, specify the SYSDBA credentials for the destination CDB. Also, if the destination CDB is using Automatic Storage Management (ASM) to manage disk storage, you must specify the ASM credentials.

      If the source database is TDE enabled and of version 12.2 and above, then enter the wallet password of the destination CDB. If the source database is of a version prior to 12.2, then you must also enter the source wallet password. Note that if the source PDB is TDE enabled, then you can only clone it to a CDB that is also TDE enabled.

    Note:

    For Database versions 12.2 and above, if both the source and destination Container Databases are in Archive Log mode and have Local Undo configured, then a Hot clone is performed. Hot clone is the ability to clone a Pluggable Database while the source is open in read-write mode.
  6. You can specify other configuration details, mask data, as well as schedule the cloning process, by selecting the Advanced option. Follow the rest of the steps, if you have selected the Advanced option. If you do not need to specify anymore details, click Clone. This submits the deployment procedure to clone a PDB to a CDB that is deployed in a public cloud setup.
  7. On the Create Full Clone Pluggable Database: Source and Destination page, verify the details specified, and then click Next.
  8. On the Create Full Clone Pluggable Database: Configuration page, do the following:
    • In the Database Files Location section, specify the storage location where the datafiles of the PDB clone must be stored. If the destination CDB is using ASM to manage disk storage, specify the disk group where the data files of the PDB clone must be stored.
    • To ensure that only the source PDB data model definition is cloned (and the source PDB data is not cloned), select Exclude User Data.
    • In the Advanced Configuration section, specify the storage limits for the maximum size of the PDB clone, and the maximum size of a shared tablespace within the PDB clone. By default, no limits are placed on the values for these attributes.
    • In the Miscellaneous section, select the logging option that you want to use for the tablespaces created within the PDB clone.
    Click Next.
  9. On the Create Full Clone Pluggable Database: Post Processing page, do the following:
    • In the Data Masking section, specify the data masking definition that you want to apply after cloning the PDB. Data masking masks sensitive data in a database.

      For information on how to create a data masking definition, see Oracle Data Masking and Subsetting Guide. Note that you can apply a data masking definition only if you have the Subset-Masking license pack.

    • In the Custom Scripts section, for Pre Script and Post Script, specify the Oracle Software Library components that contain the scripts that you want to run before cloning, and after cloning the PDB respectively. Also, for SQL Script, specify the SQL scripts that you want to run after cloning the PDB. For Run As User, select the user account that you want to use to run the SQL scripts.Click Next.
  10. On the Create Full Clone Pluggable Database: Schedule page, specify an instance name for the cloning deployment procedure. Also, specify the point in time when you want the cloning procedure to begin.
    In the Notification section, select the deployment procedure states for which you want to receive e-mail notifications. For example, if you select Scheduled and Succeeded for Status for Notification, you will receive e-mail notifications when the cloning deployment procedure is scheduled, and when it succeeds.

    Click Next.

  11. On the Create Full Clone Pluggable Database: Review page, review all the details you provided. If you want to edit certain details, click Back to navigate to the required page.
    Click Clone to submit the deployment procedure to create a full clone of the source PDB.

Creating a Full Clone Pluggable Database Using EMCLI

Pluggable Database Cloning using EMCLI

To create a full clone of a pluggable database, execute the verb emcli pdb_clone_management -input_file=data:/xyz/sdf/pdb_clone.props, where pdb_clone.props is the properties file.

Sample properties file (pdb_clone.props):

SRC_PDB_TARGET=cdb_prod_PDB
SRC_HOST_CREDS=NC_HOST_SCY:SYCO
SRC_CDB_CREDS=NC_HOST_SYC:SYCO
SRC_WORK_DIR=/tmp/source
DEST_HOST_CREDS=NC_SLCO_SSH:SYS
DEST_LOCATION=/scratch/sray/app/sray/cdb_tm/HR_TM_PDB6
DEST_CDB_TARGET=cdb_tm
DEST_CDB_TYPE=oracle_database
DEST_CDB_CREDS=NC_HOST_SYC:SYCO
DEST_PDB_NAME=HR_TM_PDB6

Note:

  • If you are creating a full clone PDB on Oracle cloud, wherein both the destination PDB and the source PDB are in different CDBs, while both the CDBs are on Oracle Cloud, then ensure that the source PDB is in read-write mode. This is necessary since a database link is created in the destination CDB for cloning the PDB, and a temporary user is created in the source PDB for using the database link. If there is an existing database link in the destination CDB that connects to the source PDB, then use the parameter EXISTING_DB_LINK_NAME to provide the database link name in the properties file.
  • If the PDB full clone (on-premise) needs to be performed using a backup, then the following parameters should be added in the properties file.
    BACKUP_TYPE=RMAN
    DEST_STAGE_DIR=/tmp/bkp_common
    If the temporary backup location is shared across source and destination, then add the SKIP_DATA_TRANSFER parameter and set it to 'Y'. For example, SKIP_DATA_TRANSFER=Y. This indicates that the data transfer step should be skipped in the clone procedure.
  • If the source database is TDE enabled and of version 12.2 and above, then you must also specify the DEST_WALLET_PWD property. If the source database is TDE enabled and of a version prior to 12.2, then you must specify the SRC_WALLET_PWD and DEST_WALLET_PWD properties.

Pluggable Database Cloning Using Pre and Post Scripts

The following is a list of accepted Deployment Procedure Variables that can be incorporated into Pre and Post scripts for Pluggable Database cloning workflows. For more information on Pre and Post scripts see: Custom Pre and Post Scripts for Fleet Operations
Variable Name Description
SRC_HOST Source host name
SRC_CDB_TARGET Source CDB target name
SRC_CDB_TYPE Source CDB target type.

Values: oracle_database or rac_database

SRC_CDB_NAME Source CDB name
SRC_CDB_SID Source CDB SID
SRC_PDB_NAME Source PDB name
SRC_DATABASE_VERSION Source CDB version
SRC_ORACLE_HOME Source Oracle Home location
DEST_HOST Destination host name
DEST_CDB_TARGET Destination CDB target name
DEST_CDB_TYPE Destination CDB target type.

Values: oracle_database or rac_database

DEST_PDB_NAME Destination PDB name (clone)
DEST_CDB_NAME Destination CDB name
DEST_CDB_SID Destination CDB SID
DEST_PDB_DISPLAY_NAME Display name of the clone PDB target
DEST_PDB_ADMIN_NAME Destination PDB administrator
DEST_DATABASE_VERSION Destination CDB version
CREATE_FILE_DEST Destination PDB datafiles storage location
DEST_WORK_DIR Work directory on the destination host
DEST_ORACLE_HOME Destination Oracle Home location
LOGGING_TYPE Destination PDB logging clause
SRC_PDB_ORIG_STATE Original state of the Source PDB

Sample Variables:

SRC_HOST=xyz.example.com
SRC_CDB_TARGET=SAMPLE_CDB1
SRC_CDB_TYPE=oracle_database
SRC_PDB_TARGET=SAMPLE_PDB1
SRC_CDB_NAME=SAMPLE_CDB1
SRC_CDB_SID=CDB1
SRC_PDB_NAME=PDB1
SRC_DATABASE_VERSION=<DB Version>
SRC_ORACLE_HOME=/scratch/app/product/<DB Version>/dbhome_1
DEST_HOST=abc.example.com
DEST_CDB_TARGET=SAMPLE_CDB2
DEST_CDB_TYPE=oracle_database
DEST_PDB_NAME=SAMPLE_PDB2
DEST_CDB_NAME=CDB2
DEST_CDB_SID=CDB2
DEST_PDB_DISPLAY_NAME=SAMPLE_Clone2_PDB
DEST_PDB_ADMIN_NAME=PDBADMIN
DEST_DATABASE_VERSION=<DB Version>
DEST_LOCATION=/scratch/app/oradata/EMEA_CL2
DEST_WORK_DIR=/tmp
DEST_ORACLE_HOME=/scratch/appk/product/<DB Version>/dbhome_1
CREATE_FILE_DEST=/scratch/app/oradata/SAMPLE_PDB2
LOGGING_TYPE=LOGGING
SRC_PDB_ORIG_STATE=READ WRITE

Relocation Database Cloning Using Pre and Post Scripts

The following is a list of accepted Deployment Procedure Variables that can be incorporated into Pre and Post scripts for Pluggable Database relocation cloning workflows. For more information on Pre and Post scripts see: Custom Pre and Post Scripts for Fleet Operations
Variable Name Description
SRC_PDB_TARGET_NAME Source PDB target name
SRC_CDB_TARGET_NAME Source CDB target name
SRC_CDB_TARGET_TYPE Source CDB target type.

Values: oracle_database or rac_database

SRC_PDB_NAME Source PDB name
SRC_PDB_MODE State of the Source PDB
SRC_ORACLE_HOME_LOC Source Oracle Home location
SRC_CDB_VERSION Source CDB version
RELOCATE_TYPE Mechanism of PDB relocation
AVAILABILITY Availability mode
DEST_PDB_NAME Destination PDB name
DEST_PDB_DISPLAY_NAME Display name of the relocated PDB target
DEST_CDB_TARGET_NAME Destination CDB target name
DEST_CDB_TARGET_TYPE Destination CDB target type.

Values: oracle_database or rac_database

DB_LINK_NAME Name of the Database Link used for PDB relocation
DEST_WORK_DIR Work directory on the destination host
STORAGE_LOCATION Destination PDB datafiles storage location
LOGGING_TYPE Destination PDB logging clause
DEST_HOST_NAME Destination host name
DEST_ORACLE_HOME_LOC Destination Oracle Home location
DEST_CDB_VERSION Destination CDB version

Sample Variables:

SRC_PDB_TARGET_NAME=PDB1_SAMPLE
SRC_CDB_TARGET_NAME=CDB1_SAMPLE
SRC_CDB_TARGET_TYPE=oracle_database
RELOCATE_TYPE=USING_DBLINK
AVAILABILITY=NORMAL
DEST_PDB_NAME=PDB2_SAMPLE
DEST_PDB_DISPLAY_NAME=PDB2_SAMPLE
DEST_CDB_TARGET_NAME=CDB2_SAMPLE
DEST_CDB_TARGET_TYPE=oracle_database
DB_LINK_NAME=LINK<LINK NUMBER>
DEST_WORK_DIR=/tmp/BKP_STAGE
STORAGE_LOCATION=/scratch/app/oradata
LOGGING_TYPE=LOGGING
SRC_PDB_NAME=PDB1_SAMPLE
SRC_PDB_MODE=READ WRITE
SRC_ORACLE_HOME_LOC=/scratch/app/product/<DB VERSION>/dbhome_1
SRC_CDB_VERSION=<DB VERSION>
DEST_HOST_NAME=abc.sample.com
DEST_ORACLE_HOME_LOC=/s