Moving a live OLTP (Online Transaction Processing) database is often seen as a high-risk task. A single mistake can lead to outages or data loss, especially when dealing with critical, constantly changing data sources. However, with the right playbook, you can migrate a database to the cloud with zero downtime and no data loss. This guide breaks down the scenarios, tools, and best practices for live migrations, from small instances to multi-terabyte monsters.
The Core Principle: Change Data Capture (CDC)
The secret to a zero-downtime migration is Change Data Capture (CDC). It is a two-phase process:
- Full Load: A bulk transfer of all existing data from the source to the target.
- Replication: A continuous, real-time stream of all new changes (inserts, updates, deletes) from the source to the target. This phase runs concurrently with the full load and continues until the final cutover.
This allows your application to keep writing to the source database while the new database catches up. Once in sync, you simply update your connection string to point to the new cloud database.
Scenario 1: Small Databases (Under 100 GB)
For smaller databases, the migration is less about bandwidth and more about precision. Native migration services from major cloud providers are often the best choice.
- Google Cloud Database Migration Service (DMS): Best for homogenous migrations (e.g., MySQL to Cloud SQL). It uses binary logs or logical replication to stream changes.
- AWS Database Migration Service (DMS): A managed service that supports both homogenous and heterogeneous migrations securely.
- Azure Database Migration Service: Provides a streamlined path for online migrations to Azure managed database services.
Scenario 2: Small MongoDB Migrations
Move self-managed MongoDB replica sets to managed services like Azure Cosmos DB or MongoDB Atlas using live migration tools that tail the oplog for real-time replication.
Scenario 3: Mid-Sized Migrations (100 GB to 200 GB)
At this scale, continue using CDC principles but focus on replication instance performance and monitoring. Third-party tools like Fivetran or Airbyte can provide easier setup for those who don’t want to manage native cloud services directly.
Scenario 4: Enterprise-Scale (1 TB+)
For massive datasets, robust and scalable CDC solutions are required:
- Debezium: An open-source distributed platform for CDC built on Apache Kafka. It’s highly scalable but requires significant effort to maintain.
- Google Cloud Datastream: A serverless, managed CDC service that streams changes in near real-time to destinations like BigQuery or Cloud SQL.
- Enterprise Tools: Solutions like Qlik Replicate or Striim offer premium features for high-performance replication across heterogeneous databases.
Backups and Safety
Always maintain a full, verified backup before starting any migration. Continue your regular backup schedule throughout the process and verify that your backups can be restored successfully in a staging environment.
Final Thoughts
Live database migration is a marathon, not a sprint. The key is to run a pilot migration in a staging environment, test your rollback plan, and maintain clear communication with stakeholders. Meticulous planning and continuous replication are the foundations of a seamless transition.

