Verify a migration

Verifying a migration

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

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

The following steps show a minimal example:

  1. Go to the SQL Instances page in the Google Cloud Console.
  2. Click the read replica entry of your migration job.
  3. Click the Activate Cloud Shell icon that appears in the upper-right region of the page.
  4. At the Cloud Shell prompt, press Enter.
  5. Optional: If an Authorize Cloud Shell dialog box appears, then click Authorize.
  6. At the Enter password prompt, enter the password that you either provided or that Database Migration Service generated for you in Define and create the destination Cloud SQL instance.
  7. Run SQL commands to verify the migration. For example:
    1. At the postgres prompt, enter \list to list the databases and verify that you see your source database instance.
    2. At the postgres prompt, enter \connect SOURCE_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 from postgres to SOURCE_DB_NAME.
    3. At the SOURCE_DB_NAME prompt, enter \dt to see the tables of this instance.
    4. At the SOURCE_DB_NAME prompt, enter GRANT cloudsqlexternalsync to USER; because you want to give this user permission to access the data in the tables of this instance. Also, replace USER with the name of the user you used to connect to the destination database instance.
    5. At the SOURCE_DB_NAME prompt, enter SELECT * from TABLE_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.

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