Technical guide

Planning a Legacy Database Migration

A database migration has to preserve the work people do with the data: entering records, producing reports and running scheduled jobs. Plan around those workflows from the start, then use them to decide when the new system is ready.

4 min read

Assess the source and agree the scope

Record the database engine and version, data volumes, growth, busy periods and the time available for maintenance. Find out which applications write to it, which teams depend on reports and which jobs run overnight. Ask the people doing the work what must be available immediately after the switch and what can wait.

Decide which records move and which stay in a read-only archive. Agree how long the archive must remain usable and who needs access. Capture baseline timings for representative jobs and reports so you can compare the new system against the current one during rehearsal. A backup is useful only if the team knows how to restore it and how long that takes.

Discover schema and dependencies

Start with tables, primary keys and foreign keys, then trace views, triggers, procedures and scheduled jobs. SQL Server's sys.foreign_keys and Oracle's ALL_CONSTRAINTS can help establish declared relationships. Check which schemas your account can see before assuming the inventory is complete.

Look beyond the database catalogue

Dynamic SQL, external reporting and relationships maintained in application code may escape a catalogue search. Review job definitions, application configuration and representative query activity with the system owners. Document the objects each workflow reads or writes, including cross-database references, linked servers or Oracle database links. This gives you a migration order and a list of workflows that must pass testing.

Map fields and test compatibility

Profile duplicates, nulls, orphaned records and values outside the intended range. Agree how to handle each exception and record the decision in the mapping. For each transformed column, specify the source, destination, conversion and treatment of invalid values. Test identity or sequence behaviour so that the first record created after cutover receives a valid new key.

Also compare numeric precision, text lengths and comparison rules. If the target compares text without regard to case and the source permits two keys that differ only in case, test how the target unique index handles those rows. Find those conflicts early enough to agree a resolution with the people who use the records.

Choose a migration strategy you can rehearse

A planned write freeze and full copy can work when the business can tolerate the downtime. Measure the complete window, including extract, load, reconciliation and the application switch. If that window is too long, consider an initial copy followed by change capture or replication where supported. Rehearse the final sync and demonstrate that inserts, updates and deletes arrive in the correct order.

Moving in phases can make sense when business areas have clear boundaries. Check what happens to shared records during the transition and decide which system is authoritative for each dataset. If both applications can edit the same customer or stock record, agree a synchronisation rule before allowing parallel operation.

Reconcile data and test business workflows

Take source and target measurements at comparable points in time. Compare row counts by table and by business scope, such as open orders or transactions for a particular month. Reconcile key totals, check for orphaned records and inspect representative values by key. Row counts can agree even when a date conversion or field mapping is wrong.

Use a representative test environment to run the real workflows, including creating new records, running reports and processing scheduled imports. Keep a reconciliation record with expected totals, observed totals and explanations for agreed differences. Assign someone to sign off each business area and define which failures block cutover.

Plan cutover, rollback and continuity

Write a timed cutover plan with named owners. Include the write freeze, final backup and sync, reconciliation, connection changes and checks before reopening access. Tell users when the system will be unavailable, who to contact and how to record work that cannot wait.

Set a latest rollback decision time and clear triggers, such as a failed reconciliation or an application unable to post transactions. Rehearse restoring service on the old system. If the new system accepts writes before rollback, plan how to retain or replay those changes before reopening the old system. Switching the connection back by itself can leave recent transactions behind.

Decide when you are ready to switch

Keep the migration date provisional until a rehearsal fits the available window and meets the acceptance checks. Common causes of surprises are untracked scheduled jobs, test samples that omit problem records and backups that have never been restored. Use the rehearsal to uncover these issues while there is still time to change the plan.

Help with your project

If you need help mapping an existing database, checking a migration or adapting the software that uses it, tell us what is changing and what must stay available.

Discuss your project