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 the Cloud SQL instance. You can also verify the tables' row counts or exact contents.
The following steps show a minimal example:
- Go to the SQL Instances page in the Google Cloud console.
- Click the read replica entry of your migration job.
- Click the Activate Cloud Shell icon that appears in the upper-right region of the page.
- At the Cloud Shell prompt, press Enter.
- Optional: If an Authorize Cloud Shell dialog box appears, then click Authorize.
- 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.
- Run SQL commands to verify the migration. For example:
- At the postgres prompt, enter
\list
to list the databases and verify that you see your source database instance. - 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 frompostgres
to SOURCE_DB_NAME. - At the SOURCE_DB_NAME prompt, enter
\dt
to see the tables of this instance. - 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. - 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. - Verify that you see the correct information in the table.
- At the postgres prompt, enter
- 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 the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-30 UTC.