Finalize a migration

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.

  1. Optional: Verify migration data for completeness.
  2. Stop all writes, running scripts, and client connections to the source database. The downtime period begins here.
  3. Observe the replication delay metric and wait for it to trend down significantly, ideally on the order of minutes or seconds.
  4. Perform the promote action on the migration job.

    Console

    1. In the Google Cloud console, go to the Migration jobs page.

      Go to Migration jobs

    2. In the Jobs tab, click the display name of the migration job that you want to promote.

      The migration job details page opens.

    3. Click Promote.
    4. 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 the gcloud 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
    
    To see if your operation is successful, you can query the returned operation object, or check the status of the migration job:
  5. 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.
  6. The application can now be connected to the Cloud SQL instance and the migration job can be safely deleted.