migrate_db

Submits deployment procedures for performing a database consolidation, using source and destination mappings defined in the XML or JSON file passed as input to the command. The file also denotes which of the following migration methods to use:

  • Data Guard Physical Standby (minimal downtime)
  • RMAN Clone
  • Data Pump (full or schema) Export and Import (cross-platform)
  • Full Transportable Export and Import (minimal downtime, cross-platform)
  • Cross Platform Incremental Backup (optimized, minimal downtime, cross-platform)

Note:

Before attempting a migration using migrate_db on Oracle databases 13.3.2.0.0 and later, make sure patch 12.1.0.2.210119 is deployed.

Format

emcli migrate_db
      -file=<XML or JSON file path>
      [-exec_mode=<execution mode>]
      [-ignore_pre_req]

[ ]  indicates that the parameter is optional.

Options

  • file

    Absolute path of the XML or JSON file containing source and destination database mapping.

  • exec_mode

    Use only when migration method is ONLINE_DATAGUARD, as follows:

    • FULL: execute all migration steps in the same job, with no user control over downtime. For example, execute the database standby, convert to RAC, and standby switchover steps in the same job.
    • PRE_DOWNTIME: execute all steps that do not require the database to be down. For example, execute the database standby and convert to RAC steps in the same job.

      When you use this mode, you must run the migration job again after successful completion of the current job, with the same input file and exec_mode option DOWNTIME.

    • DOWNTIME: execute all steps that require downtime. For example, execute the switchover step in the job.

      Using this mode presupposes that all pre-downtime steps were successfully executed in a job that specified the PRE_DOWNTIME exec_mode option.

    If exec_mode is unspecified, defaults to FULL.

  • ignore_pre_req

    Ignores all prerequisite XML validation.

Examples

Example 1

The following example deploys a procedure to perform a database migration, based on the mappings specified in the dgpredt-migrate.xml file. The job uses the Data Guard migration method in which it will execute all steps that do not require database downtime.

emcli migrate_db 
      -file="/home/migrations/dgpredt-migrate.xml"
      -exec_mode="PRE_DOWNTIME"

Example 2

The following example deploys a procedure to perform a database migration, based on the mappings specified in the dgdt-migrate.xml file. The job uses the Data Guard migration method in which it will execute all steps that require database downtime. In addition, there will be no prerequisite validation of the XML.

emcli migrate_db 
      -file="/home/migrations/dgdt-migrate.xml"
      -exec_mode="DOWNTIME"
      -ignore_pre_req

Example 3

The following example uses a valid migration XML file.

Note:

When migrating multiple databases to the same target CDB a separate storageDirectory must be passed in the XML file for each PDB.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<moveDB type="ONLINE_TTS">
    <mapping>
        <source>
            <targetName>example.source.com</targetName>
            <targetType>oracle_database</targetType>        
            <sysdbaCreds>MY_SYSDBA</sysdbaCreds>
            <dbHostCreds>MY_HOST</dbHostCreds>
            <preScript>/prescript.sql</preScript>
            <workingDirectory>/duser/predb</workingDirectory>
            <phase>prepare</phase>
            <pdbName>ORCL18C_PDB1</pdbName>
            <pdbAdminCreds>MY_PDB_CREDS</pdbAdminCreds>
        </source>

        <destination>
            <targetName>example.destination.com</targetName>        
            <targetType>oracle_database</targetType>
            <sysdbaCreds>MY_SYS</sysdbaCreds>
            <dbHostCreds>MY_HOST</dbHostCreds>
            <postScript>/postscript.sql</postScript>
            <workingDirectory>/duser/postsql</workingDirectory>
            <storageDirectory>+DATA</storageDirectory>
            <storageType>ASM_STORAGE</storageType>
            <asmCreds>MY_ASMCREDS</asmCreds>
        </destination>
    </mapping>
</moveDB>