For continuous migrations, you can initiate the promotion process when you are ready to cut over your applications to the destination databases. Promoting the migration job disconnects the destination instance from the source, transforms it into an independent standalone primary database instance so you can you resume automated backups, configure point-in-time recovery (PITR), and create read replicas.
You can promote a migration job or promote selected databases from a migration job.
- Stop all writes, running scripts, and client connections to the source database. The downtime period begins here.
- Wait until the
replication delay metric is at or close to zero. This means
that the migration job has processed all outstanding changes.
You can promote a migration even if the replication delay isn't at zero. This can reduce the database downtime, but may affect the accuracy of the data in the destination.
- Perform the promote action:
Console
- In the Google Cloud console, go to the Migration jobs page.
- On the Jobs tab, click the display name of the migration job
that you want to promote.
The migration job details page opens.
- Perform one of the following promote actions:
If you want to promote all databases included in the migration, on the migration job's toolbar, click Promote.
The promote migration job dialog appears.
If you want to promote only specific databases, select them using the checkboxes next to the database names and on the Databases tab, click Promote.
The dialog with a number of databases that you want to promote appears.
- In the dialog, ensure that no errors are displayed, and then 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 listcommand 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 \ 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
To see if your operation is successful, you can query the returned operation object, or check the status of the migration job:
- Use the
gcloud database-migration migration-jobs describecommand with the MIGRATION_JOB_ID to view the status of the migration job. - Use the
gcloud database-migration operations describecommand with the OPERATION_ID to see the status of the operation itself.
- The destination instance or the databases that you selected are promoted.
The destination instance is disconnected from the source, becomes an independent
standalone primary instance, and is ready for full application traffic.
The migration job status changes to
Completed. - (Optional) For sources that use the
pg_cronextension: Thepg_cronextension (or anycronsettings associated with the extension) isn't migrated by Database Migration Service, but it is supported in Cloud SQL for PostgreSQL destinations. If you use thepg_cronextension in your source databases, you can re-install it on your destination instance. - You can now connect your application to the Cloud SQL instance and delete the migration job.