clone_database

Clones a database.

Format

emcli clone_database
      -source_db_name="source_database_name"
      -dest_global_dbname="global_name_of_clone_database" 
      -dest_oracle_sid="clone_database_instance_name"
      [-dest_host_name="clone_host_name"]  
      [-dest_oracle_home="clone_database_oracle_home"] 
      [-source_db_creds_name="source_database_credential_name"] 
      [-source_host_creds_name="source_database_host_credential_name"] 
      [-dest_host_creds_name="clone_database_host_credential_name"]
      [-win_svc_host_creds_name="clone_database_windows_service_host_credential_name"] 
      [-asm_inst_creds_name="asm_instance_credential_name"]  
      [-dest_target_name="clone_database_name"] 
      [-clone_type="clone_type"]
      [-pitr_date="point-in-time_recovery_date"|-pitr_scn="point-in-time_recovery_system_change_number"]
      [-encryption_mode="encryption_mode_of_database_backups"]
      [-backups_encryption_creds_name="database_named_credential_for_encrypted_backups"]
      [-tape_settings="tape_settings"] 
      [-db_backups_location="source_database_backups_location"]
      [-are_backups_on_dest_host]
      [-degree_of_parallelism="number_of_parallel_channels_used_by_RMAN"]
      [-source_staging_area="source_staging_directory"]  
      [-dest_staging_area="clone_database_staging_directory"]  
      [-dest_storage_type="clone_database_storage_type"] 
      [-dest_database_area="clone_database_files_location"] 
      [-dest_recovery_area="clone_database_fast_recovery_area"] 
      [-dest_listener_selection="clone_database_listener_selection"] 
      [-dest_listener_name="clone_database_listener_name"]
      [-dest_listener_port="clone_database_listener_port"]
      [-configure_with_oracle_restart]
      [-multiplex_locs="multiplex_locations"] 
      [-job_name="job_name"] 
      [-job_desc="job_description"]
      [-src_ssh_tunnel_port="<ssh tunnel port used by clone to connect to primary>"]
      [-dest_ssh_tunnel_port="<ssh tunnel port used by primary to connect to clone>"]
      [-src_gateway_cred_name="<primary database host hybrid gateway agent credential name>"]
      [-dest_gateway_cred_name="<clone database host hybrid gateway agent credential name>"]
      [-dest_GI_host_creds_name="<clone database grid infrastructure credential name>"]
      [-tde_wallet_creds_name="<transparent data encryption wallet credentials of the source database>"]
      [-tde_wallet_location="<transparent data encryption wallet location>"]

[ ] indicates that the parameter is optional

Options

  • source_db_name

    Source database Enterprise Manager target name. Can either be a single-instance database or a cluster database.

  • dest_global_dbname

    Clone database global database name. Usually specified as <name>.<domain>, with <name> being used for the db_unique_name and <domain> for the db_domain_name options.

  • dest_oracle_sid

    Clone database instance name.

  • dest_host_name

    Clone database host name. If not specified, the clone database is created on the same host as the source database.

  • dest_oracle_home

    Clone database Oracle home. If not specified, the Oracle home of the source database is used.

  • source_db_creds_name

    Source database named credential.

  • source_host_creds_name

    Source database host named credential.

  • dest_host_creds_name

    Destination (clone) host named credential.

  • win_svc_host_creds_name

    Windows host credentials of the Oracle Home user account under which the database services are configured.

  • asm_inst_creds_name

    Automatic Storage Management (ASM) named credential. Supported credential types are SYSDBA and SYSASM.

  • dest_target_name

    Clone database Enterprise Manager target name.

  • clone_type

    Type of source database backup that will be used for cloning. Valid values are:

    • DUPLICATE — Database files are moved directly to the clone database host by the Recovery Manager (RMAN).

    • STAGING — Database files are backed-up into the staging area and moved to the clone database host through HTTP.

    • EXISTING_BACKUP — Database files are restored from existing backups to the clone database host by RMAN.

  • pitr_date

    Clone database as of the specified date in MM/dd/yyyy hh:mm:a (Month/Date/Year Hours:Minutes:AM/PM marker) format. For example: 03/22/2014 08:25:AM. If not specified, the clone database is created as of the latest point-in-time. This option is applicable when the clone_type is EXISTING_BACKUP. Option pitr_date and pitr_scn cannot be used simultaneously. Only one of the two can be specified.

  • pitr_scn

    Clone database as of the specified System Change Number (SCN) of the source database. If not specified, the clone database is created as of the latest point-in-time. This option is applicable when the clone_type is EXISTING_BACKUP. Option pitr_date and pitr_scn cannot be used simultaneously. Only one of the two can be specified.

  • encryption_mode

    Encryption mode of the existing source database backups. If not specified, the default value is NONE. This option is applicable when the clone_type is EXISTING_BACKUP. Valid values are:

    • WALLET — Backups are encrypted using Oracle Encryption Wallet.

    • PASSWORD — Backups are encrypted using a password.

    • DUAL — Backups are encrypted using both Oracle Encryption Wallet and a password.

  • backups_encryption_creds_name

    Database named credential for the encrypted backups. This option is applicable if encryption_mode is PASSWORD or DUAL.

    Note:

    this option is applicable only if the clone type is EXISTING_BACKUP and the database backups are encrypted using a password. This database credential should be created in Enterprise Manager of scope GLOBAL with the user name specified as "backup_admin".

  • tape_settings

    Media management vendor settings if the database backups are on tape. This option is applicable when clone_type is EXISTING_BACKUP.

  • db_backups_location

    The location of the backups to be transferred to the destination host. Multiple values can be specified using "," as a delimiter. This option is applicable when cloning to a different host and clone_type is EXISTING_BACKUP.

    Note:

    this option is applicable only if the clone type is EXISTING_BACKUP and the database clone occurs on a different host where the source database backups are not visible. If the backups are visible from the destination host, this option should NOT be specified.

    • It is recommended that if the size of the database backups is very large, the backups should be taken in a common location visible from the destination host.

    • If the source database backups are on ASM diskgroups, ensure that the diskgroups are mounted at the destination host as these backups are not transferred.

    • When you specify this option is specified, all of the available files at this location are transferred to a temporary staging location at the destination host.

    • You can specify multiple values for this option with comma (,) as a delimiter.

  • are_backups_on_dest_host

    Indicates that the source database backups are already available on the destination host. This option is applicable when clone_type is EXISTING_BACKUP and db_backups_location is specified.

  • degree_of_parallelism

    Number of parallel channels used by RMAN to copy the database files. The specified value is considered only when the -clone_type is DUPLICATE.

  • source_staging_area

    Staging area used to store the backup of source database. This option is applicable when clone_type is STAGING.

  • dest_staging_area

    Staging area used to store backup files transferred from source host. This option is applicable when clone_type is STAGING.

  • dest_storage_type

    Clone database storage type. Valid values are:

    • FILE_SYSTEM — Clone database files will be in a regular file system (using Oracle-managed Files).

    • ASM — The clone database will use Automatic Storage Management (ASM).

  • dest_database_area

    Oracle-managed files (OMF) location for clone database files. This can be a regular file system (if storage_type is FILE_SYSTEM) or an ASM disk group (if storage_type is ASM). If not specified, a default value is used.

  • dest_recovery_area

    Fast recovery area location. If not specified, a default value is used.

  • dest_listener_selection

    Clone database listener selection. Valid values are:

    • GRID_INFRA — Use Grid Infrastructure Home listener.

    • DEST_DB_HOME — Use the listener from the clone database Oracle home.

  • dest_listener_name

    Clone database listener name. This option is applicable only if dest_listener_selection is DEST_DB_HOME. If not specified, the first existing TCP listener found in the clone database Oracle home is used. If you specify this option, you must also specify dest_listener_port.

  • dest_listener_port

    Clone database listener port. This option is applicable only if dest_listener_selection is DEST_DB_HOME. If you specify this option, you must also specify dest_listener_name.

  • configure_with_oracle_restart

    Configure the clone database with Oracle Restart if the clone host has Oracle Restart configured. Oracle Restart automatically starts the database when required.

  • multiplex_locs

    Multiplex locations for the redo logs and control files. A maximum of five comma-separated locations can be specified.

  • job_name

    Unique job name for the clone job in the Enterprise Manager repository.

  • job_desc

    Job description.

  • src_ssh_tunnel_port

    SSH Tunnel port used by the clone database to connect to the primary database. This is the port created on the clone host to forward the connection request to the primary database listener port.

  • dest_ssh_tunnel_port

    SSH Tunnel port used by the primary database to connect to the clone database. This is the port created on the primary host to forward the connection request to the clone database listener port.

  • src_gateway_creds_name

    Hybrid Gateway Agent named credential for the primary database host.

  • dest_gateway_creds_name

    Hybrid Gateway Agent named credential for the clone database host.

  • dest_GI_host_creds_name

    Grid Infrastructure named credentials for an operating system user who can access the grid infrastructure Oracle home.

  • tde_wallet_creds_name

    Transparent Data Encryption wallet credentials for the source database. Use create_named_credential verb to create these credentials as shown below:
    emcli create_named_credential
    	-cred_name=WC1 -cred_type=GenericPassword
    	-auth_target_type='<system>'
    	-attributes="GENERIC_PASSWORD:<Source Database TDE Wallet Password>"
  • tde_wallet_location

    Transparent Data Encryption wallet location.

    For Oracle Database versions 18c and higher: The specified path is set as the value for the WALLET_ROOT parameter in the SQLNET.ORA network configuration file of clone database. A directory structure is created under the path specified to store the TDE wallet.

    For Oracle Database versions lower than 18c: The specified path is set in the SQLNET.ENCRYPTION_WALLET_LOCATION parameter in the clone database Oracle home. Since all databases running from the clone database Oracle home share this setting, the use of $ORACLE_UNQNAME in the path is recommended to ensure that each database is configured with a unique wallet. This value is automatically configured in the environment when the database is started.

Examples

Example 1

The following command uses RMAN duplicate to clone the database using the first existing TCP listener found in the clone database Oracle home.

emcli clone_database 
	-source_db_name="database" 
	-dest_target_name="dbClone1" 
	-dest_host_name="host1" 
	-dest_oracle_home="/u01/app/oracle/product/12.2.0/dbhome_1" 
	-dest_oracle_sid="dbClone1" 
	-dest_global_dbname="dbClone1" 
	-dest_listener_selection="DEST_DB_HOME" 
	-clone_type="DUPLICATE" 
	-dest_storage_type="FILE_SYSTEM" 

Example 2

The following command creates a clone database from an existing backup of the source database from the database backups location specified.

emcli clone_database 
	-source_db_name="database" 
	-source_db_creds_name="NC_DBCREDS1" 
	-source_host_creds_name="NC_HOST_CREDS1" 
	-dest_host_name="host1" 
	-dest_host_creds_name="NC_HOST_CREDS2" 
	-dest_oracle_home="/u01/app/oracle/product/11.2.0/dbhome_2" 
	-dest_oracle_sid="TESTDB1" 
	-dest_global_dbname="TESTDB1" 
	-dest_listener_selection="GRID_INFRA" 
	-clone_type="EXISTING_BACKUP" 
	-dest_storage_type="FILE_SYSTEM" 
	-db_backups_location="/oracle/dir1"

Example 3

The following command creates a clone database on the Cloud host 'cloudhost.oracle.com' for a source database that is encrypted with TDE. Communication between the source and clone databases will be established using the specified tunnel port. This uses 4 parallel RMAN channels to copy the database files.

emcli clone_database 
	-source_db_name="database"
	-source_db_creds_name="NC_DBCREDS1"
	-source_host_creds_name="NC_HOST_CREDS1"
	-dest_host_name="cloudhost.oracle.com"
	-dest_host_creds_name="OPC_SSH_NAMED_CREDS"
	-dest_oracle_home="/u01/app/oracle/product/12.1.0/dbhome_2"
	-dest_oracle_sid="TESTDB2"
	-dest_global_dbname="TESTDB2"
	-dest_listener_selection="GRID_INFRA"
	-clone_type="DUPLICATE"
	-degree_of_parallelism="4"
	-dest_storage_type="FILE_SYSTEM"
	-dest_gateway_creds_name="DEST_GATEWAY_CREDS"
	-dest_GI_host_creds_name="DEST_GRID_CREDS"
	-src_ssh_tunnel_port="4001"
	-dest_ssh_tunnel_port="4001"
	-configure_with_oracle_restart
	-tde_wallet_creds_name="WC1"

Example 4

The following command uses RMAN duplicate to clone the database with multiplex locations for the redo logs and control files.

emcli clone_database 
	-source_db_name="database" 
	-dest_target_name="dbClone1"
	-dest_host_name="host1"
	-dest_oracle_home="/u01/app/oracle/product/11.2.0/dbhome_2" 
	-dest_oracle_sid="dbClone1"
	-dest_global_dbname="dbClone1"
	-dest_listener_selection="DEST_DB_HOME"
	-clone_type="DUPLICATE"
	-dest_storage_type="FILE_SYSTEM"
	-multiplex_locs="/u01/app/oracle/oradata/dbClone1/loc1,
			    /u01/app/oracle/oradata/dbClone1/loc2,
			    /u01/app/oracle/fast_recovery_area/dbClone1/loc3,
			    /u01/app/oracle/oradata/dbclone1/loc4,
			    /u01/app/oracle/fast_recovery_area/dbclone1/loc5"