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](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-csql-pgsql/verify-migration.md.txt) 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](https://docs.cloud.google.com/database-migration/docs/sqlserver-to-csql-pgsql/migration-job-metrics.md.txt#replication_delay) 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

   You can promote a migration job from in Database Migration Service or from the destination instance page.

   **In Database Migration Service:**
   1. In the Google Cloud console, go to the **Migration jobs** page.

      [Go to Migration jobs](https://console.cloud.google.com/dbmigration/migrations)
   2. On 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**.

   **From the destination instance:**
   1. In the Google Cloud console, go to the **Cloud SQL Instances** page.

      [Go to Cloud SQL Instances](https://console.cloud.google.com/sql/instances)
   2. Click the display name of the destination instance for your migration. The instance details page opens.

   3. In the **Migration** section, click **Promote**.
   4. In the dialog, ensure no errors are displayed, and then click **Promote**.

   ### gcloud


   Before using any of the command data below,
   make the following replacements:
   - <var class="edit" scope="MIGRATION_JOB_ID" translate="no">MIGRATION_JOB_ID</var> with your migration job identifier.

     If you don't know the identifier, you can use the
     [`gcloud database-migration migration-jobs list`](https://docs.cloud.google.com/sdk/gcloud/reference/database-migration/migration-jobs/list.md.txt) command to list all
     migration jobs in a given region and view their identifiers.
   - <var class="edit" scope="REGION" translate="no">REGION</var> 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`](https://docs.cloud.google.com/sdk/gcloud/reference/database-migration/migration-jobs/update.md.txt) command.


   Execute the

   following

   command:

   #### Linux, macOS, or Cloud Shell

   > [!NOTE]
   > **Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](https://docs.cloud.google.com/sdk/gcloud/reference/init); or [gcloud auth login](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) and [gcloud config set project](https://docs.cloud.google.com/sdk/gcloud/reference/config/set.md.txt).

   ```bash
   gcloud database-migration migration-jobs \
   promote MIGRATION_JOB_ID \
     --region=REGION
   ```

   #### Windows (PowerShell)

   > [!NOTE]
   > **Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](https://docs.cloud.google.com/sdk/gcloud/reference/init); or [gcloud auth login](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) and [gcloud config set project](https://docs.cloud.google.com/sdk/gcloud/reference/config/set.md.txt).

   ```bash
   gcloud database-migration migration-jobs `
   promote MIGRATION_JOB_ID `
     --region=REGION
   ```

   #### Windows (cmd.exe)

   > [!NOTE]
   > **Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](https://docs.cloud.google.com/sdk/gcloud/reference/init); or [gcloud auth login](https://docs.cloud.google.com/sdk/gcloud/reference/auth/login.md.txt) and [gcloud config set project](https://docs.cloud.google.com/sdk/gcloud/reference/config/set.md.txt).

   ```bash
   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](https://docs.cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.operations.md.txt) 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 describe`](https://docs.cloud.google.com/sdk/gcloud/reference/database-migration/migration-jobs/describe.md.txt) command to view the status of the migration job.
   - Use the [`gcloud database-migration operations describe`](https://docs.cloud.google.com/sdk/gcloud/reference/database-migration/operations/describe.md.txt) with the <var translate="no">OPERATION_ID</var> to see the status of the operation itself.
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.