Migrate via REST API
This topic outlines the steps required to migrate your database to Cloud via REST API. Review the following steps to migrate databases using REST-API
Perform a complete Migration Operation using Data Pump
To perform a complete Migration using the Data Pump method use the following REST request. This sample code loads data from an on-premises database into a cloud database:Note:
POST
can be used if user wants the OMS to pull the files from the Host. The Host needs to be discovered in Enterprise Manager.
Request Method
PayloadPOST
URI/em/websvcs/restful/db/migration
HeaderContent-Type: application/json
Authorization: Basic
{
"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
}
}
The Response generated will come back in the following format:{
"statusCode": 200,
"status": "SUCCESS",
"message": "....",
"submissionName": ".....",
"submissionBy": "SYSMAN",
"submissionId": "<Unique Submission ID>",
"executionId": "<Unique Execution ID>",
"uiActivityUrl": "/em/faces/core-jobs-procedureExecutionTracking?executionGUID=<Submission ID>",
"restActivityUrl": "/em/websvcs/restful/db/migration/activities/<Submission ID>"
}
At this point the database has been successfully migrated.