Courseiva
PCDEChapter 7 of 18Objective 2.2

Migrating to Cloud SQL: Homogeneous and Heterogeneous Migrations

Moving a database — the organised collection of your application’s data — from one location to another is a critical skill for a Cloud Database Engineer. This concept matters for the PCDE exam because you will be asked to plan and execute migrations to Cloud SQL, either from another MySQL database (homogeneous) or from a different database system like Oracle or SQL Server (heterogeneous), and you must know which tools and steps to use for each type.

12 min read
Advanced
Updated Jul 24, 2026
Reviewed by Johnson Ajibi· Senior Network & Security Engineer · MSc IT Security

A simple way to picture Migrating to Cloud SQL: Homogeneous and Heterogeneous Migrations

The Moving Van Analogy

A moving van is the central tool when you relocate your entire home from one house to another. You have two basic scenarios: either you are moving identical furniture (homogeneous migration) or you are moving into a house with different rooms and need to adapt your belongings (heterogeneous migration).

For a homogeneous move, imagine you are shifting from a two-bedroom apartment in London to a two-bedroom house in Manchester. The layout is similar, so you pack your sofa, bed, and tables exactly as they are. The moving van (like Database Migration Service) loads them up and drives them to the new address. The only challenge is making sure the van fits through the streets and that nothing breaks during transit.

For a heterogeneous move, picture moving from that London apartment to a traditional Japanese home with tatami mats and sliding doors. Your Western sofa is too wide, your wardrobe is too tall. Before the move, you must disassemble the sofa, cut the wardrobe legs, and reupholster everything to fit the new space. This takes extra planning, tools, and time. You cannot just load the van; you need to redesign each piece. In the same way, when you migrate from, say, Oracle to Cloud SQL for MySQL, you must convert stored procedures, data types, and schemas so they work with the new database engine.

The moving company (Google Cloud) provides the van and the packing materials, but you must know whether you are moving identical or different items, because that changes the entire strategy, timeline, and risk level.

How It Actually Works

A database is like a giant digital filing cabinet that stores all the information your application needs — user accounts, orders, inventory, etc. Cloud SQL is Google’s managed database service that runs MySQL, PostgreSQL, and SQL Server for you, handling backups, patching, and scaling automatically. Migration is the process of moving that filing cabinet from its old location (on-premises, meaning in your own office or data centre) to Google Cloud without losing any files or breaking your application.

There are two main types of migration tested in the PCDE exam: homogeneous and heterogeneous.

Homogeneous migration means you are moving the same type of database engine. For example, you have a MySQL database running on a server in your office, and you want to move it to Cloud SQL (which also uses MySQL). The database engine — the software that reads, writes, and organises data — is the same, so the data itself does not need to change. Think of it like copying a Word document from your old laptop to a new laptop. You open the same Word file; it works perfectly because both laptops have Word installed. In a homogeneous migration, the schema (the structure of your tables, like column names and data types) stays identical. The main challenge is transferring the large amount of data without downtime — meaning your application keeps working while the move happens. Google provides a tool called Database Migration Service (DMS) that handles this for MySQL and PostgreSQL. It uses a method called continuous replication, where it copies all existing data first, then keeps copying any new changes while your application is live, and finally switches over in a few seconds so users barely notice.

Heterogeneous migration means you are moving from one database engine to a different one. Common examples include moving from Oracle or Microsoft SQL Server to Cloud SQL for MySQL or PostgreSQL. Here, the database engines are not identical — they speak different languages (SQL dialects) and organise data differently. For instance, Oracle uses PL/SQL for stored procedures (pre-written code blocks that run inside the database), while Cloud SQL for MySQL uses a different procedural language. The data types may also differ: Oracle has a 'NUMBER' type that can hold decimals, while MySQL uses 'DECIMAL' or 'FLOAT'. You cannot just copy the data; you must transform it. This is like moving your Word document from a PC to an iPad: the document itself might open, but the formatting, fonts, and macros may not work, so you need to convert it to a compatible format.

For heterogeneous migrations, the process is more complex:

Assessment: First, you evaluate the source database to find compatibility issues. Google’s tools like the Database Migration Assessment analyse your Oracle or SQL Server schema and report which elements (data types, functions, stored procedures) are not supported in the target Cloud SQL and suggest replacements.

Schema conversion: You convert the database schema (tables, indexes, views) to match the target engine. Google provides a tool called Database Migration Service’s schema conversion (for some engines) and also recommends third-party tools like Ora2Pg or AWS Schema Conversion Tool adapted for Google. You must manually rewrite incompatible stored procedures and functions.

Data migration: After the schema is ready, you copy the actual data rows. Because the engines are different, the data may need transformation as it moves — for example, converting Oracle’s DATE format to MySQL’s DATETIME.

Validation: You test that the new database works correctly with your application. This includes checking data integrity (every row matches) and performance.

Cutover: Finally, you switch your application from the old database to the new Cloud SQL instance. This often requires a brief maintenance window because the migration is not as seamless as homogeneous.

Why does this matter for the PCDE exam? The exam will present scenarios where you must choose the correct migration strategy, tool, and steps. They love testing whether you understand that DMS can handle homogeneous migrations with minimal downtime but that heterogeneous migrations require schema conversion and more planning. They also test terms like downtime (the period when your app is unavailable), replication (copying data continuously), and schema (the structure definition). You need to know that for homogeneous, you can use DMS with continuous replication for near-zero downtime. For heterogeneous, you typically use a one-time dump and load method with a maintenance window, or tools like Cloud SQL Proxy for secure connections during transfer.

Decision tree for migrating to Cloud SQL: homogeneous vs heterogeneous paths, tools used, and final validation step.

Walk-Through

1

Assessing the Source

First, you evaluate the source database to understand its size, schema, and any compatibility issues. For heterogeneous migrations, you use a tool like Database Migration Assessment to identify unsupported data types, functions, and stored procedures. This step determines the effort needed for schema conversion and helps you decide whether continuous replication is possible.

2

Provisioning the Target Cloud SQL Instance

You create a new Cloud SQL instance in Google Cloud, choosing the same engine (for homogeneous) or the target engine (for heterogeneous). You configure machine size, storage, networking (private IP), and backups. This step ensures the target is ready before you start copying data, reducing downtime risk.

3

Schema Conversion (Heterogeneous Only)

For heterogeneous migrations, you convert the source database schema (tables, indexes, views) to be compatible with the target engine. You use automated tools and then manually adjust stored procedures and functions. This ensures the target database can accept the data without errors.

4

Data Migration

You copy the actual data from the source to the target. For homogeneous migrations, you use Database Migration Service with continuous replication to keep the source live. For heterogeneous migrations, you use a dump-and-load method (e.g., exporting from SQL Server and importing into Cloud SQL). This step moves the rows of data.

5

Validation and Cutover

After migration, you validate that all data is present and correct, and verify that the application works with the new database. Then you perform the cutover: redirecting application traffic from the old database to the new Cloud SQL instance. This final step makes the new database live.

What This Looks Like on the Job

Imagine you work for a mid-sized retail company called "ShopEase" that runs an e-commerce website. For years, their product catalogue and customer orders have been stored in an on-premises Microsoft SQL Server database. The company decides to move to Google Cloud to reduce hardware costs and improve scalability. Your task: migrate this SQL Server database to Cloud SQL for PostgreSQL. This is a heterogeneous migration because SQL Server and PostgreSQL are completely different database engines.

Here is exactly what you do as an IT professional:

First, you gather information about the source database. You run Google’s Database Migration Assessment tool against the SQL Server instance. This tool scans all the tables, stored procedures, functions, triggers, and data types. It produces a report that flags issues: for example, SQL Server uses a data type called 'MONEY' which does not exist in PostgreSQL. The report suggests replacing it with 'NUMERIC(19,4)'. It also notes that SQL Server stored procedures use T-SQL syntax, which must be rewritten as PL/pgSQL for PostgreSQL. You share this report with the development team so they can start rewriting the stored procedures.

Next, you set up the target Cloud SQL for PostgreSQL instance. You choose a machine size (say, 8 vCPUs and 32 GB RAM) to match the expected workload, enable automated backups, and configure a private IP address so that it connects securely over Google’s internal network (not over the public internet). You also set up a Cloud SQL Proxy to allow your local development machines to connect for testing.

Then comes schema conversion. You use the Database Migration Service’s conversion feature (or a third-party tool) to translate the SQL Server schema into PostgreSQL-compatible DDL (Data Definition Language — the commands that create tables and indexes). You review the converted schema, manually adjust any remaining issues like index names or default values, and then run the converted SQL commands against the Cloud SQL instance to create the empty tables.

Now for data migration. Because the source is SQL Server and the target is PostgreSQL, continuous replication via DMS is not natively supported for this pair (as of the PCDE exam scope). You must use a batch approach. You use a tool like 'pgloader' or a custom script that connects to both databases, reads rows from SQL Server in chunks, transforms data types on the fly (e.g., converting 'MONEY' to 'NUMERIC'), and inserts them into Cloud SQL. You schedule this during a maintenance window — say, 2 AM on a Sunday when traffic is lowest. Before the migration, you put the application in maintenance mode (a simple webpage saying “We’ll be right back”) to prevent new orders from being written to the old database.

After the data is copied, you validate. You run a script that counts rows in each table on both databases to ensure they match. You spot-check a few orders to confirm that dates, prices, and customer names are correct. Your QA team tests the application against the new PostgreSQL database in a staging environment first.

Finally, you cut over. You update the application’s connection string (the configuration that tells the app where the database is) from the old SQL Server address to the Cloud SQL private IP. You restart the application, take the maintenance page down, and monitor logs for errors. You keep the old database running for a week as a fallback in case something goes wrong. This real-world scenario shows that heterogeneous migration is a multi-step, manual, and careful process — not a simple button click.

How PCDE Actually Tests This

The PCDE exam tests your understanding of migration strategies in several distinct ways. First, they love to ask scenario-based multiple-choice questions where you must pick the correct migration approach given a source and target database pair. For example: "You need to migrate an on-premises MySQL 5.7 database to Cloud SQL for MySQL 8.0 with minimal downtime. What should you use?" The correct answer is Database Migration Service (DMS) with continuous replication because it is a homogeneous migration and the tool supports near-zero downtime. A trap would be suggesting a mysqldump (a command-line tool that exports data to a file) because that requires taking the database offline for the duration of the dump and load.

Key exam topics:

Homogeneous vs heterogeneous: You must immediately recognise which is which. Homogeneous = same engine (MySQL to Cloud SQL for MySQL, PostgreSQL to Cloud SQL for PostgreSQL). Heterogeneous = different engine (Oracle to Cloud SQL for MySQL, SQL Server to Cloud SQL for PostgreSQL).

DMS capabilities: Database Migration Service supports homogeneous migrations for MySQL and PostgreSQL with continuous replication (CDC — change data capture) for minimal downtime. It does NOT natively support heterogeneous migrations for free; you need separate schema conversion steps.

Schema conversion: For heterogeneous migrations, you must deal with incompatible data types, functions, and stored procedures. The exam may ask which tool to use (Database Migration Assessment) or what challenges arise (e.g., Oracle sequences vs MySQL auto-increment).

Downtime considerations: Homogeneous with DMS and CDC = seconds of downtime. Heterogeneous or dump-and-load = minutes to hours of downtime. The exam will test your ability to recommend the right approach based on the allowed downtime window.

Common traps:

Assuming DMS works for all engines: DMS supports homogeneous migrations for MySQL and PostgreSQL. For SQL Server or Oracle, you need a different approach (dump and load).

Confusing schema and data: The exam may ask, "During a homogeneous migration, do you need to modify the schema?" The answer is typically no (though minor version differences may cause issues). But for heterogeneous, schema changes are mandatory.

Misunderstanding continuous replication: It requires that the source database has binary logging enabled (for MySQL) or WAL archiving (for PostgreSQL). If the scenario says the source lacks these, you cannot use continuous replication, and must fall back to a dump.

Key definitions to memorise:

DMS (Database Migration Service): Google’s managed tool for migrating databases to Cloud SQL with minimal downtime for homogeneous migrations.

Continuous replication: A method that keeps copying changes from the source to the target while the source remains live, allowing a quick final switch.

mysqldump/pg_dump: Command-line tools to export a database to a file. Used for smaller databases or when downtime is acceptable.

Schema: The structure of tables, columns, indexes, and relationships — not the data itself.

Cutover: The moment you stop using the old database and start using the new one.

Key Takeaways

Homogeneous migration moves data between identical database engines; heterogeneous migration moves data between different engines, requiring schema conversion.

Database Migration Service (DMS) supports homogeneous migrations for MySQL and PostgreSQL with continuous replication for near-zero downtime.

Heterogeneous migrations require assessing source schema for incompatibilities, converting the schema, and rewriting incompatible code like stored procedures.

Downtime during migration depends on method: DMS with CDC yields seconds of downtime; dump-and-load methods may involve hours.

Always validate data after migration by comparing row counts, checking sample records, and running application tests in a staging environment.

The PCDE exam tests your ability to choose the correct migration tool and strategy based on the source and target database engines and the allowed downtime.

Easy to Mix Up

These come up on the exam all the time. Here's how to tell them apart.

Homogeneous Migration

Same database engine on source and target (e.g., MySQL to Cloud SQL for MySQL).

Schema remains largely unchanged; no data type conversion needed.

Can use Database Migration Service with continuous replication for near-zero downtime.

Heterogeneous Migration

Different database engine on source and target (e.g., Oracle to Cloud SQL for PostgreSQL).

Schema must be converted: data types, functions, stored procedures rewritten.

Typically uses dump-and-load with a planned maintenance window; more downtime.

Database Migration Service (DMS)

Managed by Google; handles replication and switchover automatically.

Supports continuous replication for minimal downtime (seconds).

Only works for homogeneous migrations (MySQL, PostgreSQL).

Manual Dump-and-Load (mysqldump, pg_dump)

Manual process using command-line tools to export and import data.

Requires taking the source offline or using locks, causing minutes to hours of downtime.

Works for any database engine; often the only option for heterogeneous migrations.

Schema

The structure of the database: table definitions, columns, indexes, relationships.

Changes are needed in heterogeneous migrations because engines have different features.

Can be converted using DMS schema conversion or manual scripts.

Data

The actual rows of information stored in the tables.

Often migrates more easily but may require transformation of data types during heterogeneous moves.

Validated by comparing row counts and sample values after migration.

Continuous Replication (CDC)

Copies changes continuously from source to target while source remains live.

Allows near-zero downtime cutover (usually seconds).

Requires source database settings like binary logging for MySQL.

Batch Copy (snapshot)

Copies a single snapshot of data at a point in time.

Requires stopping writes to the source during the copy, leading to more downtime.

Simpler to set up; suitable for smaller databases or when downtime is acceptable.

Watch Out for These

Mistake

You can use the same process for moving any database to Cloud SQL without caring about the source engine.

Correct

The process differs fundamentally. If the source and target are the same engine (homogeneous), you can use Database Migration Service with minimal downtime. If they are different engines (heterogeneous), you must convert the schema and data types, which is more manual and slower.

Beginners often think Cloud SQL is a 'magic box' that accepts any data. They do not understand that database engines speak different SQL dialects and have incompatible features.

Mistake

Database Migration Service can migrate any database to Cloud SQL with zero downtime.

Correct

DMS currently supports homogeneous migrations for MySQL and PostgreSQL with very low downtime (seconds). For other engines like Oracle or SQL Server, DMS does not support direct migration; you must use other tools and accept more downtime.

Marketing materials emphasise 'simplicity', leading people to overestimate DMS capabilities. The exam tests the specific limitations of the tool.

Mistake

Heterogeneous migration is just about copying data; the schema remains the same.

Correct

In heterogeneous migration, the schema must be converted because the target engine uses different data types, functions, and syntax. For example, Oracle's NUMBER type may become DECIMAL in MySQL, and stored procedures must be rewritten.

People think of databases as just 'containers of data' and forget that the structure (schema) is engine-specific. They assume a table called 'customers' will work identically in any database.

Mistake

You should always aim for zero-downtime migrations, and any downtime means failure.

Correct

Zero-downtime migrations are possible for homogeneous migrations with DMS and CDC. For heterogeneous migrations, some downtime is usually required and acceptable, often scheduled during a maintenance window. The exam expects you to choose the appropriate strategy based on business requirements.

Beginners hear 'cloud migration' and think it must be seamless and magical. In reality, trade-offs exist, and the exam tests your ability to balance cost, complexity, and downtime tolerance.

Mistake

Once data is in Cloud SQL, you never need to check it again.

Correct

After migration, you must validate data integrity (row counts, sample comparisons) and test application behaviour. Post-migration validation is a critical step to catch conversion errors or data loss.

People assume the migration tool is 100% perfect. But schema conversions can introduce subtle bugs — for example, truncating a VARCHAR column — that only show up under load.

Do You Actually Know This?

Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.

Frequently Asked Questions

What is a homogeneous migration?

A homogeneous migration is when you move a database from one location to another using the same database engine. For example, moving an on-premises MySQL database to Cloud SQL for MySQL. The schema and data types remain compatible, so the process is simpler and can use Database Migration Service for near-zero downtime.

Can I use Database Migration Service to migrate Oracle to Cloud SQL for PostgreSQL?

No, Database Migration Service currently supports homogeneous migrations for MySQL and PostgreSQL. For migrating Oracle to Cloud SQL for PostgreSQL, you need to assess the schema separately, convert it using tools or manual effort, and then use a dump-and-load method (e.g., export from Oracle and import into Cloud SQL).

What is continuous replication and when do I use it?

Continuous replication is a method where the migration tool continuously copies new changes from the source database to the target while the source remains live. You use it for homogeneous migrations to Cloud SQL to minimise downtime, allowing you to switch over in just seconds. It requires the source to have binary logging (MySQL) or WAL archiving (PostgreSQL) enabled.

Do I need to change my application code after migration?

For homogeneous migrations, typically no — the application can use the same SQL queries and connection settings (just pointing to the new Cloud SQL address). For heterogeneous migrations, you may need to update connection strings and modify queries that use database-specific functions (e.g., Oracle's SYSDATE vs MySQL's NOW()).

What is a cutover in database migration?

Cutover is the moment when you stop using the old database and start using the new Cloud SQL instance. For homogeneous migrations with continuous replication, this can be a quick, automated switch. For heterogeneous migrations, it often involves a brief maintenance window where the application is offline.

How do I know if my migration was successful?

You should validate by comparing row counts between source and target, spot-checking sample records, and running your application’s test suite against the new database. Also monitor for errors in logs and check that performance meets expectations. A successful migration means all data is intact and the application works correctly.

Terms Worth Knowing

Keep going

You've finished Migrating to Cloud SQL: Homogeneous and Heterogeneous Migrations. Continue through the PCDE study guide to build a complete picture of the exam.

Done with this chapter?