15 Cloning Solutions in Hybrid Cloud (Oracle PaaS)

This chapter contains the following sections:

15.1 Overview of Cloning in Oracle PaaS

While managing the IT infrastructure of your enterprise, you may encounter a situation wherein you want an Oracle Cloud application to utilize and analyze data stored on-premise. In such a situation, you may need to migrate the data stored on-premise to Oracle Cloud. Enterprise Manager Cloud Control (Cloud Control) 12c Release 5 (12.1.0.5) provides this functionality.

Cloud Control 12.1.0.5 introduces Hybrid Cloud management, that is, it enables you to monitor certain Oracle Cloud targets using an on-premise Cloud Control instance using Enterprise Manager Command Line Interface (EM CLI). It also introduces a new Clone PDB Wizard that leverages Hybrid Cloud management and enables you to clone an on-premise PDB to a CDB that is deployed in Oracle Cloud. Effectively, this enables you to copy or migrate your on-premise data to Oracle Public Cloud.

Additionally, you can also use the Clone PDB Wizard or EM CLI to clone PDBs that are deployed in Oracle Cloud to a CDB that is deployed on-premise, as well as clone PDBs within Oracle Cloud.

When you clone an on-premise PDB or schema(s), a copy of it is created, and data is transferred via the Hybrid Cloud Gateway or any other host with SSH connectivity to Oracle Cloud. The secure copy is then used to create a PDB or database on Oracle Cloud.

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.

15.2 Cloning in Hybrid Cloud Use Cases

The following table lists the use cases covered when cloning in Hybrid Cloud:

15.3 Prerequisites for Cloning in Oracle PaaS

The following are the prerequisites for cloning an on-premise PDB to a CDB deployed in Oracle Cloud (that is, the destination CDB):

  • The on-premise Cloud Control instance must be of version 12c Release 5 (12.1.0.5).

  • A Management Agent must be deployed on the destination CDB host (the host on which the destination CDB is deployed). Also, the destination CDB target must be discovered.

    For information on how to deploy a Management Agent on an Oracle Cloud target, see Oracle Enterprise Manager Cloud Control Administrator's Guide.

  • Cloning is supported only if Oracle Software Library is not configured with an upload location of the OMS Agent storage type.

  • It is recommended that you use a Test Master database or a Test Master pluggable database for cloning to, from, or within Oracle Cloud.

    To create a Test Master database, see Section 14.2, "Creating a Test Master Database".

    To create a Test Master pluggable database, see Section 14.4, "Creating a Test Master Pluggable Database".

  • The on-premise PDB and the PDB on Oracle Cloud should not be encrypted, should possess the same character set, and should have the same patch set level.

  • The on-premise PDBs, databases, and schemas should be on ASM, whereas the PDBs, databases, and schemas on Oracle Cloud need to be on a filesystem.

  • When cloning from on-premise to Cloud, the cloning procedure may fail in the SecureCopyFiles step in the non-advanced wizard mode. This is because SELINUX is set as enforcing, which means that the SELinux security policy is enforced. You will need to configure the SELinux to allow RSYNC from the Agent (script). An option is to change SELinux to permissive, where SELinux prints warnings instead of enforcing.

15.4 Cloning to Oracle Cloud

To clone a database, schema(s), or a pluggable database from on-premise to Oracle Cloud, refer to the following use cases:

15.4.1 Cloning a PDB to Oracle Cloud

To clone an on-premise PDB to a PDB on Oracle Cloud, you can use either of the following solutions:

15.4.1.1 Cloning a PDB to Oracle Cloud Using the Clone Wizard

To clone a PDB to a CDB deployed in Oracle Cloud, 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 Clone to Oracle Cloud.

    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 Clone to Oracle Cloud.

  5. On the Source and Destination: Clone to Oracle Cloud page, do the following:

    • In the Credentials section, specify the SYSDBA credentials for the source CDB, and the host 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 Definition section, specify a name, and a display name for the PDB clone. Enterprise Manager uses the display name to identify the PDB clone target.

    • In the PDB Administrator Credentials section, specify the credentials of the Admin user account that you want to use to administer the PDB clone.

    • In the Container Database section, specify the destination CDB that is deployed in Oracle Cloud (the CDB that the PDB clone must be a part of).

    • In the Credentials section, specify the SYSDBA credentials for the destination CDB, and the host credentials for the destination CDB.

  6. 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 Oracle Cloud.

    To specify other configuration details, mask data, as well as schedule the cloning process, click Advanced.

    Follow the rest of the steps, if you have selected the Advanced option.

  7. On the Clone to Oracle Cloud: Source and Destination page, verify the details, and then click Next.

  8. On the Clone to Oracle Cloud: Configuration page, in the Database Files Location section, specify the storage location where the datafiles of the PDB clone must be stored.

    In the Advanced Configuration section, specify the storage limits for the maximum size of the PDB clone, and the maximum size of a shared table space 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 table spaces created within the PDB clone.

    Click Next.

    Clone to Cloud Configuration page
  9. On the Clone to Oracle Cloud: Post Processing page, 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 Creating or Editing a Data Masking Definition. 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. Clone to Cloud post processing page

  10. On the Clone to Oracle Cloud: Schedule page, specify an instance name for the cloning deployment procedure. Also, specify the point in time when you want the cloning deployment 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.

    Clone to Cloud Schedule page
  11. On the Clone to Oracle Cloud: 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 clone a PDB to a CDB that is deployed in Oracle Cloud.

    Clone to Cloud Review page

15.4.1.2 Cloning a PDB to Oracle Cloud Using EM CLI

You can clone an on-premise pluggable database to Oracle Cloud. Before you proceed with the EM CLI command, it is recommended that you create a Test Master of the on-premise PDB and use the Test Master to create a clone. This is recommended so as to mask the data before it can be transferred over the internet.

To create a Test Master, see Section 14.4.2, "Creating a Test Master Pluggable Database Using EM CLI".

To clone an on-premise pluggable database to Oracle Cloud, enter the EM CLI verb emcli pdb_clone_management -input_file=data:/xyz/sdf/pdb_clone.props -cloneToOracleCloud, where pdb_clone.props is the properties file which provides the cloning parameters and their values.

There are 3 methods in which you can clone a pluggable database. The difference between each of these methods is in the configuration of certain parameters in the properties file. The 3 methods and the details of the configuration parameters are explained below:

  • Operating System (OS) Image backup

    Takes a backup of the source PDB and creates a new PDB. The BACKUP_TYPE parameter should specify the type of backup. The allowed values for BACKUP_TYPE are OSIMAGE, RMAN and TAR. The EXISTING_BACKUP and EXISTING_BACKUP_METADATA parameters should not be provided.

    Sample properties file:

    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
    BACKUP_TYPE=OSIMAGE
    
  • Existing backup

    Uses an existing backup of the source PDB and creates a new PDB. The BACKUP_TYPE parameter should specify the type of backup. The allowed values for BACKUP_TYPE are OSIMAGE, RMAN and TAR. The EXISTING_BACKUP parameter should specify the location with the backup name and EXISTING_BACKUP_METADATA should specify the location and the metadata file name for the backup.

    Sample properties file:

    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
    EXISTING_BACKUP=/user1/pdbbackup/PDB1_Backup_14297779
    EXISTING_BACKUP_METADATA=/user1/pdbbackup/PDB1_Backup_14297779/PDB1.xml
    BACKUP_TYPE=RMAN
    

    Note:

    To create a PDB backup, enter the verb emcli pdb_backup -inputFile="loaction of file containing properties required for taking backup of PDB", where the sample contents of the properties file is as follows:
    TARGET_HOST_LIST=xyz.abccorp.com
    HOST_NORMAL_NAMED_CRED=XYZ_CRED:CRED_OWNER
    SRC_CDB_NAMED_CRED=CDB1_CRED:CRED_OWNER
    SRC_CDB_TARGET_NAME=CDB1
    SRC_CDB_TARGET_TYPE=oracle_database
    SRC_PDB_TARGET_NAME=CDB1_PDB1
    BACKUP_LOCATION=/user1/pdbbackup
    WORK_DIR_LOCATION=/tmp
    ORACLE_HOME_LOC=/scratch/d121hmcasm/product/12.1.0/dbhome_1
    
  • Unplug/plug

    Unplugs the source PDB and creates a new PDB at the destination using the unplugged source, and then plugs the source back. EXISTING_BACKUP, EXISTING_BACKUP_METADATA and BACKUP_TYPE parameters should not be provided.

    Sample properties file:

    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:

For all the 3 methods stated above, in case the destination PDB data files location is ASM then add the parameter DEST_STAGE_DIR who's value will be used as the destination while transferring the source PDB data files. This parameter is optional, if it is not provided a temporary directory will be used. For Linux systems the temporary directory is /tmp.

15.4.2 Cloning Schema(s) to a DB or PDB on Oracle Cloud

You can clone a schema that is on-premise to Oracle Cloud either as a database or a pluggable database using EM CLI verbs.

Note:

As a prerequisite it is recommended that you create a Test Master of the schema database and to use the schema of the Test Master to create a clone. To create a Test Master, see Section 14.2.2, "Creating a Test Master Database Using EM CLI".

To clone a schema that is on-premise to Oracle Cloud either as a database or a pluggable database, follow the steps below:

  1. Enter the EM CLI verb emcli describe_dbprofile_input -data_mode=EXPORT. The output provides all profile creation input variables.

    Note:

    Export is supported only for database and schema whereas import is supported for both database and PDBs. This indicates that the source should always be a database or schema and the destination can either be a database or a PDB.
  2. Use the input variables to create a properties file with values for all the variables.

  3. Create the directory object SCHEMAS_DUMP_DIR.

  4. Export data from the source database by creating a database profile. To do so, enter the verb emcli create_dbprofile - input_file=data:<properties file name along with path>.

    Note:

    Use the properties file created in the previous step for this verb.

    Sample properties file:

    #-----------------------------------------------#
    # SOURCE                                        #
    #-----------------------------------------------#
    REFERENCE_DATABASE=SS_REF_TD_DB
    REFERENCE_DATABASE_TYPE=oracle_database
    REF_DB_CREDENTIALS=CRED_DB:sysman
    REF_HOST_CREDENTIALS=CRED_HOST:sysman
    
    #-----------------------------------------------#
    # DATA CONTENT DETAILS                          #
    #-----------------------------------------------#
    DATA_CONTENT_MODE=EXPORT
    DATA_CONTENT=METADATA_AND_DATA
     
    #-----------------------------------------------#
    # EXPORT DETAILS                                #
    #-----------------------------------------------#
    EXPORT.EXPORT_TYPE=SELECTED_SCHEMAS
    EXPORT.SCHEMA_INCLUDE_LIST.0=HR
    EXPORT.SCHEMA_INCLUDE_LIST.1=PM
    EXPORT.SCHEMA_INCLUDE_LIST.2=OE
    EXPORT.SCHEMA_INCLUDE_LIST.3=IX
    EXPORT.SCHEMA_INCLUDE_LIST.4=SH
    EXPORT.SCHEMA_INCLUDE_LIST.5=BI
    EXPORT.DEGREE_OF_PARALLELISM=1
    EXPORT.DUMP_DIRECTORY_LIST.0=directory=SCHEMAS_DUMP_DIR,file_name=samplschemas.dmp,max_size=100
    EXPORT.LOG_FILE_DIRECTORY=directory=SCHEMAS_DUMP_DIR,file_name=samplschemas.log
     
    #-----------------------------------------------#
    #         PROFILE DETAILS                       #
    #-----------------------------------------------#
    PROFILE_NAME=Export Dump of Sample schemas10
    PROFILE_VERSION=11.2.0.4.0
    PROFILE_LOCATION=Database Provisioning Profiles/12.1.0.1.0/linux_x64/
    WORKING_DIRECTORY=/tmp
    
  5. Enter the verb to transfer data: emcli data_transfer -input_file=data:/u01/files/data_trans.props.

    Sample properties file:

    #-----------------------------------------#
    # SOURCE                                  #
    #-----------------------------------------#
    SRC_HOST_CREDS=NC_HOST_SRAY
    SOURCE_LOCATION=/tmp/newp/PDB_Backup_142838
    SRC_HOST=bl2.idc.example.com
     
    #-----------------------------------------#
    # DESTINATION                             #
    #-----------------------------------------#
    DEST_HOST_CREDS=NC_HOST_SRAY
    DEST_LOCATION=/scratch/sray/app3/sray/oradata/migda
    DEST_HOST=slo.us.example.com
    
    #-----------------------------------------#
    # HYBRID GATEAWAY / FORWARDER             #
    #-----------------------------------------#
    FORWARDER_HOST=slo.us.example.com
    FORWARDER_CRED=ACD_NY:SYSCO
    WORKING_DIRECTORY=/tmp
    

    Note:

    Remove the Hybrid Gateway parameters if the SSH connection exists between the source and the destination hosts.
  6. Enter the verb to import data in to the destination database: emcli dbimport -input_file=data:/u01/files/dbimport.props.

    Note:

    To clone the destination to database or pluggable database, ensure you provide the required value in the DESTINATION_TARGET_TYPE option in the properties file. For database, enter oracle_database, and for PDB enter oracle_pdb.

    Sample properties file:

    #-----------------------------------------------#
    #         DESTINATION                           #
    #-----------------------------------------------#
    DESTINATION_TARGET=SS_OPC_DB
    DESTINATION_TARGET_TYPE=oracle_database
    DATABASE_CREDENTIAL=CRED_DB:sysman
    HOST_NAMED_CREDENTIAL=CRED_HOST:sysman
     
    #-----------------------------------------------#
    #         PROFILE                               #
    #-----------------------------------------------#
    PROFILE_LOCATION=Database Provisioning Profiles/12.1.0.1.0/linux_x64/Export Dump of Sample schemas10
     
    #-----------------------------------------------#
    #         SCHEMA DETAILS                        #
    #-----------------------------------------------#
    REMAP_SCHEMA_LIST.0=HR:HR
    REMAP_SCHEMA_LIST.1=OE:OE
    REMAP_SCHEMA_LIST.2=PM:PM
    REMAP_SCHEMA_LIST.3=IX:IX
    REMAP_SCHEMA_LIST.4=SH:SH
    REMAP_SCHEMA_LIST.5=BI:BI
    REMAP_TABLESPACE_LIST.0=EXAMPLE:MYTBSP1
    REMAP_TABLESPACE_LIST.1=USERS:MYTBSP1
    REMAP_TABLESPACE_LIST.2=SYSTEM:MYTBSP1
    DEGREE_OF_PARALLELISM=1
    DUMP_FILE_LIST.0=/scratch/ae/dumpdir/samplschemas.dmp
    IMPORT_LOG_FILE_DIRECTORY=DATA_PUMP_DIR
    

15.4.3 Cloning a DB to a DB or PDB on Oracle Cloud

You can clone a database that is on-premise to Oracle Cloud either as a database or a pluggable database using EM CLI verbs.

Note:

As a prerequisite it is recommended that you create a Test Master of the database and use the Test Master to create a clone. To create a Test Master, see Section 14.2.2, "Creating a Test Master Database Using EM CLI".

To clone a database that is on-premise to Oracle cloud either as a database or a pluggable database, follow the steps below:

  1. Enter the EM CLI verb emcli describe_dbprofile_input -data_mode=EXPORT. The output provides all profile creation input variables.

    Note:

    Export is supported only for database and schema whereas import is supported for both database and PDBs. This indicates that the source should always be a database or schema and the destination can either be a database or a PDB.
  2. Use the input variables to create a properties file with values for all the variables.

  3. Create the directory object SCHEMAS_DUMP_DIR.

  4. Export data from the source database by creating a database profile. To do so, enter the verb emcli create_dbprofile - input_file=data:<properties file name along with path>.

    Note:

    Use the properties file created in the previous step for this verb.

    Sample properties file:

    #-----------------------------------------------#
    # SOURCE                                        # 
    #-----------------------------------------------#
    REFERENCE_DATABASE=SS_TM_DB
    REFERENCE_DATABASE_TYPE=oracle_database
    REF_DB_CREDENTIALS=CRED_DB:sysman
    REF_HOST_CREDENTIALS=CRED_HOST:sysman
    
    #-----------------------------------------------#
    # DATA CONTENT DETAILS                          #
    #-----------------------------------------------#
    DATA_CONTENT_MODE=EXPORT
    DATA_CONTENT=METADATA_AND_DATA
     
    #-----------------------------------------------#
    # EXPORT DETAILS                                #
    #-----------------------------------------------#
    EXPORT.EXPORT_TYPE=FULL_DATABASE
    EXPORT.DEGREE_OF_PARALLELISM=1
    EXPORT.DUMP_DIRECTORY_LIST.0=directory=SCHEMAS_DUMP_DIR,file_name=samplschemas.dmp,max_size=100
    EXPORT.LOG_FILE_DIRECTORY=directory=SCHEMAS_DUMP_DIR,file_name=samplschemas.log
     
    #-----------------------------------------------#
    #         PROFILE DETAILS                       #
    #-----------------------------------------------#
    PROFILE_NAME=Export Dump of Sample schemas10
    PROFILE_VERSION=11.2.0.4.0
    PROFILE_LOCATION=Database Provisioning Profiles/12.1.0.1.0/linux_x64/
    WORKING_DIRECTORY=/tmp
    
  5. Enter the verb to transfer data: emcli data_transfer -input_file=data:/u01/files/data_trans.props.

    Sample properties file:

    #-----------------------------------------#
    # SOURCE                                  #
    #-----------------------------------------#
    SRC_HOST_CREDS=NC_HOST_SRAY
    SOURCE_LOCATION=/tmp/newp/PDB_Backup_1428003803938
    SRC_HOST=b12.idc.example.com
     
    #-----------------------------------------#
    # DESTINATION                             #
    #-----------------------------------------#
    DEST_HOST_CREDS=NC_HOST_SRAY
    DEST_LOCATION=/scratch/sray/app3/sray/oradata/migda
    DEST_HOST=slo.us.example.com
    
    #-----------------------------------------#
    # HYBRID GATEAWAY / FORWARDER             #
    #-----------------------------------------#
    FORWARDER_HOST=slo.us.example.com
    FORWARDER_CRED=ACD_NY:SYSCO
    WORKING_DIRECTORY=/tmp
    

    Note:

    Remove the Hybrid Gateway parameters if the SSH connection exists between the source and the destination hosts.
  6. Enter the verb to import data in to the destination database: emcli dbimport -input_file=data:/u01/files/dbimport.props.

    Note:

    To clone the destination to database or pluggable database, ensure you provide the required value in the DESTINATION_TARGET_TYPE option in the properties file. For database, enter oracle_database, and for PDB enter oracle_pdb.

    Sample properties file:

    #-----------------------------------------------#
    #         DESTINATION                           #
    #-----------------------------------------------#
    DESTINATION_TARGET=SS_OPC_DB
    DESTINATION_TARGET_TYPE=oracle_database
    DATABASE_CREDENTIAL=CRED_DB:sysman
    HOST_NAMED_CREDENTIAL=CRED_HOST:sysman
     
    #-----------------------------------------------#
    #         PROFILE                               #
    #-----------------------------------------------#
    PROFILE_LOCATION=Database Provisioning Profiles/12.1.0.1.0/linux_x64/Export Dump of Sample schemas10
     
    #-----------------------------------------------#
    #         SCHEMA DETAILS                        #
    #-----------------------------------------------#
    REMAP_SCHEMA_LIST.0=HR:HR
    REMAP_SCHEMA_LIST.1=OE:OE
    REMAP_SCHEMA_LIST.2=PM:PM
    REMAP_SCHEMA_LIST.3=IX:IX
    REMAP_SCHEMA_LIST.4=SH:SH
    REMAP_SCHEMA_LIST.5=BI:BI
    REMAP_TABLESPACE_LIST.0=EXAMPLE:MYTBSP1
    REMAP_TABLESPACE_LIST.1=USERS:MYTBSP1
    REMAP_TABLESPACE_LIST.2=SYSTEM:MYTBSP1
    DEGREE_OF_PARALLELISM=1
    DUMP_FILE_LIST.0=/scratch/ae/dumpdir/samplschemas.dmp
    IMPORT_LOG_FILE_DIRECTORY=DATA_PUMP_DIR
    

15.5 Cloning from Oracle Cloud

To clone a database, schema(s), or a PDB from Oracle Cloud, refer to the following use cases:

15.5.1 Cloning a PDB from Oracle Cloud

To clone a PDB from Oracle Cloud to an on-premise PDB, you can use either of the following solutions:

15.5.1.1 Cloning a PDB from Oracle Cloud Using the Clone Wizard

To clone a PDB from Oracle Cloud to an On-Premise 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 Clone from Oracle Cloud.

    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 Clone from Oracle Cloud.

  5. On the Source and Destination: Clone from Oracle Cloud page, do the following:

    • In the Credentials section, specify the SYSDBA credentials for the source CDB, and the host 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 Definition section, specify a name, and a display name for the PDB clone. Enterprise Manager uses the display name to identify the PDB clone target.

    • In the PDB Administrator Credentials section, specify the credentials of the Admin user account that you want to use to administer the PDB clone.

    • In the Container Database section, specify the destination CDB that is deployed in the public cloud setup (the CDB that the PDB clone must be a part of).

    • In the Credentials section, specify the SYSDBA credentials for the destination CDB, and the host credentials for the destination CDB.

      Clone from Cloud simple page
  6. 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.

    To specify other configuration details, mask data, as well as schedule the cloning process, click Advanced.

    Follow the rest of the steps, if you have selected the Advanced option.

  7. On the Clone from Oracle Cloud: Source and Destination page, verify the details, and then click Next.

    Clone from Cloud source page
  8. On the Clone from Cloud: Configuration page, in the Database Files Location section, specify the storage location where the datafiles of the PDB clone must be stored.

    In the Advanced Configuration section, specify the storage limits for the maximum size of the PDB clone, and the maximum size of a shared table space 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 table spaces created within the PDB clone.

    Click Next.

    Clone from Cloud Configuration page
  9. On the Clone from Cloud: Post Processing page, 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 Creating or Editing a Data Masking Definition. 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.

    Clone from Cloud Post Processing page
  10. On the Clone from Cloud: Schedule page, specify an instance name for the cloning deployment procedure. Also, specify the point in time when you want the cloning deployment 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.

    Clone from Cloud Schedule page
  11. On the Clone from Cloud: 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 clone a PDB to a CDB that is deployed in a public cloud setup.

    Clone from Cloud Review page

15.5.1.2 Cloning a PDB from Oracle Cloud Using EM CLI

To clone a pluggable database on Oracle Cloud to an on-premise container database, enter the EM CLI verb emcli pdb_clone_management -input_file=data:/xyz/sdf/pdb_clone.props, where pdb_clone.props is the properties file which provides the cloning parameters and their values.

There are 3 methods in which you can clone a pluggable database. The difference between each of these methods is in the configuration of certain parameters in the properties file. The 3 methods and the details of the configuration parameters are explained below:

  • Operating System (OS) Image backup

    Takes a backup of the source PDB and creates a new PDB. The BACKUP_TYPE parameter should specify the type of backup. The allowed values for BACKUP_TYPE are OSIMAGE, RMAN and TAR. The EXISTING_BACKUP and EXISTING_BACKUP_METADATA parameters should not be provided.

    Sample properties file:

    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
    BACKUP_TYPE=OSIMAGE
    
  • Existing backup

    Uses an existing backup of the source PDB and creates a new PDB. The BACKUP_TYPE parameter should specify the type of backup. The allowed values for BACKUP_TYPE are OSIMAGE, RMAN and TAR. The EXISTING_BACKUP parameter should specify the location with the backup name and EXISTING_BACKUP_METADATA should specify the location and the metadata file name for the backup.

    Sample properties file:

    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
    EXISTING_BACKUP=/user1/pdbbackup/PDB1_Backup_14297779
    EXISTING_BACKUP_METADATA=/user1/pdbbackup/PDB1_Backup_14297779/PDB1.xml
    BACKUP_TYPE=RMAN
    

    Note:

    To create a PDB backup, enter the verb emcli pdb_backup -inputFile="loaction of file containing properties required for taking backup of PDB", where the sample contents of the properties file is as follows:
    TARGET_HOST_LIST=xyz.abccorp.com
    HOST_NORMAL_NAMED_CRED=XYZ_CRED:CRED_OWNER
    SRC_CDB_NAMED_CRED=CDB1_CRED:CRED_OWNER
    SRC_CDB_TARGET_NAME=CDB1
    SRC_CDB_TARGET_TYPE=oracle_database
    SRC_PDB_TARGET_NAME=CDB1_PDB1
    BACKUP_LOCATION=/user1/pdbbackup
    WORK_DIR_LOCATION=/tmp
    ORACLE_HOME_LOC=/scratch/d121hmcasm/product/12.1.0/dbhome_1
    
  • Unplug/plug

    Unplugs the source PDB and creates a new PDB at the destination using the unplugged source, and then plugs the source back. Both, EXISTING_BACKUP and BACKUP_TYPE parameters should not be provided.

    Sample properties file:

    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:

For all the 3 methods explained above, in case the destination PDB data files location is ASM then add the parameter DEST_STAGE_DIR who's value will be used as the destination while transferring the source PDB data files. This parameter is optional, if it is not provided a temporary directory will be used. For Linux systems the temporary directory is /tmp.

15.5.2 Cloning Schema(s) from Oracle Cloud to a DB or PDB

You can clone a schema that is on Oracle Cloud to on-premise either as a database or as a pluggable database using EM CLI verbs. To do so, follow the steps below:

  1. Enter the EM CLI verb emcli describe_dbprofile_input -data_mode=EXPORT. The output provides all profile creation input variables.

    Note:

    Export is supported only for database and schema whereas import is supported for both database and PDBs. This indicates that the source should always be a database or schema and the destination can either be a database or a PDB.
  2. Use the input variables to create a properties file with values for all the variables.

  3. Create the directory object SCHEMAS_DUMP_DIR.

  4. Export data from the source database by creating a database profile. To do so, enter the verb emcli create_dbprofile - input_file=data:<properties file name along with path>.

    Note:

    Use the properties file created in the previous step for this verb.

    Sample properties file:

    #-----------------------------------------------#
    # SOURCE                                        # 
    #-----------------------------------------------#
    REFERENCE_DATABASE=SS_TM_DB
    REFERENCE_DATABASE_TYPE=oracle_database
    REF_DB_CREDENTIALS=CRED_DB:sysman
    REF_HOST_CREDENTIALS=CRED_HOST:sysman
    
    #-----------------------------------------------#
    # DATA CONTENT DETAILS                          #
    #-----------------------------------------------#
    DATA_CONTENT_MODE=EXPORT
    DATA_CONTENT=METADATA_AND_DATA
     
    #-----------------------------------------------#
    # EXPORT DETAILS                                #
    #-----------------------------------------------#
    EXPORT.EXPORT_TYPE=SELECTED_SCHEMAS
    EXPORT.SCHEMA_INCLUDE_LIST.0=HR
    EXPORT.SCHEMA_INCLUDE_LIST.1=PM
    EXPORT.SCHEMA_INCLUDE_LIST.2=OE
    EXPORT.SCHEMA_INCLUDE_LIST.3=IX
    EXPORT.SCHEMA_INCLUDE_LIST.4=SH
    EXPORT.SCHEMA_INCLUDE_LIST.5=BI
    EXPORT.DEGREE_OF_PARALLELISM=1
    EXPORT.DUMP_DIRECTORY_LIST.0=directory=SCHEMAS_DUMP_DIR,file_name=samplschemas.dmp,max_size=100
    EXPORT.LOG_FILE_DIRECTORY=directory=SCHEMAS_DUMP_DIR,file_name=samplschemas.log
     
    #-----------------------------------------------#
    #         PROFILE DETAILS                       #
    #-----------------------------------------------#
    PROFILE_NAME=Export Dump of Sample schemas10
    PROFILE_VERSION=11.2.0.4.0
    PROFILE_LOCATION=Database Provisioning Profiles/12.1.0.1.0/linux_x64/
    WORKING_DIRECTORY=/tmp
    
  5. Enter the verb to transfer data: emcli data_transfer -input_file=data:/u01/files/data_trans.props.

    Sample properties file:

    #-----------------------------------------#
    # SOURCE                                  #
    #-----------------------------------------#
    SRC_HOST_CREDS=NC_HOST_SRAY
    SOURCE_LOCATION=/tmp/newp/PDB_Backup_1428003803938
    SRC_HOST=bl2.idc.example.com
     
    #-----------------------------------------#
    # DESTINATION                             #
    #-----------------------------------------#
    DEST_HOST_CREDS=NC_HOST_SRAY
    DEST_LOCATION=/scratch/sray/app3/sray/oradata/migda
    DEST_HOST=slo.us.example.com
    
    
    #-----------------------------------------#
    # HYBRID GATEAWAY / FORWARDER             #
    #-----------------------------------------#
    FORWARDER_HOST=slo.us.example.com
    FORWARDER_CRED=ACD_NY:SYSCO
    WORKING_DIRECTORY=/tmp
    

    Note:

    Remove the Hybrid Gateway parameters if the SSH connection exists between the source and the destination hosts.
  6. Enter the verb to import data in to the destination database: emcli dbimport -input_file=data:/u01/files/dbimport.props.

    Note:

    To clone the destination to database or pluggable database, ensure you provide the required value in the DESTINATION_TARGET_TYPE option in the properties file. For database, enter oracle_database, and for PDB enter oracle_pdb.

    Sample properties file:

    #-----------------------------------------------#
    #         DESTINATION                           #
    #-----------------------------------------------#
    DESTINATION_TARGET=SS_OPC_DB
    DESTINATION_TARGET_TYPE=oracle_database
    DATABASE_CREDENTIAL=CRED_DB:sysman
    HOST_NAMED_CREDENTIAL=CRED_HOST:sysman
     
    #-----------------------------------------------#
    #         PROFILE                               #
    #-----------------------------------------------#
    PROFILE_LOCATION=Database Provisioning Profiles/12.1.0.1.0/linux_x64/Export Dump of Sample schemas10
     
    #-----------------------------------------------#
    #         SCHEMA DETAILS                        #
    #-----------------------------------------------#
    REMAP_SCHEMA_LIST.0=HR:HR
    REMAP_SCHEMA_LIST.1=OE:OE
    REMAP_SCHEMA_LIST.2=PM:PM
    REMAP_SCHEMA_LIST.3=IX:IX
    REMAP_SCHEMA_LIST.4=SH:SH
    REMAP_SCHEMA_LIST.5=BI:BI
    REMAP_TABLESPACE_LIST.0=EXAMPLE:MYTBSP1
    REMAP_TABLESPACE_LIST.1=USERS:MYTBSP1
    REMAP_TABLESPACE_LIST.2=SYSTEM:MYTBSP1
    DEGREE_OF_PARALLELISM=1
    DUMP_FILE_LIST.0=/scratch/ae/dumpdir/samplschemas.dmp
    IMPORT_LOG_FILE_DIRECTORY=DATA_PUMP_DIR
    

15.5.3 Cloning a DB from Oracle Cloud to a DB or PDB

You can clone a database that is on Oracle Cloud to on-premise either as a database or as a pluggable database using EM CLI verbs. To do so, follow the steps below:

  1. Enter the EM CLI verb emcli describe_dbprofile_input -data_mode=EXPORT. The output provides all profile creation input variables.

    Note:

    Export is supported only for database and schema whereas import is supported for both database and PDBs. This indicates that the source should always be a database or schema and the destination can either be a database or a PDB.
  2. Use the input variables to create a properties file with values for all the variables.

  3. Create the directory object SCHEMAS_DUMP_DIR.

  4. Export data from the source database by creating a database profile. To do so, enter the verb emcli create_dbprofile - input_file=data:<properties file name along with path>.

    Note:

    Use the properties file created in the previous step for this verb.

    Sample properties file:

    #-----------------------------------------------#
    # SOURCE                                        #
    #-----------------------------------------------#
    REFERENCE_DATABASE=SS_TM_DB
    REFERENCE_DATABASE_TYPE=oracle_database
    REF_DB_CREDENTIALS=CRED_DB:sysman
    REF_HOST_CREDENTIALS=CRED_HOST:sysman
    
    #-----------------------------------------------#
    # DATA CONTENT DETAILS                          #
    #-----------------------------------------------#
    DATA_CONTENT_MODE=EXPORT
    DATA_CONTENT=METADATA_AND_DATA
     
    #-----------------------------------------------#
    # EXPORT DETAILS                                #
    #-----------------------------------------------#
    EXPORT.EXPORT_TYPE=FULL_DATABASE
    EXPORT.DEGREE_OF_PARALLELISM=1
    EXPORT.DUMP_DIRECTORY_LIST.0=directory=SCHEMAS_DUMP_DIR,file_name=samplschemas.dmp,max_size=100
    EXPORT.LOG_FILE_DIRECTORY=directory=SCHEMAS_DUMP_DIR,file_name=samplschemas.log
     
    #-----------------------------------------------#
    #         PROFILE DETAILS                       #
    #-----------------------------------------------#
    PROFILE_NAME=Export Dump of Sample schemas10
    PROFILE_VERSION=11.2.0.4.0
    PROFILE_LOCATION=Database Provisioning Profiles/12.1.0.1.0/linux_x64/
    WORKING_DIRECTORY=/tmp
    
  5. Enter the verb to transfer data: emcli data_transfer -input_file=data:/u01/files/data_trans.props.

    Sample properties file:

    #-----------------------------------------#
    # SOURCE                                  #
    #-----------------------------------------#
    SRC_HOST_CREDS=NC_HOST_SRAY
    SOURCE_LOCATION=/tmp/newp/PDB_Backup_1428003803938
    SRC_HOST=bl2.idc.example.com
     
    #-----------------------------------------#
    # DESTINATION                             #
    #-----------------------------------------#
    DEST_HOST_CREDS=NC_HOST_SRAY
    DEST_LOCATION=/scratch/sray/app3/sray/oradata/migda
    DEST_HOST=slo.us.example.com
    
    
    #-----------------------------------------#
    # HYBRID GATEAWAY / FORWARDER             #
    #-----------------------------------------#
    FORWARDER_HOST=slo.us.example.com
    FORWARDER_CRED=ACD_NY:SYSCO
    WORKING_DIRECTORY=/tmp
    

    Note:

    Remove the Hybrid Gateway parameters if the SSH connection exists between the source and the destination hosts.
  6. Enter the verb to import data in to the destination database: emcli dbimport -input_file=data:/u01/files/dbimport.props.

    Note:

    To clone the destination to database or pluggable database, ensure you provide the required value in the DESTINATION_TARGET_TYPE option in the properties file. For database, enter oracle_database, and for PDB enter oracle_pdb.

    Sample properties file:

    #-----------------------------------------------#
    #         DESTINATION                           #
    #-----------------------------------------------#
    DESTINATION_TARGET=SS_OPC_DB
    DESTINATION_TARGET_TYPE=oracle_database
    DATABASE_CREDENTIAL=CRED_DB:sysman
    HOST_NAMED_CREDENTIAL=CRED_HOST:sysman
     
    #-----------------------------------------------#
    #         PROFILE                               #
    #-----------------------------------------------#
    PROFILE_LOCATION=Database Provisioning Profiles/12.1.0.1.0/linux_x64/Export Dump of Sample schemas10
     
    #-----------------------------------------------#
    #         SCHEMA DETAILS                        #
    #-----------------------------------------------#
    REMAP_SCHEMA_LIST.0=HR:HR
    REMAP_SCHEMA_LIST.1=OE:OE
    REMAP_SCHEMA_LIST.2=PM:PM
    REMAP_SCHEMA_LIST.3=IX:IX
    REMAP_SCHEMA_LIST.4=SH:SH
    REMAP_SCHEMA_LIST.5=BI:BI
    REMAP_TABLESPACE_LIST.0=EXAMPLE:MYTBSP1
    REMAP_TABLESPACE_LIST.1=USERS:MYTBSP1
    REMAP_TABLESPACE_LIST.2=SYSTEM:MYTBSP1
    DEGREE_OF_PARALLELISM=1
    DUMP_FILE_LIST.0=/scratch/ae/dumpdir/samplschemas.dmp
    IMPORT_LOG_FILE_DIRECTORY=DATA_PUMP_DIR
    

15.6 Cloning Within Oracle Cloud

To clone a database or a pluggable database within Oracle Cloud, refer to the following use cases::

15.6.1 Cloning a PDB Within Oracle PaaS

To clone a pluggable database within Oracle Cloud, you can use either of the following solutions:

15.6.2 Cloning a DB Within Oracle PaaS

To clone a database within Oracle Cloud, you can use either of the following solutions: