Verify a migration

MySQL  |  PostgreSQL  |  PostgreSQL to AlloyDB


Verifying a migration

In this page, you confirm that the migration job migrated data from your source database instance to the destination Cloud SQL database instance correctly.

At a minimum, verify that the database instance and its tables exist in theCloud SQL instance. You can also verify the tables' row counts or exactcontents.

The following steps show a minimal example:

  1. Go to theSQL Instances page in the Google Cloud console.
  2. Click the read replica entry of your migration job.
  3. Click theActivate Cloud Shell icon that appears in the upper-right region of the page.
  4. At the Cloud Shell prompt, pressEnter.
  5. Optional: If anAuthorize Cloud Shell dialog box appears, then clickAuthorize.
  6. At theEnter password prompt, enter the password that you either provided or that Database Migration Service generated for you inDefine and create the destination Cloud SQL instance.
  7. Run SQL commands to verify the migration. For example:
    1. At thepostgres prompt, enter\list to list the databases and verify that you see your source database instance.
    2. At thepostgres prompt, enter\connectSOURCE_DB_NAME, and enter the password when prompted, to connect to the database instance and see the tables associated with the instance. The name of the prompt changes frompostgres toSOURCE_DB_NAME.
    3. At theSOURCE_DB_NAME prompt, enter\dt to see the tables of this instance.
    4. At theSOURCE_DB_NAME prompt, enterGRANT cloudsqlexternalsync toUSER; because you want to give this user permission to access the data in the tables of this instance. Also, replaceUSER with the name of the user you used to connect to the destination database instance.
    5. At theSOURCE_DB_NAME prompt, enterSELECT * fromTABLE_NAME; to see the information that's replicated from a table in your source database instance.
    6. Verify that you see the correct information in the table.
  8. Verify that constraints such as primary keys, foreign keys, and indexes were migrated to the destination Cloud SQL database instance correctly.

If everything you check is as you expect, then Database Migration Service has migrated the data correctly.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-17 UTC.