In the Google Cloud console, you can perform actions in bulk for migration jobs that have the same status. You can perform actions on a single migration job both in the Google Cloud console and by using Google Cloud CLI.
You can perform any of the following actions on your migration job:
Action | Description |
---|---|
Start | Start migration jobs is that aren't in the Running or Starting state. See Migration job statuses. |
Stop | Stop a running migration job. The data movement is paused.
The migration job status first changes to Stopping
and then to Stopped . You can
resume, delete, or
promote a stopped migration job. |
Resume | If you stop a migration job during the incremental load, you can resume it later. When you resume a migration job, Database Migration Service picks up all transaction log files that accumulate when the migration job is stopped. |
Restart |
You can restart a migration job that encountered an error and can't
proceed with data replication. The result of restarting a migration job
depends on why it failed:
|
Delete | A migration job can be deleted. The outcome depends on the status of
the job:
|
Promote | During the migration process, your destination database is put into a read-only state where it is fully managed by Database Migration Service. When you want to switch your application to the migrated destination database, promoting the migration job updates the destination database into a standalone replica. | During the migration process, your destination Cloud SQL for SQL Server databases are put into recovery mode where they are fully managed by Database Migration Service. You can't perform any read or write operations on the destination databases until you promote the migration job. See Promote a migration. |
Start a migration job
When your migration job is fully created (that is, it isn't saved in a draft state), you can start it at any time to begin migrating data.
To start a migration job, perform the following steps:
Console
- In the Google Cloud console, go to the Migration jobs page.
- In the Jobs tab, click the display name of the migration job
that you want to start.
The migration job details page opens.
- Click Start.
- In the dialog, click Start.
gcloud
Before using any of the command data below, make the following replacements:
- MIGRATION_JOB_ID with
your migration job identifier.
If you don't know the identifier, you can use the
gcloud database-migration migration-jobs list
command to list all migration jobs in a given region and view their identifiers. - REGION with the identifier of the region where your connection profile is saved.
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud database-migration migration-jobs \ start MIGRATION_JOB_ID \ --region=REGION
Windows (PowerShell)
gcloud database-migration migration-jobs ` start MIGRATION_JOB_ID ` --region=REGION
Windows (cmd.exe)
gcloud database-migration migration-jobs ^ start MIGRATION_JOB_ID ^ --region=REGION
Result
The action is performed in an asynchronous manner. As such, this command returns an Operation entity that represents a long-running operation:
done: false metadata: '@type': type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata apiVersion: v1 createTime: '2024-02-20T12:20:24.493106418Z' requestedCancellation: false target: MIGRATION_JOB_ID verb: start name: OPERATION_ID
- Use the
gcloud database-migration migration-jobs describe
command to view the status of the migration job. - Use the
gcloud database-migration operations describe
with the OPERATION_ID to see the status of the operation itself.
Stop a migration job
You can stop a running migration job at any time by performing the following steps:
Console
- In the Google Cloud console, go to the Migration jobs page.
- In the Jobs tab, click the display name of the migration job
that you want to start.
The migration job details page opens.
- Click Stop.
- In the dialog, click Stop.
gcloud
Before using any of the command data below, make the following replacements:
- MIGRATION_JOB_ID with
your migration job identifier.
If you don't know the identifier, you can use the
gcloud database-migration migration-jobs list
command to list all migration jobs in a given region and view their identifiers. - REGION with the identifier of the region where your connection profile is saved.
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud database-migration migration-jobs \ stop MIGRATION_JOB_ID \ --region=REGION
Windows (PowerShell)
gcloud database-migration migration-jobs ` stop MIGRATION_JOB_ID ` --region=REGION
Windows (cmd.exe)
gcloud database-migration migration-jobs ^ stop MIGRATION_JOB_ID ^ --region=REGION
Result
The action is performed in an asynchronous manner. As such, this command returns an Operation entity that represents a long-running operation:
done: false metadata: '@type': type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata apiVersion: v1 createTime: '2024-02-20T12:20:24.493106418Z' requestedCancellation: false target: MIGRATION_JOB_ID verb: stop name: OPERATION_ID
- Use the
gcloud database-migration migration-jobs describe
command to view the status of the migration job. - Use the
gcloud database-migration operations describe
with the OPERATION_ID to see the status of the operation itself.
Resume a migration job
You can resume a stopped migration job by performing the following steps:
Console
- In the Google Cloud console, go to the Migration jobs page.
- In the Jobs tab, click the display name of the migration job
that you want to start.
The migration job details page opens.
- Click Resume.
- In the dialog, click Resume.
gcloud
Before using any of the command data below, make the following replacements:
- MIGRATION_JOB_ID with
your migration job identifier.
If you don't know the identifier, you can use the
gcloud database-migration migration-jobs list
command to list all migration jobs in a given region and view their identifiers. - REGION with the identifier of the region where your connection profile is saved.
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud database-migration migration-jobs \ resume MIGRATION_JOB_ID \ --region=REGION
Windows (PowerShell)
gcloud database-migration migration-jobs ` resume MIGRATION_JOB_ID ` --region=REGION
Windows (cmd.exe)
gcloud database-migration migration-jobs ^ resume MIGRATION_JOB_ID ^ --region=REGION
Result
The action is performed in an asynchronous manner. As such, this command returns an Operation entity that represents a long-running operation:
done: false metadata: '@type': type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata apiVersion: v1 createTime: '2024-02-20T12:20:24.493106418Z' requestedCancellation: false target: MIGRATION_JOB_ID verb: resume name: OPERATION_ID
- Use the
gcloud database-migration migration-jobs describe
command to view the status of the migration job. - Use the
gcloud database-migration operations describe
with the OPERATION_ID to see the status of the operation itself.
Restart a migration job
To start a migration job, perform the following steps:
Console
- In the Google Cloud console, go to the Migration jobs page.
- In the Jobs tab, click the display name of the migration job
that you want to restart.
The migration job details page opens.
- Click Restart.
- In the dialog, click Restart.
gcloud
Before using any of the command data below, make the following replacements:
- MIGRATION_JOB_ID with
your migration job identifier.
If you don't know the identifier, you can use the
gcloud database-migration migration-jobs list
command to list all migration jobs in a given region and view their identifiers. - REGION with the identifier of the region where your connection profile is saved.
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud database-migration migration-jobs \ restart MIGRATION_JOB_ID \ --region=REGION
Windows (PowerShell)
gcloud database-migration migration-jobs ` restart MIGRATION_JOB_ID ` --region=REGION
Windows (cmd.exe)
gcloud database-migration migration-jobs ^ restart MIGRATION_JOB_ID ^ --region=REGION
Result
The action is performed in an asynchronous manner. As such, this command returns an Operation entity that represents a long-running operation:
done: false metadata: '@type': type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata apiVersion: v1 createTime: '2024-02-20T12:20:24.493106418Z' requestedCancellation: false target: MIGRATION_JOB_ID verb: restart name: OPERATION_ID
- Use the
gcloud database-migration migration-jobs describe
command to view the status of the migration job. - Use the
gcloud database-migration operations describe
with the OPERATION_ID to see the status of the operation itself.
Update a draft migration job
To finish creating a migration job, perform the following steps:
Console
- In the Google Cloud console, go to the Migration jobs page.
- In the Drafts tab, click the display name of the migration job
that you want to finish creating.
The migration job creation wizard opens.
- Finish creating the migration job. See Create a migration job.
gcloud
This sample uses the optional --no-async
flag so that all operations
are performed synchronously. This means that some commands might take
a while to complete. You can skip the --no-async
flag to run commands asynchronously.
If you do, you need to use the
gcloud database-migration operations describe
command to verify if your operation is successful.
Before using any of the command data below, make the following replacements:
- MIGRATION_JOB_ID with a machine-readable identifier for your migration job.
- REGION with the region identifier where you want to save the connection profile.
- MIGRATION_JOB_NAME with a human-readable name for your migration job. This value is displayed in Database Migration Service in the Google Cloud console.
- SOURCE_CONNECTION_PROFILE_ID with a machine-readable identifier of the source connection profile.
- DESTINATION_CONNECTION_PROFILE_ID with a machine-readable identifier of the destination connection profile.
- Differential backup configuration: You can configure whether
the migration job can use differential backup files from the Cloud Storage
bucket. Add one of the following flags to your command:
--sqlserver-diff-backup
to enable differential backup files for your migration--no-sqlserver-diff-backup
to disable differential backup files for your migration
For more information on supported backup files, see Supported backup file types.
- COMMA_SEPARATED_DATABASE_ID_LIST with a comma-separated list of database identifiers of the SQL Server you want to migrate from your backup files.
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud database-migration migration-jobs \ create MIGRATION_JOB_ID \ --no-async \ --region=REGION \ --display-name=MIGRATION_JOB_NAME \ --source=SOURCE_CONNECTION_PROFILE_ID \ --destination=DESTINATION_CONNECTION_PROFILE_ID \ --sqlserver-databases=COMMA_SEPARATED_DATABASE_ID_LIST \ --type=CONTINUOUS]
Windows (PowerShell)
gcloud database-migration migration-jobs ` create MIGRATION_JOB_ID ` --no-async ` --region=REGION ` --display-name=MIGRATION_JOB_NAME ` --source=SOURCE_CONNECTION_PROFILE_ID ` --destination=DESTINATION_CONNECTION_PROFILE_ID ` --sqlserver-databases=COMMA_SEPARATED_DATABASE_ID_LIST ` --type=CONTINUOUS]
Windows (cmd.exe)
gcloud database-migration migration-jobs ^ create MIGRATION_JOB_ID ^ --no-async ^ --region=REGION ^ --display-name=MIGRATION_JOB_NAME ^ --source=SOURCE_CONNECTION_PROFILE_ID ^ --destination=DESTINATION_CONNECTION_PROFILE_ID ^ --sqlserver-databases=COMMA_SEPARATED_DATABASE_ID_LIST ^ --type=CONTINUOUS]
You should receive a response similar to the following:
Waiting for migration job [MIGRATION_JOB_ID] to be updated with [OPERATION_ID] Waiting for operation [OPERATION_ID] to complete...done. Updated migration job MIGRATION_JOB_ID [OPERATION_ID]
Add databases to the migration job
To add a new database to the migration job, you first need to create a new dedicated folder in your Cloud Storage bucket and upload the backup files there. See Configure Cloud Storage buckets.
When you have the necessary backup files in the Cloud Storage bucket, perform the following steps:
Console
- In the Google Cloud console, go to the Migration jobs page.
- In the Jobs tab, click the display name of your migration job.
The migration job details page opens.
- Click Edit.
- In the Select databases to migrate section, use the checkboxes to select the new database you want to add to the migration job.
- (Optional) If you use encrypted backups, provide the encryption
keys for your backups. For more details on using encrypted
backups, see
Use encrypted backups.
Perform the following actions:
- Click Edit details next to the database
you selected for migration.
The Encryption side panel opens.
- Use the Encryption key drop-down menus to select your keys.
- In the Password field, enter the encryption key password.
- Click Save and exit.
- Click Edit details next to the database
you selected for migration.
gcloud
This sample uses the optional --no-async
flag so that all operations
are performed synchronously. This means that some commands might take
a while to complete. You can skip the --no-async
flag to run commands asynchronously.
If you do, you need to use the
gcloud database-migration operations describe
command to verify if your operation is successful.
Before using any of the command data below, make the following replacements:
- MIGRATION_JOB_ID with
your migration job identifier.
If you don't know the identifier, you can use the
gcloud database-migration migration-jobs list
command to list all migration jobs in a given region and view their identifiers. - REGION with the identifier of the region where your connection profile is saved.
- COMMA_SEPARATED_DATABASE_ID_LIST with a
comma-separated list of database identifiers of the SQL Server you want to
migrate from your backup files. These identifiers need to be the same as the
database folder names in your Cloud Storage.
For example:
--sqlserver-databases=my-business-database,my-other-database
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud database-migration migration-jobs \ update MIGRATION_JOB_ID \ --region=REGION \ --sqlserver-databases=COMMA_SEPARATED_DATABASE_ID_LIST
Windows (PowerShell)
gcloud database-migration migration-jobs ` update MIGRATION_JOB_ID ` --region=REGION ` --sqlserver-databases=COMMA_SEPARATED_DATABASE_ID_LIST
Windows (cmd.exe)
gcloud database-migration migration-jobs ^ update MIGRATION_JOB_ID ^ --region=REGION ^ --sqlserver-databases=COMMA_SEPARATED_DATABASE_ID_LIST
You should receive a response similar to the following:
Waiting for migration job [MIGRATION_JOB_ID] to be updated with [OPERATION_ID] Waiting for operation [OPERATION_ID] to complete...done. Updated migration job MIGRATION_JOB_ID [OPERATION_ID]
Edit a migration job
For non-draft migration jobs, you can use Google Cloud CLI to change their display name.
This sample uses the optional --no-async
flag so that all operations
are performed synchronously. This means that some commands might take
a while to complete. You can skip the --no-async
flag to run commands asynchronously.
If you do, you need to use the
gcloud database-migration operations describe
command to verify if your operation is successful.
Before using any of the command data below, make the following replacements:
- MIGRATION_JOB_ID with
your migration job identifier.
If you don't know the identifier, you can use the
gcloud database-migration migration-jobs list
command to list all migration jobs in a given region and view their identifiers. - REGION with the identifier of the region where your connection profile is saved.
- MIGRATION_JOB_NAME with a human-readable name for your migration job. This value is displayed in Database Migration Service in the Google Cloud console.
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud database-migration migration-jobs \ update MIGRATION_JOB_ID \ --region=REGION \ --display-name=MIGRATION_JOB_NAME
Windows (PowerShell)
gcloud database-migration migration-jobs ` update MIGRATION_JOB_ID ` --region=REGION ` --display-name=MIGRATION_JOB_NAME
Windows (cmd.exe)
gcloud database-migration migration-jobs ^ update MIGRATION_JOB_ID ^ --region=REGION ^ --display-name=MIGRATION_JOB_NAME
You should receive a response similar to the following:
Waiting for migration job [MIGRATION_JOB_ID] to be updated with [OPERATION_ID] Waiting for operation [OPERATION_ID] to complete...done. Updated migration job MIGRATION_JOB_ID [OPERATION_ID]
Test a migration job
Before you run the migration job, you can perform a test operation to check if Database Migration Service can reach all the necessary source and destination entities. In the Google Cloud console, you can only test draft migration jobs that you create in the migration job creation wizard (see Create a migration job).
With gcloud CLI, you can test migration jobs that are created, but not yet started.
Before using any of the command data below, make the following replacements:
- MIGRATION_JOB_ID with
your migration job identifier.
If you don't know the identifier, you can use the
gcloud database-migration migration-jobs list
command to list all migration jobs in a given region and view their identifiers. - REGION with the identifier of the region where your connection profile is saved.
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud database-migration migration-jobs \ verify MIGRATION_JOB_ID \ --region=REGION
Windows (PowerShell)
gcloud database-migration migration-jobs ` verify MIGRATION_JOB_ID ` --region=REGION
Windows (cmd.exe)
gcloud database-migration migration-jobs ^ verify MIGRATION_JOB_ID ^ --region=REGION
Result
The action is performed in an asynchronous manner. As such, this command returns an Operation entity that represents a long-running operation:
done: false metadata: '@type': type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata apiVersion: v1 createTime: '2024-02-20T12:20:24.493106418Z' requestedCancellation: false target: MIGRATION_JOB_ID verb: verify name: OPERATION_ID
- Use the
gcloud database-migration migration-jobs describe
command to view the status of the migration job. - Use the
gcloud database-migration operations describe
with the OPERATION_ID to see the status of the operation itself.