Data Migration Rehearsal: How to Reconcile Row Counts and Validate, While Protecting Personal Data

· DataMint · 8 min read

It is the early morning after a migration rehearsal, and the per-table results appear on the migration status board. Most rows are green, but a few are red. The row counts of the AS-IS account table and the TO-BE account table differ by a few hundred. Someone asks, "Are they missing, or were they never in scope for migration?" Three hours remain until the morning report.

Validating a data migration rehearsal comes down to reconciliation. For each table you match the row counts, match the totals of amounts, and check that no key is missing or duplicated, that codes were converted correctly, and that no child rows were left without a parent. The answer is to write these five checks in SQL before the rehearsal and run them the same way every round.

One more question comes with this. Does production data have to go into the rehearsal environment as is? This post covers the reconciliation method, and separates why reconciliation still works on data whose personal data has been transformed from the narrow area where it does not.

Why a migration rehearsal does not end with one round

Rehearsals are run several times because each round checks something different. The names and number of rounds differ by project, but they are commonly divided like this.

  • Early rounds: check that the migration program runs and the mapping is correct. This is where the most defects appear.
  • Middle rounds: run at full scale and measure the time. This is where you find out whether it finishes within the window given for the actual cutover.
  • Final round: run with the same procedure, at the same time of day, with the same people as the actual cutover. Even the meeting that reviews the reconciliation results and decides whether to go ahead is rehearsed.

Many rounds means preparing rehearsal data many times. Whether it is fetched fresh from production each time, who sees the fetched data, and whether it is deleted afterward are all repeated once per round.

Five things to reconcile in migration validation: counts, totals, keys, codes, relationships

The five reconciliation items. The further down the list, the harder the problem it catches.
ItemWhat to check
CountsCOUNT per table
TotalsSUM of amount columns
KeysMissing and duplicate keys
CodesDistribution after mapping
RelationshipsChild rows without a parent
-- 1. Counts: per table, with the same condition on both sides
SELECT COUNT(*) FROM ASIS.ACCOUNT WHERE CLOSE_YN = 'N';
SELECT COUNT(*) FROM tobe.account;

-- 2. Totals: amounts down to the last unit, plus the number of distinct keys
SELECT SUM(BAL_AMT), COUNT(DISTINCT ACCT_NO) FROM ASIS.ACCOUNT WHERE CLOSE_YN = 'N';
SELECT SUM(balance), COUNT(DISTINCT acct_no) FROM tobe.account;

-- 3. Keys: accounts that exist in the AS-IS but not in the TO-BE
SELECT k.acct_no FROM recon.asis_keys k
 WHERE NOT EXISTS (SELECT 1 FROM tobe.account t WHERE t.acct_no = k.acct_no);

-- 4. Codes: does the distribution after mapping follow the mapping table?
SELECT STAT_CD, COUNT(*) FROM ASIS.ACCOUNT GROUP BY STAT_CD;
SELECT status,  COUNT(*) FROM tobe.account GROUP BY status;

-- 5. Relationships: transactions without an account
SELECT COUNT(*) FROM tobe.txn x
 WHERE NOT EXISTS (SELECT 1 FROM tobe.account a WHERE a.acct_id = x.acct_id);

A few practical points. Counts must be taken with the same migration scope condition on both sides. If you decided not to migrate closed accounts, the AS-IS side needs that condition too. Only then can you tell whether a difference is "missing" or "never in scope." That is exactly the question from the opening scene.

For key reconciliation, if the AS-IS and TO-BE are different DBs, load the key list of one side into the other and compare there (recon.asis_keys in the SQL above). With hundreds of millions of rows, rather than comparing all keys at once, first match counts and totals split by date or branch, and look at keys only in the ranges that do not match.

For code reconciliation, turn the mapping table directly into SQL, convert the AS-IS distribution into TO-BE codes, and count. If the AS-IS contained a code that is not in the mapping table, it shows up here.

Why counts differ even when the migration "succeeded"

Counts can differ even when the migration tool reports success. Tools are often configured to skip rows that could not be inserted because of their values, and keep going. Common causes are values that are too long, characters the receiving DB does not have, dates such as 0000-00-00, the difference between an empty string and NULL, and duplicate keys that accumulated in production without a constraint. If the migration goes to a different DB, the pitfalls listed in 7 things to watch when moving to a different DB apply as they are.

So the reconciliation sheet needs three numbers: rows read from the source, rows the migration tool says it inserted, and rows actually present in the target. Looking only at the first two misses the case of "reported as inserted but not there." And for the rows left out, you need counts and keys by reason to judge whether to fix them or whether they can be excluded.

Migration rehearsal data contains personal data too

The rehearsal DB holds all of production. But the rehearsal environment is not production. The people who connect to it include staff from the partner company handling the migration, and account management and access logs are often not as tight as in production. Fetching fresh data every round adds that many more copies.

For financial companies in Korea, regulation applies directly. Korea's Electronic Financial Supervision Regulations say not to use customer information in testing. For data consistency validation, the Financial Services Commission (FSC) issued a no-action opinion stating that it would not take action, subject to conditions (reply of February 2025, in Korean). The conditions are: the minimum scope needed for validation, immediate deletion after use, security management of external staff, and security measures at the same level as production. The full details are in when real customer information may be used in financial sector testing. For non-financial companies, it is safer to assume that the safeguards required by Korea's Personal Information Protection Act (PIPA) apply to the rehearsal environment as they are. Confirm the specific application with your legal and security teams.

Why migration validation still works on transformed data

"Reconciliation does not work after transformation" is only half right. If the rehearsal starts from a transformed copy of the AS-IS, reconciliation is done between the transformed AS-IS and the TO-BE built from it. Both went through the same transformation, so all five reconciliations work as they are.

  • Counts, totals, code distribution: amounts, codes and dates are not changed, so they are the same.
  • Keys: if a key column has to be changed, the transformation must be one-to-one. If different originals become the same value, the number of distinct keys drops and the load fails.
  • Relationships: if the same original becomes the same value in every table, parents and children stay connected.

What remains is only validation that compares against the original production values one by one, such as checking with real names that names came across correctly. Narrowing the area that needs real information down to this also brings you closer to the "minimum scope" condition of the no-action opinion above.

Preparing and validating migration rehearsal data with DataMint Core

DataMint Core is a migration engine installed on the client's internal network that transforms the data in production DBs and moves it to another DB. It moves data between Oracle, MySQL, MariaDB, SQL Server and PostgreSQL, and the transformation of personal data finishes inside the production network while the data is being moved. It connects to rehearsals as follows.

When this happens, this feature, and what changes
WhenCore featureWhat changes
The rehearsal source data contains personal dataFormat-preserving transformation. Key columns are one-to-one, the same original becomes the same value in every table, amounts and codes stay as they areCounts, totals, keys and relationships are reconciled with no originals in the rehearsal environment
Inserted row counts have to be checked again in the targetPost-load verification: for tables that were truncated and loaded, compares the target COUNT(*) with the number of rows insertedTables that "succeeded but have a different count" are marked in the run result
You worry about a personal data column that was left without a ruleReads a target sample (1,000 rows by default) with the detection engine and warns about columns that passed through without a ruleYou learn that day which columns in the rehearsal DB still hold originals
Some rows could not be inserted because of their valuesLeaves out only those rows and loads the rest to the end. Keeps counts and keys by reasonLeft-out rows are not hidden, and you have grounds to decide whether to fix or exclude them
2 of 300 tables failedRerun only the failed tables (within 48 hours of the first run, reusing the approval)Tables that succeeded are not truncated and loaded again
A large table was interrupted partwayPartition resume: for tables split by numeric PK range, only the unfinished ranges are redoneRanges that finished are not moved again
Consistency validation really needs real dataRuns marked as real data: only people with that permission can request them, they go through separately defined approval steps, and the loaded tables are deleted automatically after the set periodThe scope, approval and deletion of the exceptional use are kept as records

When a run finishes, the rows read, rows inserted and rows failed are kept for each table. The run report puts the run overview, approval, per-table results, applied rules and verification results on one page. When printed, only that content appears, without menus, so it can be saved as a PDF from the browser. It works well as an attachment to the rehearsal result report.

DataMint Core run detail screen showing the requester and reason, approval steps and approval comment, rows read, loaded and failed per table, number of partitions, and load method
Run detail. It records who requested the run and why, who approved it, and the rows read and loaded for each table. (The console is shown in Korean. The data on screen is demo data.)

You can also measure time in advance. In our own measurement on development hardware, 100 million rows (19 GB) moved between PostgreSQL databases in 3 minutes 31 seconds (about 470,000 rows per second), and in 4 minutes 47 seconds with four transformation rules applied. Engine memory was 1.2 to 1.5 GB. The DB and the engine shared one PC, so this is not production throughput, and it has to be measured again on the client's DB servers. Still, it is enough for timing the large tables first, before the rehearsal.

DataMint Core run history screen showing the job name, status, result, row count, table count, requester, request time and duration of each run
Run history. It accumulates how many rows and tables were moved in each round, and how long it took. (The data on screen is demo data.)

Data migration rehearsal: frequently asked questions

Does row count reconciliation have to be done for every table?

Yes. Even with hundreds of tables, counts can be extracted mechanically, so do all of them. For totals and keys, prioritize tables with amounts and the ledger tables that matter most to the business.

Won't a rehearsal on transformed data give different results from the actual cutover?

What changes is identifying information such as names, numbers and contact details, and the format and length stay the same. So the migration program mostly runs through the same paths. However, if there is logic that branches on name length or special characters, that part has to be checked separately with real values.

When should rehearsal data be deleted?

The clean way is to delete per round, so that no copy from the previous round remains when you prepare the next one. How to set a retention period is covered in test data retention periods and automatic disposal.

Summary: validate a migration rehearsal with the same five reconciliations every round

  • Write the five checks (counts, totals, keys, codes, relationships) in SQL before the rehearsal.
  • Apply the same migration scope condition to counts, and look at three numbers: rows read, rows inserted, and rows actually present.
  • Starting from a transformed copy of the AS-IS, all five reconciliations work without personal data.
  • For validation that really needs real values, narrow the scope and keep records of approval and deletion.

Before the next rehearsal, look at the blanks in your reconciliation sheet first. If there is no "rows actually present in the target" column, start by adding it. Data preparation for the stages before the rehearsal is covered in test data for a core system replacement, stage by stage.

  • #data migration
  • #migration rehearsal
  • #data validation
  • #row count reconciliation
  • #migration validation SQL
  • #core system replacement
  • #test data de-identification

Reviewing how you handle test data?

Tell us how you do it today and what databases you run, and we will look at the options with you.

More posts