What is a database migration?

Database migration involves moving the data contained in the database—including schema objects (tables, indexes, views), stored procedures, functions, and triggers—from an existing database to a new or updated database.

You may want to migrate your databases for a variety of reasons, such as improving performance, reducing costs, strengthening security, or adopting technologies such as analytics or AI.

Ready to get started? Learn about Database Migration Service and migrate your database to Google Cloud.

How does database migration differ from data migration?

Data migration is a component of the database migration process—moving data from one environment to another. You may need to move your data without migrating your database, such as in the case of making storage-related changes.

The key to successful data and database migration is to transfer your information accurately and quickly, while minimizing downtime and disruption during the transfer and during the cutover.

Homogeneous versus heterogeneous migrations

A database engine, also called a database management system (DBMS), is the software that manages basic database operations and interfaces with software applications. 

A homogeneous migration is when the database you’re moving from (source) has an identical or very similar engine to the database you’re moving to (target). A heterogeneous migration describes when the target database engine differs significantly from the source. 

The complexity of a migration varies in large part based on the differences between the source and target databases. A heterogeneous migration will require schema and code conversion—rewriting them into the target database language. For managing the complexities of migrations, such as managing application code written for the source database that needs conversion, a database migration service can help.

Many companies are willing to invest in a long or complicated database migration project in order to reap the long-term gains that come with a modern database engine.

Data migration strategies

There are 4 common strategies for migrating data. Visit cloud migration strategies for a deep dive and recommended strategies.

  • Rehost: lift and shift. The simplest way to migrate your data, this makes a complete copy of your existing database into another environment, usually together with the rest of the application stack. [homogenous]
  • Replatform: lift and optimize. This strategy copies the databases, applications and virtual machines and then optimizes them for the new cloud environment. This can be a heterogeneous migration, such as when moving from a commercial database to a PostgreSQL-compatible database such as AlloyDB.  [homogeneous/heterogeneous]
  • Refactor: move and improve. A refactoring cloud migration strategy means taking applications and re-engineering them to be cloud-native, including application changes. [usually heterogeneous]
  • Rebuild. A rebuilding cloud migration strategy rewrites an architecture and application entirely for the cloud. Depending on your application, this can be cheaper than refactoring. [usually heterogeneous]

Benefits of migrating to the cloud

While you can migrate your database between virtually any two locations, the majority of migrations are either from on-premises to cloud or from one cloud to another.

There are many reasons why companies are migrating to the cloud (or to an alternate cloud provider):

  • Faster application development
  • Improved performance and scalability 
  • Cost savings
  • Security
  • A wider range of features, in particular AI-related ones
  • A shift from an on-premises capital expenditure (CapEx), common with traditional licensed databases, to operating expenditure (OpEx), common with cloud service

Learn more about the benefits of migrating to the cloud.

Ideally, database migration isn’t a process your company will do often. To make the most of your migration, here are a few key questions to think about:

  • Will your new architecture scale to meet the needs of your future business growth?
  • How will migration interfere with business operations? Can you minimize downtime and interruptions?
  • What will the overall cost of your new system be? Consider migration costs in the context of monthly costs/savings for your new infrastructure/service.

Data migration best practices

Data and database migrations can be complex. It is essential to ensure that your enterprise’s data, as well as its organization and functions, move to the new architecture seamlessly. If done improperly, you may experience data loss, workloads not running properly, or security issues.

Some best practices:

  • Understand your data. It’s essential to know what your needs are for your specific business case and application.
  • Evaluate where your business is heading. Taking scaling into consideration is key to choosing the right architecture and provider. 
  • Select the right data migration strategy that makes sense for your situation.
  • Follow a data migration plan carefully to ensure optimum performance.

Considerations:

  • Which database(s) and application(s) should you migrate first?
  • Should you keep the same data model (for example relational) or would your use case benefit from changing it?
  • Should you stick with the same database engine or switch to a different one?
  • Should you migrate your databases in-house or hire an external service provider?
  • Which database migration service and other tools should you use?
  • Can generative AI help with your migration?
  • Should you manage the new database yourself or select a managed service?

The number of phases your migration will take depends on your organization’s existing setup and timeline. For example, migrating from a self-managed, on-premises deployment to a managed cloud service can be accomplished in a single step. Or, if there is time pressure, you can first migrate to a self-managed database in the cloud, and then switch to a fully managed solution.

If it’s a heterogeneous database migration, consider whether to combine the conversion with one of these steps or convert later.

4 steps of a successful data migration plan

For an in-depth look into the process, read concepts and principles of data migration and setting up and executing the data migration process.

Although the details will vary based on your specific business case, these are the basic steps of a successful migration:

  1. Identify where all of your data currently is, what format it’s in, and where it should be post-migration. You may determine you don’t need to migrate all of it, and can archive or delete old data. This also is a key time to note any potential risks of migration.
  2. Plan your migration strategy. Determine which migration strategy will work best, decide whether downtime can happen during business hours, and set a budget. 
  3. Execute your migration. You may want to use a migration service for implementation.
  4. Test your new system before the cutover. This enables you to identify any workloads that aren’t working appropriately and resolve any issues. You may need to run both databases concurrently, requiring replication of data from one system to the other. Only once you have confirmed all workloads are operating on the new database as expected can you shut down your old system.

After you migrate your database, you’ll want to continue to optimize to maintain the best performance. Consider a fully managed database service.

Special considerations for migrating from on-premises to cloud

Many organizations are moving their on-premises workloads to the cloud for the reasons discussed above. Migrations from on-premises require additional considerations compared to cloud-to-cloud migrations.

A common strategy to migrate on-premises workloads is rehosting, which copies your entire workload over to the cloud. Doing this reaps the security, reliability, and some cost benefits associated with cloud migration. However, this strategy also transfers any existing inefficiencies from the on-premises architecture over to the cloud infrastructure. Therefore, this strategy causes you to miss out on the larger cost savings and efficiencies associated with a cloud-native architecture. You may also miss the rich functionality of the cloud in areas like disaster recovery, analytics integration, AI/ML services, and a marketplace of partner offerings.

Make sure to maintain the security of your data during the migration, particularly between different types of environments. One way to ensure the best security is to use a trusted database migration service.

How long does it take to migrate a database?

It can take anywhere from a few days to several months, so it’s important to plan. Factors include the size of your database, your migration strategy, and whether you’re using a database migration service.

Benefits of using a database migration service

Database migration is more than just moving the data, it’s preserving the functions so that your workloads run without a hitch on your new system. How you migrate will depend on the code you’ve written and your migration tools. 

Benefits of a database migration service include:

  • Seamless data transfer
  • Secure and encrypted data in transit
  • Quicker overall transfer
  • Shorter downtime
  • Data consistency
  • Savings on overall expenses

And as generative AI becomes more essential to enterprise workloads, AI-powered conversion between database engines, using large language models (LLMs) such as Gemini, is being offered by cloud providers.

Check with your chosen cloud provider to see if they offer a database migration service.

Take the next step

Start building on Google Cloud with $300 in free credits and 20+ always free products.

Google Cloud
  • ‪English‬
  • ‪Deutsch‬
  • ‪Español‬
  • ‪Español (Latinoamérica)‬
  • ‪Français‬
  • ‪Indonesia‬
  • ‪Italiano‬
  • ‪Português (Brasil)‬
  • ‪简体中文‬
  • ‪繁體中文‬
  • ‪日本語‬
  • ‪한국어‬
Consola
Google Cloud