Skip to main content

migration_jobs

Creates, updates, deletes, gets or lists a migration_jobs resource.

Overview

Namemigration_jobs
TypeResource
Idgoogle.datamigration.migration_jobs

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringThe name (URI) of this migration job resource, in the form of: projects/{project}/locations/{location}/migrationJobs/{migrationJob}.
cmekKeyNamestringThe CMEK (customer-managed encryption key) fully qualified key name used for the migration job. This field supports all migration jobs types except for: * Mysql to Mysql (use the cmek field in the cloudsql connection profile instead). * PostrgeSQL to PostgreSQL (use the cmek field in the cloudsql connection profile instead). * PostgreSQL to AlloyDB (use the kms_key_name field in the alloydb connection profile instead). Each Cloud CMEK key has the following format: projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME]
conversionWorkspaceobjectThe conversion workspace used by the migration. (id: ConversionWorkspaceInfo)
createTimestring (google-datetime)Output only. The timestamp when the migration job resource was created. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".
destinationstringRequired. The resource name (URI) of the destination connection profile.
destinationDatabaseobjectThe database engine type and provider of the destination. (id: DatabaseType)
displayNamestringThe migration job display name.
dumpFlagsobjectThe initial dump flags. This field and the "dump_path" field are mutually exclusive. (id: DumpFlags)
dumpPathstringThe path to the dump file in Google Cloud Storage, in the format: (gs://[BUCKET_NAME]/[OBJECT_NAME]). This field and the "dump_flags" field are mutually exclusive.
dumpTypestringOptional. The type of the data dump. Supported for MySQL to CloudSQL for MySQL migrations only.
durationstring (google-duration)Output only. The duration of the migration job (in seconds). A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".
endTimestring (google-datetime)Output only. If the migration job is completed, the time when it was completed.
errorobjectOutput only. The error details in case of state FAILED. (id: Status)
filterstringThis field can be used to select the entities to migrate as part of the migration job. It uses AIP-160 notation to select a subset of the entities configured on the associated conversion-workspace. This field should not be set on migration-jobs that are not associated with a conversion workspace.
labelsobjectThe resource labels for migration job to use to annotate any related underlying resources such as Compute Engine VMs. An object containing a list of "key": "value" pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
objectsConfigobjectOptional. The objects that need to be migrated. (id: MigrationJobObjectsConfig)
oracleToPostgresConfigobjectConfiguration for heterogeneous Oracle to Cloud SQL for PostgreSQL and Oracle to AlloyDB for PostgreSQL migrations. (id: OracleToPostgresConfig)
performanceConfigobjectOptional. Data dump parallelism settings used by the migration. (id: PerformanceConfig)
phasestringOutput only. The current migration job phase.
reverseSshConnectivityobjectThe details needed to communicate to the source over Reverse SSH tunnel connectivity. (id: ReverseSshConnectivity)
satisfiesPzibooleanOutput only. Reserved for future use.
satisfiesPzsbooleanOutput only. Reserved for future use.
sourcestringRequired. The resource name (URI) of the source connection profile.
sourceDatabaseobjectThe database engine type and provider of the source. (id: DatabaseType)
sqlserverHomogeneousMigrationJobConfigobjectOptional. Configuration for SQL Server homogeneous migration. (id: SqlServerHomogeneousMigrationJobConfig)
sqlserverToPostgresConfigobjectConfiguration for heterogeneous SQL Server to Cloud SQL for PostgreSQL migrations. (id: SqlServerToPostgresConfig)
statestringThe current migration job state.
staticIpConnectivityobjectstatic ip connectivity data (default, no additional details needed). (id: StaticIpConnectivity)
typestringRequired. The migration job type.
updateTimestring (google-datetime)Output only. The timestamp when the migration job resource was last updated. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".
vpcPeeringConnectivityobjectThe details of the VPC network that the source database is located in. (id: VpcPeeringConnectivity)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, migrationJobsIdGets details of a single migration job.
listselectprojectsId, locationsIdpageSize, pageToken, filter, orderByLists migration jobs in a given project and location.
createinsertprojectsId, locationsIdmigrationJobId, requestIdCreates a new migration job in a given project and location.
patchupdateprojectsId, locationsId, migrationJobsIdupdateMask, requestIdUpdates the parameters of a single migration job.
deletedeleteprojectsId, locationsId, migrationJobsIdrequestId, forceDeletes a single migration job.
startexecprojectsId, locationsId, migrationJobsIdStart an already created migration job.
stopexecprojectsId, locationsId, migrationJobsIdStops a running migration job.
resumeexecprojectsId, locationsId, migrationJobsIdResume a migration job that is currently stopped and is resumable (was stopped during CDC phase).
promoteexecprojectsId, locationsId, migrationJobsIdPromote a migration job, stopping replication to the destination and promoting the destination to be a standalone database.
demote_destinationexecprojectsId, locationsId, migrationJobsIdDemotes the destination database to become a read replica of the source. This is applicable for the following migrations: 1. MySQL to Cloud SQL for MySQL 2. PostgreSQL to Cloud SQL for PostgreSQL 3. PostgreSQL to AlloyDB for PostgreSQL.
verifyexecprojectsId, locationsId, migrationJobsIdVerify a migration job, making sure the destination can reach the source and that all configuration and prerequisites are met.
restartexecprojectsId, locationsId, migrationJobsIdRestart a stopped or failed migration job, resetting the destination instance to its original state and starting the migration process from scratch.
generate_ssh_scriptexecprojectsId, locationsId, migrationJobsIdGenerate a SSH configuration script to configure the reverse SSH connectivity.
generate_tcp_proxy_scriptexecprojectsId, locationsId, migrationJobsIdGenerate a TCP Proxy configuration script to configure a cloud-hosted VM running a TCP Proxy.
fetch_source_objectsexecprojectsId, locationsId, migrationJobsIdRetrieves objects from the source database that can be selected for data migration. This is applicable for the following migrations: 1. PostgreSQL to Cloud SQL for PostgreSQL 2. PostgreSQL to AlloyDB for PostgreSQL.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
locationsIdstring
migrationJobsIdstring
projectsIdstring
filterstring
forceboolean
migrationJobIdstring
orderBystring
pageSizeinteger (int32)
pageTokenstring
requestIdstring
updateMaskstring (google-fieldmask)

SELECT examples

Gets details of a single migration job.

SELECT
name,
cmekKeyName,
conversionWorkspace,
createTime,
destination,
destinationDatabase,
displayName,
dumpFlags,
dumpPath,
dumpType,
duration,
endTime,
error,
filter,
labels,
objectsConfig,
oracleToPostgresConfig,
performanceConfig,
phase,
reverseSshConnectivity,
satisfiesPzi,
satisfiesPzs,
source,
sourceDatabase,
sqlserverHomogeneousMigrationJobConfig,
sqlserverToPostgresConfig,
state,
staticIpConnectivity,
type,
updateTime,
vpcPeeringConnectivity
FROM google.datamigration.migration_jobs
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND migrationJobsId = '{{ migrationJobsId }}' -- required;

INSERT examples

Creates a new migration job in a given project and location.

INSERT INTO google.datamigration.migration_jobs (
data__name,
data__labels,
data__displayName,
data__state,
data__type,
data__dumpPath,
data__dumpFlags,
data__source,
data__destination,
data__reverseSshConnectivity,
data__vpcPeeringConnectivity,
data__staticIpConnectivity,
data__sourceDatabase,
data__destinationDatabase,
data__conversionWorkspace,
data__filter,
data__cmekKeyName,
data__performanceConfig,
data__sqlserverHomogeneousMigrationJobConfig,
data__dumpType,
data__oracleToPostgresConfig,
data__sqlserverToPostgresConfig,
data__objectsConfig,
projectsId,
locationsId,
migrationJobId,
requestId
)
SELECT
'{{ name }}',
'{{ labels }}',
'{{ displayName }}',
'{{ state }}',
'{{ type }}',
'{{ dumpPath }}',
'{{ dumpFlags }}',
'{{ source }}',
'{{ destination }}',
'{{ reverseSshConnectivity }}',
'{{ vpcPeeringConnectivity }}',
'{{ staticIpConnectivity }}',
'{{ sourceDatabase }}',
'{{ destinationDatabase }}',
'{{ conversionWorkspace }}',
'{{ filter }}',
'{{ cmekKeyName }}',
'{{ performanceConfig }}',
'{{ sqlserverHomogeneousMigrationJobConfig }}',
'{{ dumpType }}',
'{{ oracleToPostgresConfig }}',
'{{ sqlserverToPostgresConfig }}',
'{{ objectsConfig }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ migrationJobId }}',
'{{ requestId }}'
RETURNING
name,
done,
error,
metadata,
response
;

UPDATE examples

Updates the parameters of a single migration job.

UPDATE google.datamigration.migration_jobs
SET
data__name = '{{ name }}',
data__labels = '{{ labels }}',
data__displayName = '{{ displayName }}',
data__state = '{{ state }}',
data__type = '{{ type }}',
data__dumpPath = '{{ dumpPath }}',
data__dumpFlags = '{{ dumpFlags }}',
data__source = '{{ source }}',
data__destination = '{{ destination }}',
data__reverseSshConnectivity = '{{ reverseSshConnectivity }}',
data__vpcPeeringConnectivity = '{{ vpcPeeringConnectivity }}',
data__staticIpConnectivity = '{{ staticIpConnectivity }}',
data__sourceDatabase = '{{ sourceDatabase }}',
data__destinationDatabase = '{{ destinationDatabase }}',
data__conversionWorkspace = '{{ conversionWorkspace }}',
data__filter = '{{ filter }}',
data__cmekKeyName = '{{ cmekKeyName }}',
data__performanceConfig = '{{ performanceConfig }}',
data__sqlserverHomogeneousMigrationJobConfig = '{{ sqlserverHomogeneousMigrationJobConfig }}',
data__dumpType = '{{ dumpType }}',
data__oracleToPostgresConfig = '{{ oracleToPostgresConfig }}',
data__sqlserverToPostgresConfig = '{{ sqlserverToPostgresConfig }}',
data__objectsConfig = '{{ objectsConfig }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND migrationJobsId = '{{ migrationJobsId }}' --required
AND updateMask = '{{ updateMask}}'
AND requestId = '{{ requestId}}'
RETURNING
name,
done,
error,
metadata,
response;

DELETE examples

Deletes a single migration job.

DELETE FROM google.datamigration.migration_jobs
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND migrationJobsId = '{{ migrationJobsId }}' --required
AND requestId = '{{ requestId }}'
AND force = '{{ force }}';

Lifecycle Methods

Start an already created migration job.

EXEC google.datamigration.migration_jobs.start 
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@migrationJobsId='{{ migrationJobsId }}' --required
@@json=
'{
"skipValidation": {{ skipValidation }}
}';