Promote a migration job

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 the migrated Cloud SQL databases become now accessible for all read and write operations.

To promote a migration job, follow these steps:

  1. Initiate the promotion. To avoid data loss, make sure to stop all writes, running scripts, and client connections to the source database. The downtime period begins here.
  2. Make sure that all the available data from transaction log files is replicated to the Cloud SQL for SQL Server destination instance.

    You can achieve this result by performing one of the following actions:

  3. 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 box, 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.

    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:
  4. 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.
  5. The application can now be connected to the Cloud SQL instance and the migration job can be safely deleted.