Estuary

How to Move Data from Oracle to MySQL: 2 Effective Methods

Explore the best strategies for migrating data from Oracle to MySQL for cost-effective data management solutions and simplified workflows.

How to Move Data from Oracle to MySQL: 2 Effective Methods
Share this article

Migrating databases is a common and important step in modernizing every organization’s data infrastructure. The decision to migrate from one database system to another could be for reducing costs, optimizing operational efficiencies, or leveraging modern features.

Oracle Database is one of the popular choices in the database market. It supports not just high-volume online transaction processing (OLTP) but also analytics-heavy data warehousing. If you’re looking to optimize costs or improve flexibility, migrating from Oracle to MySQL can be a worthy strategic move.

MySQL on the other hand, is a cost-effective, performant alternative. It supports a broad range of applications and is known for its ease of integration with various platforms. By transitioning to MySQL, you can reduce operational expenses and enhance the adaptability of your data management processes while also saving on licensing costs.

This guide details how you can move data from Oracle to MySQL using some reliable methods. However, before diving into the details of the migration strategies, let’s explore the key features of both Oracle and MySQL.

An Overview of Oracle

Oracle to Mysql - Oracle logo

Oracle is a leading relational database management system (RDBMS) that is widely used in enterprise environments to manage large volumes of data. It operates on a client-server architecture, facilitating efficient data processing by distributing tasks between client applications and server resources. It is the most popular database system used today.

Oracle’s In-Memory Database feature enables you to store data in memory rather than on disk, helping speed up data retrieval and query processing. To further improve query speeds, Oracle provides advanced indexing options that help you access data faster. You can choose from different indexes, like B-treebitmap, and function-based indexes, each intended for specific queries and scenarios.

Another impressive feature of Oracle is the Oracle Data Guard. It ensures high availability and data protection by maintaining a standby database that mirrors the primary one. In the event of a failure or outage, Oracle Data Guard can quickly switch operations to the standby database, minimizing downtime and ensuring that your applications remain accessible.

An Overview of MySQL
 

Oracle to Mysql - mysql logo

Owned by Oracle, MySQL is one of the most popular open-source relational database management systems, popular for efficiently handling structured data. In MySQL, you can store data in predefined tables that follow a relational schema. The relationships between different datasets are clearly defined using foreign keys. This enables you to execute complex queries while ensuring data integrity.

MySQL Document Store extends this functionality by offering you greater flexibility in developing traditional SQL and NoSQL schema-free database applications. You can manage both relational data and JSON documents in the same database, significantly reducing complexity in the development of modern applications.

Key Features of MySQL:

  • Stored Procedures: MySQL enhances efficiency and code reusability with stored procedures. These are collections of precompiled SQL statements that encapsulate complex query logic, stored directly on the database server for repeated use.
  • Multiple Storage Engines: MySQL supports multiple storage engines, each optimized for different use cases. InnoDB is the default engine, which offers ACID compliance and strong transaction support. On the other hand, MyISAM is known for its high speed in read-heavy operations. 
  • High Availability: MySQL offers an NDB Cluster that delivers 99.999% availability. It features a self-healing capability that automatically restarts failed data nodes without human intervention.

Why Should You Migrate Data from Oracle to MySQL?

Migrating data from Oracle to MySQL can significantly benefit your web applications, especially if you're working with the LAMP (Linux, Apache, MySQL, PHP/Python/Perl) stack. With the transition to MySQL, you can streamline the process of building dynamic web applications.

Here are a few benefits of Oracle to MySQL replication:

  • Flexibility and Customization: As an open-source database, MySQL enables you to change the source code to suit your needs. MySQL extends its flexibility further with its support for a variety of third-party tools and extensions, enabling you to tailor your database environment. This level of customization is not possible with proprietary systems like Oracle. These features make MySQL adaptable to varied development needs.
  • Cost-Effectiveness: Oracle is associated with high licensing, maintenance, and hardware costs. On the other hand, MySQL offers significant cost savings. Switching to MySQL eliminates the need for expensive licenses. This is especially beneficial for small to medium-sized companies with tight budgets.
  • Ease of Use: MySQL is well-suited for organizations without dedicated database administrators. It has a user-friendly interface and strong community support. In contrast, Oracle often requires expert knowledge for effective management and troubleshooting. Switching to MySQL simplifies database management and reduces technical challenges and administrative overhead.

How to Migrate Data from Oracle to MySQL

Here are the two ways to convert from Oracle to MySQL:

  • The Automated Way: Oracle to MySQL Migration Using Estuary Flow
  • The Manual Way: Using Manual Export/Import to Migrate Data from Oracle DB to MySQL

Method 1: Oracle to MySQL Migration Using Estuary Flow 

There are various Oracle to MySQL migration tools available in the market to ensure secure data transfer. One such efficient option is Estuary Flow, a real-time ETL tool that effectively streamlines moving data from Oracle to MySQL.

With its intuitive interface and an extensive library of over 200+ pre-built connectors, Estuary Flow makes data replication effortless, even for users with minimal technical expertise.

Let’s take a look at some of the key features of Estuary Flow:

  • Real-Time Data Synchronization: Estuary Flow supports Change Data Capture (CDC), enabling you to efficiently capture and sync changes from source platforms to destinations in real-time. With a sub-100ms end-to-end latency, it facilitates immediate access to the latest data.
  • Time Travel: The time travel functionality of Estuary Flow allows restricting your data materialization process to a specific date range. For an existing materialization, time travel will only materialize new data that falls within a specified date and time window without removing any existing documents. This reduces computational overhead and promotes efficient resource utilization.
  • Data Recovery: Estuary Flow stores the documents comprising your data collections in a cloud storage bucket. The storage mapping directs Flow on which bucket to use, apart from also being used to store recovery logs. All your captures, derivations, and transformations use recovery logs to back up their processing context.

Here are the steps to migrate data from Oracle to MySQL using Estuary Flow:

Prerequisites

  • An Estuary Flow account.
  • OracleDB 11g or above.
  • Permit Estuary Flow connections to your Oracle database
  • Create a dedicated read-only Estuary Flow user with access to the tables for replication.
  • MySQL version 5.7 and later database to materialize into, along with user credentials.
  • Enable the local_infile global variable.

Step 1: Configure Oracle Database as a Source

  • Sign in to your Estuary Flow account.
Oracle to Mysql - Estuary Capture
  • On the dashboard, select the Sources tab on the left panel and click on + NEW CAPTURE.
  • You will be redirected to a Create Capture page. Type Oracle Database in the Search connectors field.
Oracle to Mysql - oracle capture
  • There are two connector options: Oracle real-time and Oracle batch. Choose the one that suits your requirements.

For this example, let’s select the Oracle real-time connector. Click on its Capture button.

Oracle to Mysql - oracle configuration details
  • Fill in the required details such as:
    • Name: Give a unique name for your capture.
    • Server Address: This is the host or host:port at which your database can be connected.
    • User: Provide your OracleDB user name for authentication.
    • Password: Enter the password for the specified database user.
  • Click NEXT and then SAVE AND PUBLISH to complete your source connector configuration.

This connector captures data from your Oracle Database into a Flow collection using Oracle Logminer.

Step 2: Configure MySQL as a Destination

  • To proceed with setting MySQL as the destination end of your data pipeline, click MATERIALIZE COLLECTIONS in the pop-up that follows a successful capture.

Alternatively, you can navigate to the dashboard and click Destinations > + NEW MATERIALIZATION.

Oracle to Mysql - mysql connector
  • Enter MySQL in the Search connectors box.
  • When you see the MySQL connector in the search results, click on its Materialization button.
  • On the Create Materialization page, enter all the necessary fields, such as:
    • Name: Give a unique name for your materialization.
    • Address: Provide the specific host and port of the database as host[:port]. If you don’t mention any port, then Port 3306 is used as the default.
    • User: Type the database user for the connection.
    • Password: Enter the password for the specified user.
    • Database: Specify the name of the logical database to materialize to.
Oracle to Mysql - mysql config details
  • If your data collection from OracleDB isn’t automatically added to your materialization, navigate to the Source Collections section. Click the SOURCE FROM CAPTURE button to manually link the capture to the materialization.
  • Click NEXT, then SAVE AND PUBLISH to finish the setup.

The connector will materialize Flow collections of your Oracle data into tables in your MySQL database. This completes the configuration of your Oracle MySQL connector data pipeline.

Method 2: Using Manual Export/Import Method to Migrate Data from Oracle DB to MySQL 

If you’d like a more customizable and flexible solution for your Oracle DB to MySQL integration, a manual export/import is the way to go. It can provide you with direct control in every step of the process while also allowing you to handle complex transformations effectively.

Here are the steps to help you transfer data from Oracle to MySQL:

Step 1: Export Data from Oracle as CSV

SQL*Plus is a command-line interface provided by Oracle for interacting with Oracle databases. You can use it to export your Oracle data into a CSV file. 

  • Open the command prompt and type sqlplus to get started.
  • Enter your credentials to allow SQL*Plus to connect to your Oracle database.
  • Before executing your query, configure the SQL*Plus environment using the set statement. This helps optimize the output for CSV formatting.
plaintext
set colsep , set headsep off set pagesize 0 set trimspool on

Here is a brief overview of the above-mentioned commands:

  • colsep is the column separator (delimiter) that separates fields in the CSV file. In this example, a comma is used.
  • headsep is used to determine whether or not to keep the header row.
  • pagesize enables you to control pagination. If set to ‘0’, the query results will be continuously printed on a single page.
  • trimspool helps you remove trailing whitespaces from the output.
  • Once you set the required configuration, use the SPOOL command to specify the output file path.
plaintext
spool file_path
  • Now, run the SQL query to fetch the data you want to export. For example:
plaintext
SELECT * FROM your_table_name;
  • Finally, you should turn off spooling to close the output file.
plaintext
spool off

Step 2: Import CSV to MySQL Using MySQL Workbench

  • Launch MySQL Workbench and connect to your MySQL database server.
Oracle to Mysql - mysql workbench setup

Image Source

  • Select an existing database or create a new one to import the CSV Files.
  • Before importing, create a new table that matches the structure of your CSV file.
Oracle to Mysql - workbench table

Image Source

  • Right-click on the newly created table and choose Table Data Import Wizard.
Oracle to Mysql - mysql table data wizard menu

Image Source

  • After the import wizard opens, you should input the CSV file path for the file that contains the exported Oracle data.
  • While configuring import settings, make sure the value of the encoding field in the wizard corresponds with your CSV file.
Oracle to Mysql - configure data import

Image Source

  • Click Next to start importing the CSV file into MySQL.

This completes the process of manually migrating data from OracleDB to MySQL. However, we need to keep in mind that this method has several limitations. Let’s take a look at them in more detail.

Limitations of Using Manual Method to Move Data from Oracle to MySQL

  • Time-Consuming: For most developers, manually configuring and running imports is time-intensive, especially with large datasets. It may cause significant downtime, affect system availability, and disrupt your ongoing business operations and most importantly, take up the time of a developer that could be better spent somewhere else.
  • Error-Prone: The manual setup for data migration increases the risk of human errors in data mapping and configuration. This can lead to data inconsistencies in the form of duplicate data, incorrect data, or missing entries. Such issues can compromise the reliability of the data following the migration.
  • Lack of Real-time Capabilities: Of course, manual CSV export/import doesn’t support real-time data synchronization as it is not automated in any way. If someone makes changes to the source Oracle system during the migration, those will not be reflected in MySQL. This can result in outdated information that can impact decision-making capabilities.

Wrapping Up

Migrating data from Oracle to MySQL enables efficient data management with reduced costs, allowing you to leverage the robust data processing capabilities of MySQL.

To transfer data from Oracle to MySQL, you can opt for the manual CSV export/import technique. While this offers increased flexibility and customization, the technique’s drawbacks include being time-consuming, error-prone, and lacking real-time synchronization capabilities. This approach often leads to inconsistencies and delays, which can affect your organization's ability to make timely decisions based on accurate data.

Conversely, real-time ETL solutions like Estuary Flow automate the data migration process, significantly reducing manual work and minimizing the risk of errors. With Estuary Flow, you can set up an integration pipeline that captures changes in real-time. It ensures that your MySQL database is always up to date without requiring human intervention.

Want to speed up your data transfers across different platforms without too much effort? Try Estuary Flow. All it takes are a few clicks to register for your free account and get started!

FAQs

What are the main challenges in Oracle to MySQL replication?

One of the main challenges in Oracle to MySQL replication is the differences in data types and storage formats. This can result in compatibility issues during migration. However, you can use data transformation tools and scripts to convert the data into MySQL-compatible formats.

Does MySQL support temporary tables?

Yes, MySQL supports the creation of temporary tables. These tables are visible only to the current user session and are automatically removed when that session ends.

Start streaming your data for free

Build a Pipeline
Share this article

Table of Contents

Build a Pipeline

Start streaming your data for free

Build a Pipeline

About the author

Picture of Dani Pálma
Dani Pálma

Dani is a data professional with a rich background in data engineering and real-time data platforms. At Estuary, Daniel focuses on promoting cutting-edge streaming solutions, helping to bridge the gap between technical innovation and developer adoption. With deep expertise in cloud-native and streaming technologies, Dani has successfully supported startups and enterprises in building robust data solutions.

Popular Articles

Streaming Pipelines.
Simple to Deploy.
Simply Priced.
$0.50/GB of data moved + $.14/connector/hour;
50% less than competing ETL/ELT solutions;
<100ms latency on streaming sinks/sources.