For continuous migrations, you can initiate the promotion process after it's time to move reads and writes to the destination databases. Promotion means that Database Migration Service disconnects from your source database, stops replicating change data events to the destination database, and cleans up all the temporary migration data.
- Optional: Verify migration data for completeness.
- Stop all writes, running scripts, and client connections to the source database. The downtime period begins here.
- Observe the replication delay metric and wait for it to trend down significantly, ideally on the order of minutes or seconds.
- Perform the promote action on the migration job.
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 promote.
The migration job details page opens.
- Click Promote.
- In the dialog, click Promote.
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.
Optional: Database Migration Service migrates all databases in your source by default. If you want to migrate only specific databases, use the
--databases-filter
flag and specify their identifiers as a comma-separated list.For example:
--databases-filter=my-business-database,my-other-database
You can later edit migration jobs that you created with the
--database-filter flag
by using thegcloud database-migration migration-jobs update
command.
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud database-migration migration-jobs \ promote MIGRATION_JOB_ID \ --region=REGION
Windows (PowerShell)
gcloud database-migration migration-jobs ` promote MIGRATION_JOB_ID ` --region=REGION
Windows (cmd.exe)
gcloud database-migration migration-jobs ^ promote 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.
- The destination instance is promoted, and your migrated databases
are now accessible for all read and write operations.
The migration job status changes to
Completed
. - The application can now be connected to the Cloud SQL instance and the migration job can be safely deleted.