gcloud database-migration migration-jobs create Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud database-migration migration-jobs create - create a Database Migration Service migration job
- SYNOPSIS
gcloud database-migration migration-jobs create(MIGRATION_JOB:--region=REGION)--destination=DESTINATION--source=SOURCE--type=TYPE[--no-async][--commit-id=COMMIT_ID][--conversion-workspace=CONVERSION_WORKSPACE][--display-name=DISPLAY_NAME][--dump-parallel-level=DUMP_PARALLEL_LEVEL][--dump-type=DUMP_TYPE][--filter=FILTER][--labels=[KEY=VALUE,…]][--all-databases|--databases-filter=databaseName,[…]][--cmek-key=CMEK_KEY:--cmek-keyring=CMEK_KEYRING--cmek-project=CMEK_PROJECT][--dump-flags=[KEY=VALUE,…] |--dump-path=DUMP_PATH][--max-concurrent-cdc-connections=MAX_CONCURRENT_CDC_CONNECTIONS--max-concurrent-full-dump-connections=MAX_CONCURRENT_FULL_DUMP_CONNECTIONS--skip-full-dump--oracle-cdc-start-position=ORACLE_CDC_START_POSITION|--sqlserver-cdc-start-position=SQLSERVER_CDC_START_POSITION--max-concurrent-destination-connections=MAX_CONCURRENT_DESTINATION_CONNECTIONS--transaction-timeout=TRANSACTION_TIMEOUT][--peer-vpc=PEER_VPC|--static-ip| [--vm-ip=VM_IP--vm-port=VM_PORT--vpc=VPC:--vm=VM]][--sqlserver-databases=databaseName,[…] :--sqlserver-diff-backup--sqlserver-encrypted-databases=SQLSERVER_ENCRYPTED_DATABASES--sqlserver-promote-when-ready][GCLOUD_WIDE_FLAG …]
- DESCRIPTION
- Create a Database Migration Service migration job. Recommended steps beforecreating the migration job:
- Create a source connection profile. See prerequisiteshere.
- Create a destination connection profile. For migrating to Cloud SQL for MySQL orCloud SQL for PostgreSQL, use the cloudsql connection profile for DMS to createthe CloudSQL replica for you.
- Configure the connectivity method. See prerequisiteshere.
- [Heterogeneous migrations only] Create a conversion workspace.
- EXAMPLES
- To create a continuous migration job with IP allowlist connectivity:
gclouddatabase-migrationmigration-jobscreatemy-migration-job--region=us-central1--type=CONTINUOUS--source=cp1--destination=cp2To create a continuous migration job with VPC peering connectivity:
gclouddatabase-migrationmigration-jobscreatemy-migration-job--region=us-central1--type=CONTINUOUS--source=cp1--destination=cp2--peer-vpc=projects/my-project/global/networks/my-networkTo create a one-time migration job with reverse-SSH tunnel connectivity:
gclouddatabase-migrationmigration-jobscreatemy-migration-job--region=us-central1--type=ONE_TIME--source=cp1--destination=cp2--vm=vm1--vm-ip=1.1.1.1--vm-port=1111--vpc=projects/my-project/global/networks/my-networkTo create a heterogeneous continuous migration job:
gclouddatabase-migrationmigration-jobscreatemy-migration-job--region=us-central1--type=CONTINUOUS--source=cp1--destination=cp2--conversion-workspace=cwTo create a continuous SQL Server to SQL Server homogeneous migration job withdifferential backup enabled:
gclouddatabase-migrationmigration-jobscreatemy-migration-job--region=us-central1--type=CONTINUOUS--source=cp1--destination=cp2--sqlserver-diff-backup--sqlserver-databases=db1,db2,db3To create a continuous SQL Server to SQL Server homogeneous migration job withencrypted databases:
gclouddatabase-migrationmigration-jobscreatemy-migration-job--region=us-central1--type=CONTINUOUS--source=cp1--destination=cp2--sqlserver-databases=db1,db2,db3--sqlserver-encrypted-databases=PATH/TO/ENCRYPTION/SETTINGS - POSITIONAL ARGUMENTS
- Migration job resource - The migration job to create. The arguments in thisgroup can be used to specify the attributes of this resource. (NOTE) Someattributes are not given arguments in this group but can be set in other ways.
To set the
projectattribute:- provide the argument
migration_jobon the command line with a fullyspecified name; - provide the argument
--projecton the command line; - set the property
core/project.
This must be specified.
MIGRATION_JOB- ID of the migration_job or fully qualified identifier for the migration_job.
To set the
migration_jobattribute:- provide the argument
migration_jobon the command line.
This positional argument must be specified if any of the other arguments in thisgroup are specified.
- provide the argument
--region=REGION- The Cloud region for the migration_job.
To set the
regionattribute:- provide the argument
migration_jobon the command line with a fullyspecified name; - provide the argument
--regionon the command line.
- provide the argument
- provide the argument
- Migration job resource - The migration job to create. The arguments in thisgroup can be used to specify the attributes of this resource. (NOTE) Someattributes are not given arguments in this group but can be set in other ways.
- REQUIRED FLAGS
- Connection profile resource - ID of the destination connection profile,representing the destination database. This represents a Cloud resource. (NOTE)Some attributes are not given arguments in this group but can be set in otherways.
To set the
projectattribute:- provide the argument
--destinationon the command line with a fullyspecified name; - provide the argument
--projecton the command line; - set the property
core/project.
To set the
regionattribute:- provide the argument
--destinationon the command line with a fullyspecified name; - provide the argument
--regionon the command line.
This must be specified.
--destination=DESTINATION- ID of the connection_profile or fully qualified identifier for theconnection_profile.
To set the
connection_profileattribute:- provide the argument
--destinationon the command line.
- provide the argument
- provide the argument
- Connection profile resource - ID of the source connection profile, representingthe source database. This represents a Cloud resource. (NOTE) Some attributesare not given arguments in this group but can be set in other ways.
To set the
projectattribute:- provide the argument
--sourceon the command line with a fullyspecified name; - provide the argument
--projecton the command line; - set the property
core/project.
To set the
regionattribute:- provide the argument
--sourceon the command line with a fullyspecified name; - provide the argument
--regionon the command line.
This must be specified.
--source=SOURCE- ID of the connection_profile or fully qualified identifier for theconnection_profile.
To set the
connection_profileattribute:- provide the argument
--sourceon the command line.
- provide the argument
- provide the argument
--type=TYPE- Type of the migration job.
TYPEmust be one of:ONE_TIME,CONTINUOUS.
- Connection profile resource - ID of the destination connection profile,representing the destination database. This represents a Cloud resource. (NOTE)Some attributes are not given arguments in this group but can be set in otherways.
- OPTIONAL FLAGS
--no-async- Waits for the operation in progress to complete before returning.
--commit-id=COMMIT_ID- Commit id for the conversion workspace to use for creating the migration job. Ifnot specified, the latest commit id will be used by default.
- Conversion workspace resource - Name of the conversion workspaces to be used forthe migration job This represents a Cloud resource. (NOTE) Some attributes arenot given arguments in this group but can be set in other ways.
To set the
projectattribute:- provide the argument
--conversion-workspaceon the command linewith a fully specified name; - provide the argument
--projecton the command line; - set the property
core/project.
To set the
regionattribute:- provide the argument
--conversion-workspaceon the command linewith a fully specified name; - provide the argument
--regionon the command line.
--conversion-workspace=CONVERSION_WORKSPACE- ID of the conversion_workspace or fully qualified identifier for theconversion_workspace.
To set the
conversion_workspaceattribute:- provide the argument
--conversion-workspaceon the command line.
- provide the argument
- provide the argument
--display-name=DISPLAY_NAME- A user-friendly name for the migration job. The display name can includeletters, numbers, spaces, and hyphens, and must start with a letter.
--dump-parallel-level=DUMP_PARALLEL_LEVEL- Parallelization level during initial dump of the migration job. If notspecified, will be defaulted to OPTIMAL.
DUMP_PARALLEL_LEVELmust be one of:MIN,OPTIMAL,MAX. --dump-type=DUMP_TYPE- The type of the data dump. Currently applicable for MySQL to MySQL migrationsonly.
DUMP_TYPEmust be one of:LOGICAL,PHYSICAL. --filter=FILTER- Filter the entities based onAIP-160standard. Example: to filter all tables whose name start with "Employee" and arepresent under schema "Company", use filter as "Company.Employee
*AND type=TABLE" --labels=[KEY=VALUE,…]- List of label KEY=VALUE pairs to add.
Keys must start with a lowercase character and contain only hyphens(
-), underscores (_), lowercase characters, andnumbers. Values must contain only hyphens (-), underscores(_), lowercase characters, and numbers. - The migration job objects config.
- The migration job objects config for databases.
At most one of these can be specified:
--all-databases- Migrate all databases for the migration job. This flag is used only for Postgresto AlloyDB migrations and Postgres to Cloud SQL Postgres migrations.
--databases-filter=databaseName,[…]- A list of databases to be migrated to the destination instance. Providedatabases as a comma separated list. This flag is used only for Postgres toAlloyDB migrations and Postgres to Cloud SQL Postgres migrations.
- The migration job objects config for databases.
- Cmek key resource - Name of the CMEK (customer-managed encryption key) used forthe migration job The arguments in this group can be used to specify theattributes of this resource. (NOTE) Some attributes are not given arguments inthis group but can be set in other ways.
To set the
regionattribute:- provide the argument
--cmek-keyon the command line with a fullyspecified name; - provide the argument
--regionon the command line.
--cmek-key=CMEK_KEY- ID of the cmek-key or fully qualified identifier for the cmek-key.
To set the
cmek-keyattribute:- provide the argument
--cmek-keyon the command line.
This flag argument must be specified if any of the other arguments in this groupare specified.
- provide the argument
--cmek-keyring=CMEK_KEYRING- The CMEK keyring id of the cmek-key.
To set the
cmek-keyringattribute:- provide the argument
--cmek-keyon the command line with a fullyspecified name; - provide the argument
--cmek-keyringon the command line.
- provide the argument
--cmek-project=CMEK_PROJECT- The Cloud project id for the cmek-key.
To set the
cmek-projectattribute:- provide the argument
--cmek-keyon the command line with a fullyspecified name; - provide the argument
--cmek-projecton the command line.
- provide the argument
- provide the argument
- At most one of these can be specified:
--dump-flags=[KEY=VALUE,…]- A list of dump flags. An object containing a list of "key": "value" pairs.
--dump-path=DUMP_PATH- Path to the dump file in Google Cloud Storage, in the format:
gs://[BUCKET_NAME]/[OBJECT_NAME].
- The heterogeneous migration config. This is used only for Oracle to Cloud SQLfor PostgreSQL and SQL Server to Cloud SQL for PostgreSQL migrations.
- Configuration for Oracle or SQL Server as a source in a heterogeneous migration.
--max-concurrent-cdc-connections=MAX_CONCURRENT_CDC_CONNECTIONS- Maximum number of connections Database Migration Service will open to the sourcefor CDC phase.
--max-concurrent-full-dump-connections=MAX_CONCURRENT_FULL_DUMP_CONNECTIONS- Maximum number of connections Database Migration Service will open to the sourcefor full dump phase.
- Configuration for skipping full dump.
--skip-full-dump- Whether to skip full dump or not.
- Configuration for CDC start position.
At most one of these can be specified:
--oracle-cdc-start-position=ORACLE_CDC_START_POSITION- Oracle schema change number (SCN) to start CDC data migration from.
--sqlserver-cdc-start-position=SQLSERVER_CDC_START_POSITION- Sqlserver log squence number (LSN) to start CDC data migration from.
- Configuration for Postgres as a destination in a heterogeneous migration.
--max-concurrent-destination-connections=MAX_CONCURRENT_DESTINATION_CONNECTIONS- Maximum number of concurrent connections Database Migration Service will open tothe destination for data migration.
--transaction-timeout=TRANSACTION_TIMEOUT- Timeout for data migration transactions.
- Configuration for Oracle or SQL Server as a source in a heterogeneous migration.
- The connectivity method used by the migration job. If a connectivity methodisn't specified, then it isn't added to the migration job.
At most one of these can be specified:
--peer-vpc=PEER_VPC- Name of the VPC network to peer with the Cloud SQL private network.
--static-ip- Use the default IP allowlist method. This method creates a public IP that willbe used with the destination Cloud SQL database. The method works by configuringthe source database server to accept connections from the outgoing IP of theCloud SQL instance.
- Parameters for the reverse-SSH tunnel connectivity method.
--vm-ip=VM_IP- Bastion Virtual Machine IP.
This flag argument must be specified if any of the other arguments in this groupare specified.
--vm-port=VM_PORT- Forwarding port for the SSH tunnel.
This flag argument must be specified if any of the other arguments in this groupare specified.
--vpc=VPC- Name of the VPC network where the VM is hosted.
This flag argument must be specified if any of the other arguments in this groupare specified.
--vm=VM- Name of VM that will host the SSH tunnel bastion.
- At most one of these can be specified:
- The SQL Server homogeneous migration config. This is used only for SQL Server toCloudSQL SQL Server migrations.
--sqlserver-databases=databaseName,[…]- A list of databases to be migrated to the destination Cloud SQL instance.Provide databases as a comma separated list. This list should contain allencrypted and non-encrypted database names. This flag is used only for SQLServer to Cloud SQL migrations.
This flag argument must be specified if any of the other arguments in this groupare specified.
--sqlserver-diff-backup- Enable differential backups. If not specified, differential backups are disabledby default. Use --sqlserver-diff-backup to enable and --no-sqlserver-diff-backupto disable. This flag is used only for homogeneous SQL Server to Cloud SQL forSQL Server migrations.
--sqlserver-encrypted-databases=SQLSERVER_ENCRYPTED_DATABASES- A JSON/YAML file describing the encryption settings per database for allencrytped databases. Note: Path to the Certificate (.cer) and Private Key (.pvk)in Cloud Storage, should be in the form of
gs://bucketName/fileName. The instance must have write permissionsto the bucket and read access to the file. An example of a JSON request: [{"database": "db1", "encryptionOptions": { "certPath": "Path to certificate 1","pvkPath": "Path to certificate private key 1", "pvkPassword": "Private keypassword 1" } }, { "database": "db2", "encryptionOptions": { "certPath": "Pathto certificate 2", "pvkPath": "Path to certificate private key 2","pvkPassword": "Private key password 2" } }]Thisflagaccepts"-"forstdin.ThisflagisusedonlyforSQLServertoCloudSQLmigrations.
--sqlserver-promote-when-ready- Promote the database when it is ready. Use --sqlserver-promote-when-ready toenable and --no-sqlserver-promote-when-ready to disable. This flag is used onlyfor homogeneous SQL Server to Cloud SQL for SQL Server migrations.
- The SQL Server homogeneous migration config. This is used only for SQL Server toCloudSQL SQL Server migrations.
- GCLOUD WIDE FLAGS
- These flags are available to all commands:
--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.Run
$gcloud helpfor details. - NOTES
- This variant is also available:
gcloudalphadatabase-migrationmigration-jobscreate
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-10-21 UTC.