Course contentsShow
← Cloud and Infrastructure
Lesson 2830 of 2,98961. Cloud MigrationFree lesson

Data Validation and Consistency Checks

Verify data integrity, consistency, and completeness after migration using validation scripts and tools.

Data Validation and Consistency Checks

What You'll Learn

You'll learn how to systematically verify that migrated data matches the source system in integrity, consistency, and completeness using validation scripts and tools.

Why Data Validation Matters

After migrating your database using continuous replication or cutover strategies, you cannot simply assume everything copied correctly. Data validation is the systematic process of comparing source and target databases to ensure they're functionally equivalent—think of it as doing a thorough inventory check after moving houses to verify nothing was lost or damaged in transit.

Core Validation Approaches

Row Count Validation: The simplest check—compare table row counts between source and target. If customers has 1,000,000 rows in source, it should have exactly 1,000,000 in target.

Checksum and Hash Validation: Generate checksums (MD5, SHA-256) on data blocks or entire tables. Matching checksums prove byte-for-byte accuracy. This catches subtle corruption that row counts would miss.

Sample Data Comparison: Select random samples (e.g., 1% of records) and perform deep field-by-field comparisons. Validates data types, formats, and transformations worked correctly.

Business Logic Validation: Run queries that verify business rules—account balances sum correctly, foreign key relationships intact, date ranges valid. These confirm semantic correctness beyond mechanical copying.

Validation Timing

Perform validation in phases:

  • Pre-cutover: During replication lag monitoring
  • At cutover: Immediately after final sync
  • Post-cutover: After applications connect, verifying read/write operations

Many cloud migration services include built-in validation tools, but custom scripts using SQL queries or data comparison frameworks provide deeper assurance for critical workloads.

Key Takeaway: Data validation isn't optional—it's your proof that migration succeeded. Use layered checks (counts, checksums, sampling, business rules) to catch everything from missing rows to subtle data corruption before declaring victory.