Skip to content

Data, QA & Reliability

How to Migrate a Database Without Downtime

Learn how database migration without downtime works: replication, dual compatibility, cutover, validation, rollback and India-specific planning.

25 September 2026MainakMainak

Network cables connected to equipment in a server rack

Database migration without downtime means keeping the application available while data, schema and traffic move from one database to another. In practice, the source remains live, an initial copy loads the target, ongoing changes are replicated, and the team validates both systems before a controlled cutover. “No downtime” does not mean zero risk or zero seconds of impact: network failures, incompatible schema changes and a failed rollback can still disrupt service. The objective is a small, rehearsed and observable switching window with tested recovery.

The hard part is usually not copying rows. It is keeping the old and new application versions, schema, data and integrations compatible at the same time.

Key Takeaways

• A practical online migration can use a full copy plus continuous change replication, followed by validation and a controlled cutover.

• “Zero downtime” is an outcome that must be measured with business transactions; it is not a button or a guarantee from a migration tool.

• The application must support backward and forward compatibility while old and new code overlap.

• The rollback plan depends on what happens to writes after cutover; once new-only writes exist, reversing database state can require replay or fail-forward.

• Run a production-shaped rehearsal, including a restore, lag scenario and application rollback. For the underlying platform decision, start with SQL vs NoSQL.

What does “without downtime” really mean?

A database can remain reachable while a few requests fail, time out or return stale data. That is not a useful zero-downtime result. Define the service-level objective before the plan.

Possible measures include:

• no externally visible 5xx responses for critical transactions;

• no write loss;

• bounded replication lag at cutover;

• acceptable read and write latency during migration;

• a rollback or recovery decision completed within the agreed time.

A small maintenance window may be more honest and safer than claiming zero downtime while running risky dual writes. “Without downtime” is appropriate when business interruption is genuinely unacceptable and the application, network and database support the required pattern.

The phrase also applies to different migration types. Moving from one MySQL version to another is different from changing schema, moving from SQL Server to PostgreSQL, splitting a tenant, moving to a managed cloud database, or replacing a relational system with a document store. Each has different limits and transformation logic.

The online migration pattern

A practical low-disruption migration pattern uses these stages.

1. Assess the source

Document database engine and version, extensions, data types, table size, write rate, peak throughput, existing indexes, triggers, stored procedures, sequences, jobs, encryption features and dependent applications. Inventory every writer, including workers, scripts and third-party integrations.

A migration tool can copy data, but it may not reproduce every object or operational rule. AWS's database migration guide, for example, notes that DMS migrates data, tables and primary keys but not every database object; additional tools may be needed for schema conversion and code. Treat tool coverage as something to verify for the exact source and target.

2. Prepare and size the target

Create matching roles, collations or sort rules, time zones, character sets, extensions and parameters. Confirm the target's maximum database size, connection limits, maintenance windows, backup policy and private connectivity. Load-balancer, DNS and firewall changes should be staged without changing production traffic.

Do not assume the same hardware size produces the same performance after moving engines. Data placement, storage, indexes and database configuration must be reproduced as closely as the target permits.

3. Perform the bulk copy

The first load moves a consistent baseline from source to target. It may be done in chunks and can run while the source continues serving reads and writes. Monitor row counts, bytes, error counts, target capacity and source impact.

A backup-and-restore approach can be simple for a compatible migration, but copying a production backup and then replaying every change has operational consequences. A logical tool may provide more selective control. There is no universal best method; choose based on downtime tolerance, downtime budget, engine compatibility and recovery requirements.

4. Replicate ongoing changes

Change data capture, native replication, log shipping or an event stream carries inserts, updates and deletes made after the baseline. The target should be read-only for production writes until the application is ready to use it.

Lag is the distance between the last source change and its application on the target. A low average is not enough: a brief spike can create a delayed transaction or an inconsistent cutover. Alert on the maximum relevant lag, not only the dashboard average. If the target is in another country, network variability and data-egress requirements must be included.

5. Reconcile and validate

Compare row counts only as a first check. Because updates can change row counts without changing totals, also compare:

• primary-key sets or controlled samples;

• checksums or business aggregates;

• foreign-key integrity;

• null and default behaviour;

• timestamps and time zones;

• sequences and generated identifiers;

• permissions and row-level access;

• application reads through the target.

Run a controlled set of real business transactions against the target using a test tenant or namespace. A checkout, order status change, invoice calculation and notification path are more meaningful than a trivial SELECT 1. For critical statements, capture the slow SQL query optimization evidence before and after the move.

6. Cut over traffic

At the cutover, the application must point to the target. The smallest safe pattern is:

• Put the application into a controlled write-pause or route only the affected feature to maintenance mode.

• Wait until replication lag reaches zero and no in-flight transactions remain.

• Prevent new source writes and record the final position.

• Apply or verify any final schema change.

• Run a small transaction set and smoke check.

• Switch the application configuration or traffic weight.

• Monitor errors, latency, data freshness and queue backlog.

• Remove the write pause only after the acceptance threshold is met.

The exact write pause can be short, but it must be visible in the plan. If the business cannot tolerate even that, a dual-read or blue-green design may be required, but it introduces more state and consistency cases.

Make the application backward compatible

The application is usually the main source of migration failure. Old and new versions may run at the same time during a rolling deployment, and the database may need to satisfy both.

Expand, migrate, contract

Use three phases:

• Expand: add the new table, column or endpoint without removing the old representation.

• Migrate: backfill in small batches, dual-read or replicate to the new store, and verify results.

• Contract: stop old writes, confirm no consumer depends on the old field, then remove it in a later release.

This pattern reduces the chance that an old application instance writes a value the new version cannot read. It also turns a large irreversible change into observable steps.

Be careful with dual writes

Writing to both old and new databases is not automatically safe. If the first write succeeds and the second fails, the databases diverge. If both succeed in a different order, a race can overwrite a newer value. Use idempotency keys, an outbox, a durable event stream or a reconciliation process. Never assume two independent HTTP calls form one transaction.

If the old and new engines are different, define canonical value mapping. Money should not be converted to a floating-point number, timestamps must have a known time zone, and null and missing fields need different treatment. Store money in the smallest sensible unit or an exact decimal representation, never an ambiguous binary float.

Schema changes are migrations too

A migration may keep the same engine but change a table. That can still cause downtime. A blocking ALTER TABLE that rewrites a large table can hold locks, consume I/O and delay production queries. Check the exact engine and version documentation before choosing an online schema tool or statement.

Expand-and-contract is usually safer for application-owned changes:

• Add nullable or default-safe fields.

• Deploy code that can read old and new forms.

• Backfill in bounded batches with a checkpoint.

• Switch reads after validation.

• Stop dual writes.

• Add constraints only after old rows are compliant.

• Remove old columns in a separate change.

Some online DDL features have version, transaction and lock limitations. Test the exact command against a production-sized copy, not a tiny schema.

Rollback is not the same as rollback

Before cutover, rolling back may mean returning application traffic to the old database because the old system remained authoritative. After cutover, that may no longer be safe. If customers have created orders or changed profiles only in the new database, switching traffic back can lose writes.

A migration plan should choose one of these strategies:

• Roll back before new-only writes: restore old traffic if validation fails.

• Fail forward: fix and resume replication, deploy a compatible application, or complete the cutover.

• Reconcile and replay: copy new-only changes back to the source or replay them into the new target.

• Restore from a verified backup: last resort with its own data-loss and recovery analysis.

“Rollback” must be written as a decision tree with owners, commands, data checks and a maximum decision time. It should not mean “change the environment variable and hope”.

India-specific planning for production systems

Network and region path

An on-premises Mumbai or Bengaluru database and a cloud target in another region can be connected through a private network or managed interconnect. Plan capacity during the bulk load, encryption overhead, maintenance traffic and peak business hours. Do not use a developer laptop as the production replication path.

Data residency and cross-border transfer should be reviewed against the organisation's legal obligations and customer contracts. The Digital Personal Data Protection Act, 2023 and MeitY's 2025 rules page are starting points, not a substitute for qualified advice. Encrypt data in transit and at rest, restrict migration accounts, and audit who can read the copy.

Peak Indian ecommerce traffic

A D2C sale, a payment provider callback, a marketplace sync, a WhatsApp notification job and a nightly reconciliation can all write at once. The migration window should be chosen from measured traffic, not a generic midnight assumption. Keep the old system live through the replication test. If payment-related data is involved, use a non-production tenant and synthetic or approved test data; do not create unapproved copies of live customer records.

Support and time zones

A migration can be run in a small window, but the team that can diagnose it may be in a different time zone from the database administrator. Name the incident lead, DBA, application owner, security contact and business approver. Use one clock, one runbook and a communication channel. After cutover, monitor for at least the next business period rather than closing the bridge as soon as the first health check passes.

Rehearsal checklist

Run at least one full rehearsal before production:

• Use a recent, protected production-shaped copy.

• Restore that copy to confirm the backup is usable.

• Measure bulk-copy throughput, replication lag, target CPU, I/O, storage and connection usage.

• Run concurrent reads and writes, not only idle data.

• Deliberately pause a connection and verify the alert and recovery procedure.

• Test the exact application compatibility path and rollback decision.

• Compare data with key sets, aggregates, permissions and sample business transactions.

• Record the commands, owners, timestamps and expected output.

• Restrict production credentials and remove temporary access after the migration.

Our QA automation service can help turn critical journeys and data checks into repeatable release evidence, while database solutions can cover the platform and migration design. The same critical journeys can become durable regression test automation checks.

Frequently asked questions

Can any database be migrated with zero downtime?

No. A migration may be online only when the source and target can support a compatible replication or dual-write design, the application can tolerate overlap, and the network and target capacity are adequate. Large engine changes, broken dependencies, incompatible features or a very small recovery window may require planned downtime.

Is logical replication the same as a backup?

No. A backup is a recoverable copy at a point in time. Replication keeps a target aligned with ongoing source changes. A zero-downtime plan needs a tested backup and restore path in addition to replication.

Should we use dual writes during a database migration?

Only with a design that handles partial failure. Independent writes can diverge. Prefer an outbox, event stream, idempotent reconciliation or a native replication mechanism, and test failure between the two writes.

How do we prove there was no downtime?

Monitor the customer journey, not only database uptime. Use request success rate, error rate, latency, write acknowledgements, queue depth, replication lag and synthetic checkout or login checks during the cutover. Keep the evidence with the migration record.

Migrate with a reversible plan, not a heroic cutover

The safest database migration is boring: inventory, copy, replicate, validate, switch a controlled slice, observe, expand or roll back according to the written rule. Your database choice can be revisited in SQL vs NoSQL, but the migration safety pattern remains the same.

Need help designing a migration runbook for a production application? Talk to GrowMyStore about database solutions with the source, target, data volume, peak write rate and acceptable recovery window. We will map the compatibility, replication, validation and cutover steps before touching production.

How to Migrate a Database Without Downtime | GrowMyStore