Database Migration Service in Google Cloud: Moving Live Databases Without Stopping the Business
A thorough, plain-English guide to Google's managed service for moving databases into Cloud SQL and AlloyDB, covering one-time and continuous migrations, same-engine and cross-engine moves, schema conversion, connectivity, security, monitoring, cutover, and the planning habits that make migrations uneventful.
Imagine you run a busy restaurant and you must move the entire kitchen to a new building. You cannot close for a month. So you build the new kitchen next door, copy every recipe and every ingredient into it, and then keep a runner carrying over each new order and each change to a recipe while the old kitchen keeps cooking. When the two kitchens are perfectly in step, you pick a quiet moment, tell the staff to switch, and the restaurant keeps serving with barely a pause. Database Migration Service is that careful runner for databases. It copies a database to Google Cloud, keeps the copy in step with the original as changes arrive, and lets you switch over in minutes instead of days. This guide explains how the whole operation works, why each step exists, and how to plan one so that cutover night is boring, which is exactly what you want.
1What Database Migration Service Really Is
Before diving in, we need a clear picture of the problem this service solves and what it actually delivers.
Why database migration is hard
Moving files is simple compared with moving a database. A database is alive. It is constantly being read and written by applications, and every write changes the data you are trying to copy. If you copy a large database the simple way, by taking a full backup and restoring it elsewhere, the copy is already out of date by the time it finishes, and the only safe way to catch up is to stop the application for the whole time. For a small database that might mean minutes. For a large one it can mean many hours or days of downtime, which most businesses cannot accept.
There are other difficulties too. The source and destination may use different database software, with different data types, different procedural languages, and different behaviors. Networks between the old and new locations must be secured. Permissions and settings must be right. And someone must verify that nothing was lost. Doing all of this by hand with custom scripts is slow, risky, and hard to repeat.
What the service gives you
Database Migration Service is a managed, serverless service that moves databases into Google Cloud’s managed database offerings. Today it focuses on migrating into Cloud SQL and into AlloyDB for PostgreSQL. It takes care of networking setup, the initial snapshot, ongoing replication of changes, progress reporting, and the final switch of the destination to become a standalone primary database. Because it is serverless, you do not provision or manage any migration servers. You describe the source and destination, start a migration job, and watch it work.
Think of a professional moving company that does not just carry boxes but also keeps your mail forwarded to the new address until the move is complete, so you never miss a letter. The service not only copies the data but keeps forwarding new changes to the destination until you are ready to switch.
This service moves databases into Google Cloud. It is not the right tool for moving plain files, which has its own transfer service, and it is not an application migration tool. It is focused on the database layer and its data and schema.
2Core Concepts and Vocabulary
Every service has its own words. These are the ones you will meet in almost every migration conversation.
Source Database
The database you are moving from. It may be on premises, in another cloud, or on a virtual machine.
Destination Database
The managed database in Google Cloud that receives the data, such as a Cloud SQL instance or an AlloyDB cluster.
Connection Profile
A saved description of how to reach and authenticate to a source or destination, reusable across migration jobs.
Migration Job
The running definition of one migration: which source, which destination, what type, and how they connect.
Initial Snapshot
The first full copy of the source data, loaded into the destination to give replication a starting point.
Change Data Capture
The technique of recognizing and copying only the inserts, updates, and deletes made after the snapshot.
Promotion
The final step that detaches the destination from the source and turns it into an independent primary database.
Conversion Workspace
An environment for translating the schema and code of one database engine into another during cross-engine migrations.
How the words fit together
You begin by describing your source in a connection profile and by creating or choosing a destination. A migration job ties them together. The service takes an initial snapshot, loads it, and then uses change data capture to keep the destination in step. When you are ready, you promote the destination so it becomes the primary, and you point your applications at it. If the engines differ, a conversion workspace first translates the schema and code so the destination can understand them.
Imagine translating and publishing a book in a new language. The conversion workspace is the translation desk. The snapshot is the first full printing. Change data capture is the stream of corrections that arrive after printing, which are applied to the new edition. Promotion is the day the new edition officially replaces the old one on the shelves.
Promotion is a one-way door. After you promote, the destination no longer follows the source and cannot simply be reattached to it. Make sure the source and destination are in sync and your applications are ready before you press that button.
3Migration Types: One-Time versus Continuous
The first design choice is whether the copy is a single moment in time or a living stream that stays current.
One-time migration
A one-time migration takes a single point-in-time snapshot of the source database and applies it to the destination. It is a dump and load: the data is read out, written in, and the destination is ready when the load finishes. Any changes made to the source after the snapshot are not carried over. This approach is simple and suits databases that can be frozen, meaning the application can stop writing during the migration, or datasets that do not change, such as archives or test copies. The downtime is the whole duration of the copy, so it is best for smaller databases or planned maintenance windows.
Continuous migration
A continuous migration, sometimes called ongoing or online migration, starts with a full snapshot and then keeps copying every change as it happens. This is based on change data capture, which finds the inserts, updates, and deletes that occur after the snapshot and replays them on the destination. The application keeps running on the source the whole time. When source and destination are caught up, you switch over, and downtime shrinks from hours to a short moment.
flowchart TD
A["Start migration job"] --> B["Initial snapshot of source"]
B --> C["Load snapshot into destination"]
C --> D["Continuous replication of changes"]
D --> E{"Destination caught up?"}
E -->|"Not yet"| D
E -->|"Yes"| F["Plan cutover window"]
F --> G["Stop writes to source"]
G --> H["Promote destination"]
H --> I["Point applications to destination"]
Choosing between them
| Aspect | One-time | Continuous |
|---|---|---|
| How it copies | One snapshot, dump and load | Snapshot followed by ongoing change replication |
| Source writes during migration | Must stop, or accept they are not copied | Source keeps running normally |
| Downtime | Whole duration of the copy | Short, only around the final switch |
| Best for | Small databases, archives, test copies | Production databases that cannot be offline long |
| Complexity | Lower | Higher, with more prerequisites on the source |
A one-time migration is like photocopying a book and handing over the copy. Anything written in the original afterward is missing. A continuous migration is like a live subscription that keeps sending every new page to the copy until you declare the copy final.
If your database serves customers around the clock, assume you need continuous migration. Choose a one-time migration only when you are certain a write freeze is acceptable and the copy will finish inside your window.
4Homogeneous and Heterogeneous Migrations
The second big choice is whether you are keeping the same database engine or changing it.
Homogeneous migrations
A homogeneous migration moves data between the same database technology, for example from MySQL to Cloud SQL for MySQL, or from PostgreSQL to Cloud SQL for PostgreSQL or AlloyDB for PostgreSQL. Because the engines match, the data types, the code, and the behavior all line up. The job is mostly about copying data safely and keeping it in sync. This is the easier kind of migration and the one most teams start with.
Heterogeneous migrations
A heterogeneous migration changes the engine, for example from Oracle to Cloud SQL for PostgreSQL or AlloyDB for PostgreSQL, or from SQL Server to Cloud SQL for PostgreSQL. Here the source and destination speak different dialects. Data types differ, stored code such as procedures, functions, and triggers is written in different languages, and features do not map one to one. Before data can flow, the schema and code must be converted into a form the destination understands.
Same engine, self-managed to managed
Move a MySQL or PostgreSQL database from a virtual machine or data center into a managed Google Cloud service.
Same engine, other cloud to Google Cloud
Move from a managed database at another cloud provider into Cloud SQL or AlloyDB.
Oracle to PostgreSQL
Move an Oracle database to PostgreSQL-compatible Cloud SQL or AlloyDB, converting schema and code in the process.
SQL Server to PostgreSQL
Move a SQL Server database to PostgreSQL-compatible destinations with conversion of schema and objects.
Moving a family between two houses of the same design is a homogeneous move. Furniture fits where it did before. Moving to a house with a different layout, different outlets, and different plumbing is a heterogeneous move. Some furniture must be rebuilt or replaced, and the electrician has to rewire some things.
What changes in a heterogeneous project
Assess the source
Inventory tables, data types, views, stored procedures, functions, triggers, and any engine-specific features your applications rely on.
Convert schema and code
Use a conversion workspace to translate objects automatically, then review and repair what could not be translated.
Apply the converted schema
Create the converted structures in the destination so data has somewhere compatible to land.
Migrate the data
Run the migration job to load the snapshot and replicate changes into the converted schema.
Adapt the application
Update application queries and code that used engine-specific features, and test thoroughly against the new engine.
The list of supported source engines, destination engines, versions, and migration scenarios is updated over time. Always confirm your exact pairing, including database versions, against the official supported scenarios before you commit to a plan.
5Destinations: Cloud SQL and AlloyDB
Understanding where your data is going helps you choose the right target and size it properly.
Cloud SQL
Cloud SQL is Google Cloud’s fully managed relational database service for engines such as MySQL, PostgreSQL, and SQL Server. Google handles provisioning, patching, backups, replication, and failover, while you manage your schema, data, and queries. It is a natural landing place for typical business applications that previously ran on self-managed database servers.
AlloyDB for PostgreSQL
AlloyDB is a PostgreSQL-compatible managed database designed for demanding workloads that need high performance and high availability, with a separation of compute and storage and features aimed at transactional and analytical needs. It is often chosen when a PostgreSQL workload outgrows a standard managed instance or when stronger performance and availability characteristics are desired.
| Destination | Typical fit | Consider when |
|---|---|---|
| Cloud SQL for MySQL | Web and business applications on MySQL | You want a managed MySQL with minimal change |
| Cloud SQL for PostgreSQL | General PostgreSQL workloads | You want managed PostgreSQL, or are leaving another engine |
| Cloud SQL for SQL Server | Applications tied to SQL Server features | You want to stay on SQL Server in a managed form |
| AlloyDB for PostgreSQL | Demanding PostgreSQL workloads | You need higher performance and availability for PostgreSQL |
Size the destination for the workload it will carry after cutover, not just for the data volume. A destination that is too small will struggle during the initial load and again under production traffic. Confirm which destinations and versions your chosen scenario supports.
Managed services change your responsibilities
Moving from a self-managed database to a managed service shifts work. You no longer patch operating systems, schedule backups by hand, or build replication yourself. In exchange, you give up some low-level control, such as access to the underlying machine and certain server settings. Review the features and settings your applications depend on, and confirm they are supported in the managed destination before you start.
Moving from owning a car to using a managed vehicle service means you stop changing oil and renewing registration yourself. In return, you cannot rebuild the engine in your garage. For most people the trade is excellent, but you should check that the service offers what you need.
6Architecture and Internal Working
What actually happens behind the scenes between creating a job and having a synchronized destination?
The main components
Connection profiles
Store how to reach and authenticate to the source and the destination.
The migration job
Holds the configuration, state, and progress of the migration and orchestrates every phase.
Serverless workers
Managed processes that read from the source, write to the destination, and replay changes, without you running any servers.
The secure network path
The chosen connectivity method that carries data between the source and Google Cloud.
Monitoring and status
Charts and states that show where the job is and how far behind the destination is.
flowchart LR
SRC["Source database on premises or other cloud"] -->|"Secure connectivity"| DMS["Database Migration Service workers"]
DMS -->|"Snapshot and change stream"| DST["Destination in Google Cloud"]
DMS --> MON["Job status and charts"]
APP["Applications"] --> SRC
DST -.->|"After promotion"| APP
The phases of a continuous job
A continuous job passes through recognizable states. After you create and start it, the service begins a full dump, which is the initial snapshot of the source. Once the dump is loaded, the job enters a change data capture phase where it continuously applies new changes. While in this phase, the job reports how far behind the destination is, a number known as replication delay. When the delay is near zero and you have prepared your cutover, the job is ready to be promoted. During promotion, the service finalizes replication and detaches the destination so it can accept writes independently.
stateDiagram-v2
[*] --> Created
Created --> Running: Start job
Running --> FullDump: Snapshot loading
FullDump --> CDC: Snapshot complete
CDC --> ReadyForPromote: Delay near zero
ReadyForPromote --> Promoting: You promote
Promoting --> Completed: Destination detached
Running --> Failed: Unrecoverable error
CDC --> Paused: You pause
Paused --> CDC: You resume
How changes are captured
Every database keeps an internal record of changes it makes, used for its own recovery and replication. The service reads from that record to learn which rows were inserted, updated, or deleted after the snapshot. This is why the source database must be configured to keep that record in a suitable form, and to keep it long enough for the migration to read it. If the record is discarded too soon, the service loses its place and the job may have to start over.
Imagine a bank that keeps a ledger of every transaction. To keep a second bank’s books identical, you copy the starting balances once, then read the ledger line by line and replay each entry. If the ledger pages are shredded before you read them, you lose your place. Keeping the ledger long enough is a source-side responsibility.
If a job pauses or falls far behind and the source discards its change records, replication cannot resume cleanly. Size retention for the longest delay you might face, and keep an eye on lag.
7Connectivity: Reaching the Source Safely
Networking is often the trickiest part of a migration. The service offers several ways to connect, each with its own trade-offs.
The connectivity options
IP allowlist
The source allows connections from the service’s known outgoing addresses. Simple to set up, with traffic over the internet protected by encryption.
Reverse SSH tunnel
A secure tunnel is opened from your side through a bastion host, so the source does not need to accept inbound connections from the internet.
VPC peering
A private connection between networks, usable when the source is reachable inside a Google Cloud virtual network, including through VPN or interconnect.
Choosing a method
| Situation | Better method | Why |
|---|---|---|
| Source is internet reachable and you want speed of setup | IP allowlist | Fewest moving parts |
| Source sits behind a strict firewall with no inbound access | Reverse SSH tunnel | Connection is initiated from your side |
| Source is already in a Google Cloud network or linked by VPN or interconnect | VPC peering | Private path, no public exposure |
| Very large data volumes and strict security | Private connectivity with dedicated link | Stable bandwidth and private traffic |
Think of three ways to deliver a package into a guarded building. You can give the courier a pass at the front gate, which is the allowlist. You can have someone inside come out and meet the courier, which is the reverse tunnel. Or you can have a private corridor between the two buildings, which is peering.
Encryption on the wire
The service encrypts connections using SSL and TLS certificates, so data moving between the source and Google Cloud cannot be read in transit. Where your source database supports it, you should require encrypted connections and use certificates for verification. For continuous migrations, customer-managed encryption keys can also be used to protect migration data, which suits organizations with strict key control policies.
Network planning checklist
Check address ranges
Make sure address ranges of connected networks do not overlap, which would break routing.
Open the right ports and rules
Allow the database port from the migration path and confirm firewall rules on both sides.
Estimate bandwidth
Divide the data size by realistic throughput to estimate how long the initial load will take.
Test connectivity early
Use the service’s connection test before starting, so network problems surface on day one, not during cutover.
Spend time on the network design first. Most stalled migrations are not caused by data problems but by a firewall rule, an overlapping range, or a missing route that nobody tested.
8Schema and Code Conversion for Cross-Engine Moves
When the engine changes, the hard part is translating the structure and the logic of the database, not moving the rows.
What needs converting
A database is more than tables of data. It holds data types, constraints, indexes, views, and, importantly, programmable objects such as stored procedures, functions, packages, and triggers. Each engine has its own language and its own special features. A procedure written for one engine often cannot run on another without rewriting. Conversion is the process of mapping all of these objects to equivalents in the destination engine.
Conversion workspaces
The service provides conversion workspaces to make this manageable. When you create a workspace, an initial automatic conversion runs, translating as much of the schema and code as it can. You then work in an interactive SQL editor to review the results, fix objects that could not be translated automatically, and adjust the converted schema to better suit the destination. Customization directives let you override automated rules, for example to map a data type differently or rename objects consistently.
Help from generative assistance
The service also offers Gemini-powered conversion features that suggest translations for harder pieces of code, helping accelerate the work. These suggestions should always be treated as drafts to be reviewed and tested, never as final answers, because subtle behavior differences between engines can change results in ways that look correct but are not.
flowchart TD
A["Connect to source and read schema"] --> B["Create conversion workspace"]
B --> C["Automatic initial conversion"]
C --> D{"All objects converted?"}
D -->|"Yes"| F["Review and test"]
D -->|"No"| E["Fix in SQL editor with assistance"]
E --> F
F --> G["Apply schema to destination"]
G --> H["Run data migration job"]
Converting a database is like translating a legal contract into another language and legal system. A translation tool can handle most sentences, but experts must check the tricky clauses, because a small difference in meaning can change the outcome.
Common conversion trouble spots
Data type differences
Numbers, dates, and text types behave differently across engines, affecting precision and sorting.
Stored code
Procedures, functions, and triggers use engine-specific languages and often need manual rewriting.
Empty strings and nulls
Engines treat empty text and missing values differently, which can silently change query results.
Auto-numbering
Sequences and identity columns work differently and must be recreated and set to the right starting values.
Case and collation
Rules for sorting and comparing text differ, so the same query can return rows in a different order.
Proprietary features
Engine-specific features may have no direct equivalent and require redesign.
A converted schema that loads without errors is not a converted application. Run your real application tests, reports, and edge cases against the destination, comparing results with the source, before trusting the conversion.
9Preparing the Source and Destination
Most migration surprises come from skipping preparation. A short list of prerequisites prevents a long list of problems.
Preparing the source
The exact steps depend on the engine, but the themes are consistent. The source must allow replication-style access, which means a dedicated user with the right privileges to read data and change records. It must keep its change log in the form and for the duration the migration needs. Certain settings, such as how changes are recorded, may need adjusting. Some settings require a restart of the source, which should be planned for a maintenance window. Tables without primary keys can be a problem for change replication, since there may be no reliable way to identify which row changed, so identify and fix them early.
Create a migration user
Use a dedicated account with the minimum privileges required for reading data and change records.
Enable change recording
Configure the source to keep its change log in the format the migration needs.
Set sufficient retention
Keep change records long enough to cover the initial load and any pause or lag.
Fix tables without keys
Add primary keys, or plan how those tables will be handled, so changes can be applied correctly.
Check versions and extensions
Confirm the source version is supported, and note extensions or features that must exist at the destination.
Preparing the destination
Create a destination of adequate size and with the right version, and decide on its location, high availability, and backup settings. Consider performing the heavy initial load on a destination with generous resources and scaling down afterward, since loading is more demanding than steady-state use. Make sure required extensions and configuration flags are available, and plan storage with room for growth, because the destination often stores more than the source due to indexes and different storage layouts.
Preparing the people and the plan
Define success criteria
Agree what a successful migration means, including row counts, performance targets, and maximum acceptable downtime.
Write the cutover runbook
Document each step, who performs it, how long it takes, and how to roll back.
Schedule a rehearsal
Run the entire process on a copy of production first to find problems and measure timings.
Align stakeholders
Tell application owners, support teams, and business leaders when the window is and what to expect.
Before a big concert, the crew does a full dress rehearsal. They test the lights, the sound, and the stage changes, and they find out that one cable is too short. A migration rehearsal is the dress rehearsal that saves the live show.
Time every step in the rehearsal. The real cutover will follow the same timeline, and the numbers let you promise stakeholders a realistic downtime instead of a guess.
10Cutover: Promotion and Switching Applications
Cutover is the moment of truth. With preparation, it is a calm, short, rehearsed sequence.
The cutover sequence
Confirm the destination is caught up
Check that replication delay is near zero and that no errors are pending in the migration job.
Stop writes at the source
Pause applications or put them into read-only mode so no new changes occur after this point.
Let the final changes drain
Wait until the last changes have reached the destination and the delay is truly zero.
Validate the data
Run agreed checks, such as row counts and sample comparisons, between source and destination.
Promote the destination
Finalize replication so the destination becomes an independent primary that can accept writes.
Repoint applications
Change connection settings to the destination and restart or resume the applications.
Verify and monitor closely
Run smoke tests, watch performance and errors, and keep the team on call for the first hours.
sequenceDiagram
participant O as Operator
participant A as Application
participant S as Source database
participant J as Migration job
participant D as Destination database
O->>J: Check replication delay
O->>A: Stop writes
A-xS: No new writes
J->>D: Apply final changes
O->>D: Validate data
O->>J: Promote
J->>D: Detach and make primary
O->>A: Point to destination
A->>D: Read and write
No dual writes
An important rule is that the service does not support writing to and reading from both source and destination at once. During migration the source is the system of record, and the destination follows it. After promotion, the destination becomes the system of record. There is no stage where both accept writes and stay merged. Planning for a clean, one-direction switch avoids data conflicts that are extremely hard to untangle.
Having a way back
Before cutover, decide how you would return to the source if something goes badly wrong. Keep the source intact and unchanged for an agreed period after promotion, and think through what would happen to any new writes that reached the destination if you must roll back. For some scenarios, reverse replication back to the original engine is possible, which can provide a safety net, but you should check whether your scenario supports it. Never decommission the source until the new environment has proven itself.
After promotion, the destination diverges from the source. Any rollback plan must account for writes made after that moment. Decide your go or no-go criteria before the cutover window, not during it.
Cutting over is like a relay race handoff. Both runners move at the same speed side by side, one reaches out, and the baton passes. If you hand over while one runner is still sprinting ahead, the baton drops. Waiting for zero delay is making sure both runners are in step.
11Security, Identity, and Compliance
Migrating a database means handling your most valuable data. Security needs deliberate attention at every step.
Identity and access
Access to create and manage migration jobs is governed by Google Cloud identity and access management. Grant the migration roles only to the people who run migrations, and separate those who can start and promote jobs from those who can only view them. On the database side, use a dedicated migration account with the narrowest privileges that work, and remove or disable it when the project is over.
Least-privilege roles
Limit who can create, start, and promote jobs, and give viewers read-only access.
Dedicated migration user
Use a separate database account with only the privileges needed, and retire it afterward.
Encrypted connections
Use SSL and TLS with certificates to protect data between source and destination.
Customer-managed keys
Where supported, protect migration data and destinations with keys you control.
Private networking
Prefer private connectivity over public exposure, especially for sensitive data.
Audit logging
Record who changed or promoted jobs so there is an evidence trail for compliance.
Handling credentials
Connection profiles hold credentials for reaching the source. Treat those credentials as secrets. Do not paste passwords into tickets, chat, or shared documents. Use a strong unique password for the migration account, restrict where it can connect from, and rotate or disable it as soon as the migration is finished.
Data residency and regulation
The location you choose for the destination determines where your data will physically reside, which matters for data residency laws and internal policy. During migration data also passes through the service’s processing, so confirm the service’s location handling meets your requirements. For regulated data such as financial or health records, involve your compliance team early and keep records of what was migrated, when, and by whom.
Rehearsals often use copies of production data. Treat those copies with the same protection as production, or mask the sensitive fields, and delete them when no longer needed.
Moving valuables between two vaults needs an armored truck, named and authorized guards, sealed containers, and a written log. Skimping on any one of these invites trouble, even if the route is short.
12Monitoring, Validation, and Troubleshooting
A migration you cannot see is a migration you cannot trust. The service offers status and charts, and you should add your own validation.
What the service shows
The console shows the state of each migration job, with charts for things like replication delay and storage usage, and many scenarios let you filter by individual database inside the job. Replication delay is the key number: it tells you how far the destination trails the source. A steady low value means healthy replication. A growing value means the destination is falling behind and you should investigate.
Validating the data yourself
Do not rely only on the job’s status. Run independent checks that matter to your business.
| Check | What it proves |
|---|---|
| Row counts per table | Nothing was lost or duplicated at a basic level |
| Checksums or aggregates on key columns | Content matches, not just counts |
| Sample record comparison | Specific rows are identical on both sides |
| Object inventory | Tables, indexes, views, and code objects all exist |
| Application test suite | Business behavior is the same on the new database |
| Performance comparison | Key queries run as fast as, or faster than, before |
Common problems and what they usually mean
Cannot connect to the source
Usually a firewall rule, an address that is not allowed, a missing route, or a certificate issue. Use the connection test and check each hop.
Permission errors on the source
The migration user lacks a required privilege. Compare its grants with the documented prerequisites.
Replication delay keeps growing
Source write volume may exceed what the destination or network can apply. Increase destination resources, check bandwidth, and look for very large transactions.
Job fails on certain tables
Look for unsupported data types, tables without primary keys, or objects that failed conversion.
Destination runs out of space
Storage was underestimated. Increase capacity, since destinations often need more room than the source.
flowchart TD
A["Job unhealthy"] --> B{"Which symptom?"}
B -->|"Cannot connect"| C["Check network, firewall, certificates"]
B -->|"Permission error"| D["Compare user grants to prerequisites"]
B -->|"Delay growing"| E["Check write rate, bandwidth, destination size"]
B -->|"Table errors"| F["Check types, keys, conversion results"]
C --> G["Retest and resume"]
D --> G
E --> G
F --> G
Set alerts for rising replication delay and for any job entering a failed state, so that people are told quickly, even outside working hours during a long migration.
13Cost, Limits, and Trade-offs
Understanding what you pay for, and what the service cannot do, keeps expectations realistic.
What drives the cost
For many supported migration scenarios, the service itself has been offered at no additional charge for the migration into Cloud SQL or AlloyDB, while you pay for the resources you use around it. However, pricing and eligibility can differ by scenario and change over time, so always confirm on the official pricing page. The real costs of a migration are usually the destination database during and after the move, any network charges for transferring data, the machines and links you use to connect, the storage for snapshots and logs, and the people-time for planning, rehearsal, and testing.
Destination resources
The Cloud SQL or AlloyDB instance runs, and is billed, from the time you create it, including during the long initial load.
Network and connectivity
Data transfer charges and any VPN, interconnect, or bastion host used to reach the source.
Source egress fees
When the source is in another cloud, that provider may charge to move data out.
Parallel running
Paying for both environments during the migration and the safety period afterward.
Rehearsal environments
Test destinations and copies used for practice runs, which should be deleted afterward.
Advantages and trade-offs
Advantages
- Serverless, with no migration servers to build and operate
- Continuous replication gives very short downtime
- Supports both same-engine and cross-engine moves
- Conversion workspaces and generative assistance speed up schema work
- Built-in monitoring and encrypted connections
- Repeatable and documented instead of hand-built scripts
Disadvantages / Trade-offs
- Focused on specific supported sources and destinations
- Source prerequisites may require configuration changes or restarts
- Cross-engine conversion still needs careful human review
- Promotion is one-way, so cutover must be planned well
- No dual-write scenario where both sides accept writes
Comparing approaches to database migration
| Approach | Best for | Main drawback |
|---|---|---|
| Database Migration Service | Moving into Cloud SQL or AlloyDB with low downtime | Limited to supported scenarios |
| Native dump and restore | Small databases where downtime is acceptable | Downtime grows with database size |
| Native replication set up by hand | Teams with deep engine expertise and special needs | You build and monitor everything yourself |
| Third-party replication tools | Unsupported pairings or special requirements | Extra licensing and operational effort |
| Rebuild on a new data model | Applications being redesigned anyway | Largest effort and risk |
Pricing, supported versions, and limits are updated by Google Cloud over time. Treat anything you read here as a starting point and confirm against the official documentation and pricing pages before finalizing a plan.
14Use Cases Beyond a Simple Move
The same replication machinery supports several scenarios beyond one-off migrations into the cloud.
Lift and shift to a managed service
Move databases from virtual machines or data centers into Cloud SQL or AlloyDB so that backups, patching, and failover become Google’s responsibility and the team can focus on applications.
Leaving another cloud
Replicate a managed database from another cloud provider into Google Cloud, switching over when ready, as part of a consolidation or a strategic change of platform.
Moving off a proprietary engine
Convert from a costly proprietary engine to PostgreSQL-compatible Cloud SQL or AlloyDB, reducing licensing costs and gaining open ecosystem benefits, with conversion workspaces handling the heavy schema work.
Multi-cloud read availability
Continuously replicate a database from another provider into Google Cloud so that read workloads, such as reporting or analytics, can be served from Google Cloud while the original remains the primary. This is one-directional and does not offer dual writes.
Cross-region read replicas and staging copies
Use continuous replication to keep a copy in a different region for reads, testing, or training, instead of working directly against production.
What these have in common
In each case, the pattern is the same: snapshot the source, replay changes continuously, and decide deliberately when to switch or stop. Understanding that pattern lets you adapt the service to new needs while keeping the safety rules in mind, especially the rule that only one side accepts writes at any given time.
A newspaper printed in two cities from one master copy is similar. The master is edited in one place, and the other city receives every change and prints local copies. Readers in the second city get fresh news without disturbing the editors, but the editors never take instructions from the second city.
15Design Patterns and Anti-patterns
Teams that migrate well tend to repeat a few sound patterns. Teams that struggle tend to repeat a few avoidable mistakes.
Patterns worth adopting
Assess, convert, rehearse, cut over
Follow a clear sequence: assess the source, convert what needs converting, rehearse on a copy of production, then perform the real cutover. Each stage produces evidence that the next stage is safe.
Migrate in waves by dependency
Group databases by how applications depend on them and migrate related systems together, starting with low-risk ones to build experience.
Reusable connection profiles and runbooks
Standardize connection settings and write a runbook template so each additional database follows the same proven steps.
Parallel validation before promotion
Point a copy of the application or a test harness at the destination while replication is still running, validating behavior long before the cutover window.
Keep the source as a safety net
Retain the source unchanged for an agreed period after promotion, and retire it only when the new environment has been stable and verified.
Anti-patterns to avoid
Problem
The team goes straight to the production cutover without a full rehearsal.
Why It’s Harmful
Surprises in permissions, timing, network paths, and application behavior appear in the middle of the real window, forcing rushed decisions and extended downtime.
Correct Approach
Rehearse the entire process on a production-like copy, time every step, and fix what you learn before the real event.
Problem
Promoting the destination while replication delay is still above zero, or before writes have stopped.
Why It’s Harmful
The last few changes never reach the destination, silently losing data that is hard to detect and impossible to recover after the source diverges.
Correct Approach
Stop writes, let the delay drain to zero, validate, and only then promote.
Problem
The converted schema is trusted because it loaded without errors, with no behavioral testing.
Why It’s Harmful
Subtle differences in types, null handling, sorting, and stored code produce wrong results that look plausible and are discovered by customers.
Correct Approach
Compare query results and run the full application test suite against the destination before cutover.
Problem
Change log retention on the source is left at a low default value.
Why It’s Harmful
If the job pauses or lags, the source discards the changes the service needs, and the migration has to start again from the beginning.
Correct Approach
Set retention to comfortably exceed the longest expected pause or delay, and alert on lag.
Problem
The destination is undersized to save money during the initial load.
Why It’s Harmful
The load runs slowly, replication delay builds, and the destination may struggle under real traffic after cutover.
Correct Approach
Size generously for the load and the post-cutover workload, and scale down afterward if appropriate.
Problem
The source is shut down immediately after promotion.
Why It’s Harmful
Hidden problems appear days later, when the original is gone and there is nothing to compare against or fall back to.
Correct Approach
Keep the source intact for an agreed safety period and retire it only after the new system has proven stable.
16Best Practices and Common Mistakes
A checklist of habits that experienced teams build into every database migration, and the traps that catch newcomers.
Best practices
Confirm support first
Verify your exact source version, destination, and scenario against the supported list before planning anything else.
Assess thoroughly
Inventory objects, sizes, write rates, dependencies, and unsupported features so there are no discoveries late in the project.
Design the network early
Choose a connectivity method, check address ranges, and test the connection well before the migration window.
Rehearse end to end
Run the complete migration and cutover on a copy, record timings, and refine the runbook.
Keep security tight
Use a least-privilege migration user, encrypted connections, and private networking where possible, and clean up credentials afterward.
Monitor delay and errors
Watch replication delay closely and alert on failures so problems are caught fast.
Validate independently
Check counts, checksums, samples, and application behavior rather than trusting job status alone.
Define go or no-go criteria
Agree in advance what conditions allow promotion and what triggers a rollback.
Plan the aftercare
Keep the source for a safety period, tune the destination, and delete rehearsal environments and temporary access.
Common mistakes
Assuming the first copy will be quick. Large databases over modest links can take days, so calculate the time and plan around it.
Discovering mid-migration that some tables cannot be replicated reliably. Find and address them during assessment.
Migrating data but leaving auto-numbering counters at the wrong values, so new inserts after cutover collide with existing rows. Verify and reset them before going live.
Assuming a cross-engine conversion is finished once the tool reports success. Complex code always needs human review and testing.
Missing a forgotten service, scheduled job, or report that still writes to the source after cutover, causing split data. Inventory every client of the database in advance.
Verifying that data matches but not that queries run fast. Different engines and configurations plan queries differently, so test the slowest and most important ones.
A short pre-cutover review
| Question | What a good answer looks like |
|---|---|
| Is the destination caught up? | Replication delay at or near zero and stable |
| Do we know every client of the database? | A complete, reviewed inventory of applications and jobs |
| Did we rehearse? | A full dress rehearsal with recorded timings |
| Is data verified? | Counts, checksums, samples, and application tests all pass |
| What if it goes wrong? | Written rollback plan with clear go or no-go criteria |
| Who is on call? | Named people for the cutover and the first hours afterward |
17Real-World and Industry Scenarios
These illustrative scenarios, drawn from common industry patterns, show how the ideas combine in practice.
A retailer moving its order database to a managed service
An online retailer runs MySQL on aging virtual machines. It creates a Cloud SQL destination, uses a continuous migration over a private connection, and rehearses on a copy during a quiet week. On cutover night it pauses the order service for a few minutes, waits for zero replication delay, validates counts, promotes, and repoints the application. Customers barely notice, and the old servers are kept for two weeks before retirement.
A bank leaving a proprietary engine
A bank converts an Oracle database holding years of business logic to AlloyDB for PostgreSQL. A conversion workspace translates most objects automatically, while engineers rewrite the complex procedures and test them against recorded transactions. Months of parallel validation precede a weekend cutover, and the license savings fund further modernization.
A software company consolidating from another cloud
A company running PostgreSQL on another provider replicates continuously into Cloud SQL for PostgreSQL. It accounts for the source provider’s egress charges up front, uses a secure tunnel because the source has no public access, and cuts over service by service after confirming that each application reads correctly from the new database.
A healthcare group with strict data rules
A group migrating patient-related databases chooses a destination region that satisfies residency rules, uses customer-managed keys and private networking, masks sensitive fields in rehearsal copies, and keeps detailed audit logs of every step so compliance reviewers can follow the whole process.
A media company serving reads from a second cloud
A media company keeps its primary database where it is but continuously replicates it into Google Cloud, so analytics and recommendation services running there can read fresh data without touching the primary. The setup is one-directional by design, with no attempt at dual writes.
What these scenarios share
Each team confirmed support first, designed the network early, rehearsed the full process, and defined clear criteria for the cutover. Each validated data independently, kept the source as a safety net, and treated promotion as a one-way decision. None of them relied on luck.
18Frequently Asked Questions
Short, direct answers to questions that come up again and again.
The service supports migrations into Cloud SQL and AlloyDB for PostgreSQL. Supported sources, versions, and engines vary by scenario, so confirm your exact pairing in the official documentation.
Homogeneous keeps the same engine, such as MySQL to Cloud SQL for MySQL. Heterogeneous changes engines, such as Oracle to PostgreSQL, and requires schema and code conversion.
With continuous migration, downtime is limited to the cutover window, often minutes. With a one-time migration, downtime lasts for the whole copy. Rehearsal gives you a realistic number.
Yes, for continuous migrations. Applications keep reading and writing the source while the service copies the snapshot and replays changes.
It finalizes replication and detaches the destination so it becomes an independent primary that accepts writes. It is a one-way step.
No. The service does not support a dual-write scenario. The source is the system of record until promotion, and then the destination takes over.
Use a reverse SSH tunnel so the connection is initiated from your side, or private connectivity through VPN, interconnect, and VPC peering if available.
Yes. Connections use SSL and TLS, and customer-managed keys can be used for continuous migrations where you need control over keys.
Conversion workspaces perform an automatic initial conversion, offer an interactive editor and customization directives, and provide Gemini-powered suggestions. Humans must still review and test the results.
Check source write volume, destination size, bandwidth, and very large transactions. Ensure change log retention on the source is long enough so the service does not lose its place.
Do not rely on job status alone. Compare row counts and checksums, sample records, object inventories, and run application and performance tests against the destination.
Only after the new environment has been stable and verified for an agreed safety period. Keep the source unchanged until then in case you need to investigate or fall back.
No. It is built for databases. Files and objects have their own dedicated transfer services.
19Summary and Key Takeaways
Database Migration Service is Google Cloud’s serverless answer to moving live databases with very little downtime. It copies a database into Cloud SQL or AlloyDB using an initial snapshot, then keeps the destination in step through change data capture until you are ready to switch. Migrations are either one-time, which suit databases that can be frozen, or continuous, which suit production systems that cannot stop. They are either homogeneous, keeping the same engine, or heterogeneous, changing engines with the help of conversion workspaces, an interactive editor, and generative assistance for schema and code. Connectivity can be an allowlist, a reverse tunnel, or private peering, always protected by encryption. Success depends on preparation: supported versions confirmed, a least-privilege migration user, adequate change log retention, keys on every table, a right-sized destination, a rehearsed runbook, and clear go or no-go criteria. At cutover, you stop writes, drain the delay to zero, validate, promote, and repoint applications, remembering that promotion is one-way and that dual writes are not supported. Keep the source as a safety net, validate independently, and clean up afterward. Done this way, cutover night is quiet, and that is the best sign of a well-run migration.
Key Takeaways
- Choose the right migration type — one-time for databases that can be frozen, continuous for production systems that need minimal downtime.
- Same engine is simpler than a new engine — heterogeneous moves need conversion workspaces, human review, and application testing in addition to data movement.
- Prepare the source and network first — a least-privilege migration user, enough change log retention, primary keys, tested connectivity, and a right-sized destination prevent most failures.
- Rehearse the whole process — a full dress rehearsal on a copy reveals problems and gives realistic timings for the downtime you promise.
- Cut over deliberately — stop writes, let replication delay reach zero, validate, then promote, because promotion is a one-way door and dual writes are not supported.
- Validate independently — compare counts, checksums, samples, and run application and performance tests instead of trusting job status alone.
- Keep a safety net and clean up — retain the source for an agreed period, then remove temporary access, rehearsal copies, and migration credentials.