Pre & Post Migration Activities
This article describes the required validation steps to be performed before and after database migration. These steps ensure data consistency, integrity, and completeness by capturing key database metrics. The captured values serve as a baseline for comparison after migration.
Prerequisites
Ensure the following conditions are met before proceeding:
Database Access: Access to both source and target database environments
Permissions: Required privileges to query information_schema
SQL Tool: Availability of a SQL client or query execution tool
Database Details: Database name identified for validation
Procedure
Execute the following scripts before and after the migration activity to validate consistency.
Capture Table Row Counts
Run the following SQL query to retrieve table row counts and sizes. Save the output for post-migration comparison.
USE information_schema; SELECT TABLE_NAME AS "Table Name", TABLE_ROWS AS "Row Count", ROUND((COALESCE(DATA_LENGTH, 0) + COALESCE(INDEX_LENGTH, 0)) / 1024 / 1024) AS "Size (MB)" FROM tables WHERE table_schema = 'YOUR_DB_NAME' UNION ALL SELECT "Total Count", SUM(RowCount), SUM(Size) FROM ( SELECT TABLE_NAME AS "Table Name", TABLE_ROWS AS "RowCount", ROUND((COALESCE(DATA_LENGTH, 0) + COALESCE(INDEX_LENGTH, 0)) / 1024 / 1024) AS "Size" FROM tables WHERE table_schema = 'YOUR_DB_NAME' ) summary; Reference: All_Tables_RowCount.sql
Copyright © 2026, OvalEdge LLC, Peachtree Corners, GA, USA.
Last updated
Was this helpful?

