Stay organized with collections
Save and categorize content based on your preferences.
This page describes how to confirm that your migrated data is complete and
accurate. At a minimum, you should run SQL statements to verify that your tables
exist in the migrated AlloyDB for PostgreSQL database. For a more precise
data comparison between the source and destination database,
you can
try using the open-source Data Validation Tool.
Verify destination data with SQL statements
You can run SQL statements to verify that your tables
exist in the migrated AlloyDB for PostgreSQL database. Do the following:
Connect to your Cloud SQL for SQL Server instance with a tool where you can
run SQL commands against your migrated databases.
For more information on connecting to AlloyDB for PostgreSQL instances, see
Connection options
in AlloyDB for PostgreSQL documentation.
Run SQL commands to verify your migrated data. For example:
List all tables in a database
Run the following commands to check if your migrated database
contains all the necessary tables:
Start using a specific database:
USEDATABASE_NAME;GO
List all tables in the database:
SELECT*FROMinformation_schema.tables;
Check table content and definitions
Run the following commands to verify the correctness of a specific
migrated table:
Start using a specific database:
USEDATABASE_NAME;GO
View the table definition:
EXECsp_help'dbo.TABLE_NAME';
Verify the table contents:
SELECT*FROMTABLE_NAME';GO
Verify data with the Data Validation Tool
The
open-source Data Validation Tool lets you perform very precise
data comparisons between two databases, but it requires creating network
connections to your source and destination databases.
The following steps show a minimal example:
Deploy or use a virtual machine with access to both the source and the destination.
In the virtual machine, create a folder in which to install the Data Validation Tool.
We suggest that you run this validation during replication to ensure relative
consistency. Large table queries may take too long to run during a small promotion
window. In such cases, use the Data Validation Tool to add filters to reduce
runtime or prepare the table list to include a subset of tables for the final
validation.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThis document guides users on verifying the completeness and accuracy of data migrated from SQL Server to AlloyDB for PostgreSQL.\u003c/p\u003e\n"],["\u003cp\u003eUsers can employ SQL statements to check for the existence of tables and their content within the migrated AlloyDB for PostgreSQL database.\u003c/p\u003e\n"],["\u003cp\u003eThe open-source Data Validation Tool provides a method for precise data comparison between source and destination databases, requiring network connections to both.\u003c/p\u003e\n"],["\u003cp\u003eThe data validation tool can be installed using pip and used to perform validation of data in the source and destination databases.\u003c/p\u003e\n"],["\u003cp\u003eIt is recommended to perform validation during the replication process, and filters or table subsets can be used to reduce runtime for large tables when using the Data Validation Tool.\u003c/p\u003e\n"]]],[],null,["# Verify a migration\n\nThis page describes how to confirm that your migrated data is complete and\naccurate. At a minimum, you should run SQL statements to verify that your tables\nexist in the migrated AlloyDB for PostgreSQL database. For a more precise\ndata comparison between the source and destination database,\nyou can\n[try using the open-source Data Validation Tool](#verify-dvt).\n\nVerify destination data with SQL statements\n-------------------------------------------\n\nYou can run SQL statements to verify that your tables\nexist in the migrated AlloyDB for PostgreSQL database. Do the following:\n\n1. Connect to your Cloud SQL for SQL Server instance with a tool where you can run SQL commands against your migrated databases. For more information on connecting to AlloyDB for PostgreSQL instances, see\n [Connection options](/sql/docs/sqlserver/connect-overview#tools_for_connecting_to)\n in AlloyDB for PostgreSQL documentation.\n\n2. Run SQL commands to verify your migrated data. For example:\n\n #### List all tables in a database\n\n Run the following commands to check if your migrated database\n contains all the necessary tables:\n 1. Start using a specific database: \n\n ```sql\n USE DATABASE_NAME;\n GO\n ```\n 2. List all tables in the database: \n\n ```sql\n SELECT * FROM information_schema.tables;\n ```\n\n #### Check table content and definitions\n\n Run the following commands to verify the correctness of a specific\n migrated table:\n 1. Start using a specific database: \n\n ```sql\n USE DATABASE_NAME;\n GO\n ```\n 2. View the table definition: \n\n ```sql\n EXEC sp_help 'dbo.\u003cvar translate=\"no\"\u003eTABLE_NAME\u003c/var\u003e';\n ```\n 3. Verify the table contents: \n\n ```sql\n SELECT * FROM TABLE_NAME';\n GO\n ```\n\nVerify data with the Data Validation Tool\n-----------------------------------------\n\nThe [open-source Data Validation Tool](https://github.com/GoogleCloudPlatform/professional-services-data-validator) lets you perform very precise\ndata comparisons between two databases, but it requires creating network\nconnections to your source and destination databases.\n\nThe following steps show a minimal example:\n\n1. Deploy or use a virtual machine with access to both the source and the destination.\n\n2. In the virtual machine, create a folder in which to install the Data Validation Tool.\n\n3. Navigate to this folder.\n\n4. Use [`pip`](https://pip.pypa.io/en/stable/) to install the Data Validation Tool.\n\n ```\n pip install google-pso-data-validator\n ```\n5. Create connections to the source SQL Server database and the£\n destination AlloyDB for PostgreSQL database.\n\n ```\n data-validation connections add -c SOURCE_CONNECTION_NAME MSSQL --host 'ip-address' --port port --user username --password pswd --database database-name\n data-validation connections add -c TARGET_CONNECTION_NAME AlloyDB --host 'ip-address' --port port --user username --password pswd --database database-name\n ```\n\n For example: \n\n ```\n data-validation connections add -c source_connection_name MSSQL --host '10.10.10.11' --port 1521 --user system --password pswd --database XE\n data-validation connections add -c target_connection_name AlloyDB --host '10.10.10.12' --port 5432 --user my_user --password pswd --database mydb\n ```\n6. Create or generate a list of tables to compare data between the source and destination databases.\n\n ```\n export TABLES_LIST=$(data-validation find-tables --source-conn SOURCE_CONNECTION_NAME --target-conn TARGET_CONNECTION_NAME --allowed-schemas schema-name)\n ```\n\n For example: \n\n ```\n export TABLES_LIST=$(data-validation find-tables --source-conn source_connection_name --target-conn target_connection_name --allowed-schemas public)\n ```\n7. Run full validation against all tables.\n\n ```\n data-validation validate column --source-conn source_connection_name --target-conn target_connection_name --tables-list \"${TABLES_LIST}\"\n ```\n\nWe suggest that you run this validation during replication to ensure relative\nconsistency. Large table queries may take too long to run during a small promotion\nwindow. In such cases, use the Data Validation Tool to add filters to reduce\nruntime or prepare the table list to include a subset of tables for the final\nvalidation."]]