Migrate via EM CLI

Databases can also be migrated to the cloud via EM CLI.

Customers can use the EM CLI verb migrate_db for migrations to Oracle Autonomous Cloud Database Destinations. For Migration Workbench migrations the migrate_db verb uses a JSON file.

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.
To migrate using EM CLI use the following command:
emcli migrate_db 
-file="/home/migrations/DB_Migration.JSON"
Where the file DB_Migration.JSON contains the following parameters:
{
    "action": "MIGRATE",
    "options": "SPA",
    "type": "DATAPUMP"
    "proxy":{  --> Required if you have a proxy connection setup
        "host":"<proxy-host>",
        "port":"<proxy-port>"
    },

    "source":[{
        "databaseInfo":{
                "targetName":"<db-pdb-target-name>",
                "targetType":"<db-pdb-target-type>",
                "dbCredName":"<db-cred-name:em-cred-owner>", --> If not provided, preferred credentials will be used
                "hostCredName":"<host-cred-name:em-cred-owner>" --> If not provided, preferred credentials will be used
        },

        "export":{
            "args":{
                    "LOGTIME":"ALL",
                    "METRICS":"YES",
                    "COMPRESSION":"ALL",
                    "COMPRESSION_ALGORITHM":"MEDIUM",
                    "KEEP_MASTER":"YES",
                    "PARALLEL":"1",
                    "directory":"<dump directory name>",
                    "EXCLUDE":"index,cluster,indextype,materialized_view,materialized_view_log,materialized_zonemap,db_link",
                    "ENCRYPTION":"ALL",
                    "ENCRYPTION_PASSWORD":"<Encryption Password>",
                    "ENCRYPTION_ALGORITHM":"AES128"
            }
        }
    }],

    "storage":{
        "type":"OBJECTSTORE"
        "useProxy": <boolean, true/false> --> If true, the proxy from main section will be used to upload objects to OCI Object store
        "objectstore":{ 
            "credName":".."
            "baseUrl":"..",          
            "bucketName":".."
        },
  },
    "destination":[{
		"useProxy": <boolean, true/false> --> If true, the proxy from main section will be used to connect to ADB
        "databaseInfo":{
             "targetName":"<adb-target-name>",
             "targetType":"<adb-target-type>",
             "dbCredName":"<db-cred-name:em-cred-owner>", --> If not provided, preferred credentials will be used
             "hostCredName":"<adb monitoring host-cred-name:em-cred-owner>" --> If not provided, preferred credentials will be used
        },

        import": {
        "args": {
          "TABLE_EXISTS_ACTION": "SKIP",
          "PARALLEL": "6",
          "TRANSFORM": "SEGMENT_ATTRIBUTES:N,DWCS_CVT_IOTS:Y,CONSTRAINT_USE_DEFAULT_INDEX:Y",
          "REMAP_TABLESPACE" : "<source_tablespace:target_tablespace> [, <source_tablespace:target_tablespace>, ...]"
          "NOLOGFILE": "YES",
          "DIRECTORY": "DATA_PUMP_DIR"
        },
        "dbOciAuthCred": "<cloud-cred-name:cloud-cred-owner>"
      },
      "tnsName": "<adb-service-name>",
      "recomplieInvalidObjects": <true|false>, -->After migration recompiles all invalid objects within the migrated schemas
    }],
	
   "analyzePerformance": --optional
    {
        "useSPA": true/false,
        "createSTS": true/false,
        "usePreferredSTS”:  true/false -->optional
        "stsName": "stsname01" -->optional
        "stsOwner": "stsOwnedSchema" -->optional
        "stsOwner": "EXPUSER" -->optional
        "baselineDurationDays": 7 -->optional, set duration for SPA to analyze
    }
}

For more information on migrate_db and the accepted parameters required for migration, see: migrate_db in Oracle Enterprise Manager Command Line Interface .