Oracle to Postgres Migration: Complete Guide

Luke Smith
Enterprise Solutions Architect
January 2, 2023
Matt Tanner
Developer Relations Lead
January 2, 2023
Matt Tanner
Matt Tanner
Developer Relations Lead
Developer Relations Lead
January 25, 2023
16
 min read
Join our newsletter

A lot of businesses operate a variety of databases and data warehouses to serve all of their data needs. This generally happens since using a single database or data warehouse may not satisfy every use case for the data. Many platforms may be needed to meet the operational needs and analytical requirements of an organization. By using multiple systems to store and server data, there will likely be a need to move data found in one data location to another. This will likely be necessary to ensure data integrity and availability across the business. The purpose of migrating data differs from one organization to another, such as when businesses decide to move data from proprietary warehouses to open-source platforms or bring a new analytics platform into the mix which requires data from multiple data sources. 

Table of Contents

Introduction to database migration

In its simplest form, data migration can be described as the moving of data from one or more systems into a different system. The migration itself may involve the entire overhaul of a system, a push to move data from an on-premise location to a cloud database platform, or even from one cloud platform to another. Seeking a database with particular features, benefits, or a better ability to scale than your existing database can be seen as the ultimate reason behind data migration. Once the migration to a new system is complete, many organizations see a massive increase in performance and productivity. 

Moving data across databases involves selecting, preparing, extracting, transforming, and applying the data from the source database to the destination. Each of these steps needs to be planned carefully to avoid errors and ensure a smooth migration. The overall goal during the database migration is to have a seamless move to a new platform while reducing the business impact it may have when moving your data.

Data migration is truly a specialist activity. The more experience a person or team has, the more prepared they can be to effectively plan and execute the migration. Running into errors or snags is not uncommon so the experience can be a great way to get past these hurdles. The team migrating data should perform robust analysis and planning to mitigate any complication that may be encountered during the database migration. When mapping out the migration plan, teams should take certain factors such as data auditing, cleanup, maintenance, protection, and governance into consideration. 

Why Migrate From Oracle to Postgres?

Oracle and Postgres are two of the many major enterprise-grade databases available for use. They both have similarities, both being SQL RDBMS, but are different in many ways. While Oracle is license-based, Postgres is free, open-source, and sits behind an active community. These three factors make it an extremely popular choice as an Oracle alternative.

Postgres contains almost all the features Oracle has. Despite this, organizations tend to use both platforms for different purposes. Using two platforms allows organizations to stay true to a key operational goal: to optimize costs. Since both platforms are sometimes used in conjunction, the need to migrate data across them is imperative. There are many reasons why data may be moved from Oracle to Postgres, let’s take a look at a few below:

  • Flexibility: Since Postgres is open-source, it is easily and readily available on all public cloud platforms. This is less of a reality for Oracle since it is licensed-based.
  • Cost: With Oracle, you will have to pay for its license fee and additional cost for add-ons and extensions like partitioning and high availability. Using Postgres, such features can be simply installed and used for free.
  • Customization: There are several extensions and add-ons available for Postgres which you can download for free and customize to meet your business needs. These plug-ins can be used to highly improve the overall database performance.

What Are The Benefits of Postgres Over Oracle Database?

Next, we will look at the benefits of using Postgres over Oracle and highlight some of the advantages it has. Let’s break down each factor.

Application Programming

Both Oracle and Postgres have available SDKs to allow applications to directly connect to each database. This can be done in a multitude of languages. The advantage of Postgres being open source is that language support tends to be more robust since the community can add SDKs for preferred languages easily. 

Authentication

Oracle has built-in authentication, whereas Postgres uses host-based authentication. As a result, Postgres offers support for a wide range of authentication methods such as Trust authentication, Password authentication, and GSSAPI authentication. Postgres has much more flexibility compared to ORacle in this regard.

Extensibility

Thousands of plug-ins can be found for the Postgres extension system as it has a highly supportive community that makes them available, unlike Oracle where its plug-ins are primarily proprietary.

Languages

Oracle has its in-built programming language called PL/SQL while Postgres has not only PL/pgSQL but a lot more, such as C, PL/Tcl. Postgres also offers extensibility that caters to additional procedural languages through plug-ins and bindings for other programming languages.

Localization

Postgres possesses an in-built localization system service that provides character encoding and collation support automatically for your text while Oracle has a globalization development kit and Unicode character support. 

Performance

When using Postgres, you can create an unlimited number of nodes in a read cluster and alter it differently in every workload costing you next to nothing. With Oracle, having additional nodes will incur additional costs. Also, the responsive and analytic capabilities of the database can be improved. By migrating data from Oracle to Postgres, you are provided with the option of separating your Online Transaction Processing (OLTP) and analytics into different warehouses.

Scalability

With Postgres, scalability is highly achievable because, with your available and dedicated resources, you can create an unlimited number of nodes in a read cluster. To do the same with Oracle, costs begin to exponentially increase.

Steps to Follow for Oracle to Postgres Migration 

This section will look at the process involved in the migration of data from Oracle to Postgres. The steps to be discussed include assessment, schema migration, functional testing, performance testing, and data migration. Let’s take a look in more detail.

Assessment

The assessment phase of the pre-data migration of Oracle to Postgres involves checking for compatibility and capabilities and assessing the environment. The assessment can be broken down further into the following sub-steps.

  • Compatibility Assessment: This part of the assessment step focuses on assessing the compatibility of both the source and target database before proceeding. It is essential to confirm that the applications and services using the Oracle instance can also support Postgres. If it can’t support Postgres, then workarounds may need to be figured out or Postgres support would need to be added to the platforms that your applications are built on. The compatibility assessment also covers:
  • the operating systems of both databases
  • the data migration software and installed drivers 
  • the target server resources to ensure they are large enough and scalable to handle the volume of data to be transferred, including
  • memory
  • disk space
  • network ports
  • Application Code Assessment: Your migration can become intricate if your application code relies heavily on Oracle-specific frameworks and SDKs. If the application code is heavily reliant on these, the number of adjustments in the code to accommodate Postgres could be enormous. Analysis of the application architecture and database connection layer can help determine the level of changes that may be required. An easier migration requiring fewer adjustments is possible if you are using Object-Relational Mapping (ORM), such as Hibernate or JCA, or Java code that is using generic JDBC calls. Application code with dynamically built SQL, embedded SQL like Oracle’s Pro*C, or Oracle-specific libraries like OCI or the Oracle JDBC classes can make adjustments to code more complex. 
  • Architecture Assessment and Cleanup: The configuration and architecture of a database have a significant role to play in the migration of data. Before migration, it is vital to clean up your architecture and the content of your database to ensure a smooth transition. Objects that are no longer in use, such as old temporary tables, backup copies of data, and static historical data, should all be cleaned up or archived before the migration. Also, it is best practice to move large files, like PDFs or images, in the database to storage solutions more suited for large files. This can help reduce the database size and the amount of data that needs to be migrated to the new system. 

Schema Migration

It is necessary to identify and address the differences in the schema, in regards to data types and formats, between both platforms before migrating data. Converting the schema from one platform to the other is crucial as many errors and issues that commonly occur can be easily avoided. Knowing the nuances of how data should be converted between the platforms is essential to effectively map one schema to another. On the Postgres side, ANSI SQL standard SQL syntax and data types are supported. With Oracle, these standards are not supported, plus, Oracle also includes some non-ANSI SQL syntaxes. To accommodate these differences, the migration process should manually convert the unsupported objects from Oracle to a Postgres-supported syntax.

On top of the data conversion and mapping aspects of schema migration, there are also some further nuances to consider. The definition of a schema has different meanings in Oracle and Postgres. In Oracle, a schema and a user are closely related. A user is an account used to connect to a database, and a schema is the set of objects (tables, views, etc.) that belong to that account. In short, each Oracle user has its schema. In Postgres, by default new objects go to a public schema. A user on Postgres can grant permissions for creating objects within a schema to other users. Users can create multiple independent schemas without the need to create separate users and objects within them.

Functional Testing

After the conversion of schemas and moving of data from Oracle to Postgres, functional testing is required to test the schema in both databases to compare the result for similarities. This may be through some manual testing or possibly by testing the schema through integrated applications. The intended result of this testing is to make sure that the new database is working in the same functional matter as the old Oracle database. This will likely be done with a smaller amount of test or production data. The full migration would not be done to perform functional testing on the databases.

Performance Testing

Performance testing is executed to ensure that transactions and other database operations are executed in a performant matter after the migration is complete. Since both platforms handle certain database operations differently, performance testing can help to figure out where the new database may need to be tuned. This should be done as part of the database migration progress.

Data Migration

Once the above steps are completed, the migration itself can be performed. Data can be moved easily by using the correct tool and strategy to perform the data migration process without encountering many challenges. Depending on which tool or processes are employed to migrate the data, this could be a very manual or automated process. 

What Tools are Available for Oracle to Postgres Migrations?

Moving data from Oracle to Postgres manually can be a tedious and chaotic job. This is exponentially increased if lots of complexity is involved, such as multiple databases or extremely large schemas and amounts of data. Using automated tools to perform the migration will increase productivity and efficiency. In turn, these tools will reduce the time needed to complete the migration and can also help to maintain the database after deployment.

There are many migration tools available to choose from to automate the schema conversion process, data extraction, data transformation, and the loading of the data into the target database. With the help of these specialized tools, each of these processes can be done with a few steps. For instance, to assist with schema conversion, you can easily connect a tool to an Oracle database to scan and extract the structured data from it. The tool can then generate scripts that can be used to generate an equivalent schema in Postgres.

Below are a few of the conversion tools, available for free and commercially, that can be used to convert Oracle objects to Postgres.

  • Ora2pg: Ora2pg is a migration tool that is used to create a connection to an Oracle database to extract schemas and tables and generate SQL scripts to be loaded into Postgres.
  • Oraface: This is another Oracle to Postgres migration tool used to provide support for Oracle data formatting, and additional Oracle data types, and to implement Oracle functions in Postgres.
  • CYBERTEC Migrator: This is enterprise-grade software for migrating from Oracle to Postgres, it is GUI-driven and has a high performance with little downtime.
  • Ora_migrator: Ora_migrator uses an oracle_fdw foreign data wrapper to extract data from the Oracle database to Postgres.
  • EDB Migration Portal: This is a web-based service used to migrate data from Oracle to the EDB Postgres Advanced Server. Its features include assessment, schema conversion, and compatibility reporting.
  • ESF Database Migration Toolkit: This toolkit migrates the Oracle database to Postgres in the wizard. It connects directly and migrates the table structure, data, indexes, primary keys, foreign keys, and so on.
  • AWS Schema Conversion Tool (AWS SCT): This offers schema conversion solutions to make heterogeneous database migrations predictable, fast, secure, and simple.
  • Splendid Data - Cortex: Cortex is an advanced product for automated Oracle to Postgres migrations. It prevents vendor lock-in and delivers maximum freedom of deployment for both on-premise and cloud.

Of course, beyond the schema conversions, there are many other processes and tasks that are required as part of the migration process. There are plenty of tools available. Some are more flexible than others. Some tools may need to be stacked together in order to complete a migration while others offer end-to-end coverage. 

Using Arcion to Migrate Oracle to Postgres

Of all the tools available for data migration, we built Arcion so that it is much simpler to implement and maintain than other tools and approaches. With Arcion, you can set up a data pipeline to handle all of the migration processes and move the data to Postgres. The best part: Arcion can facilitate zero-downtime migrations with a few simple steps.

Arcion is a go-to solution for many enterprises who are looking to select a data migration tool that is scalable, reliable, and extremely easy to configure and use. It provides robust data pipelines for data migrations from Oracle to PostgreSQL that offer high availability, streaming capabilities through log-based CDC, and auto-scalable features. Available with multiple deployment options, Arcion can migrate data to and from on-prem data sources, cloud-based data sources, or a mix of both. 

The zero-code approach allows users to easily configure Arcion and build pipelines for data migration without writing any code. Arcion can be set up and configured strictly through configuration files or by using Arcion’s intuitive and easy-to-use UI to set up pipelines in a matter of minutes. Compared to homegrown solutions or ones that mismatch a bunch of different technologies, Arcion makes implementation smooth by providing 24/7 support through extensive documentation, tutorials, blogs, and customer support.

Let’s take a look at some specific features that will benefit you while building CDC pipelines to migrate data from Oracle to Postgres with Arcion.

Sub-Second Latency 

Many other existing data migration solutions don’t scale for high-volume, high-velocity data. This results in slow pipelines and slow delivery to the target systems which means migrations take longer than they have to. Arcion is the only distributed, end-to-end multi-threaded CDC solution that auto-scales vertically & horizontally. Any process that runs on Source & Target is parallelized using patent-pending techniques to achieve maximum throughput and fast data migration. There isn’t a single step within the pipeline that is single-threaded. It means Arcion users get ultra-low latency CDC replication and can always keep up with the forever-increasing data volume on Source, to enable zero-downtime migrations.

100% Agentless Change Data Capture

Arcion is the only CDC vendor in the market that offers 100% agentless CDC to all its supported 20+ connectors. Arcion reads directly from database logs, never reading from the database itself. Previously, data teams faced administrative nightmares and security risks associated with running agent-based software in production environments. You can now migrate data in real-time, at scale, with guaranteed delivery - but without the inherent performance issues or the security concerns of having to install an agent to extract data from the Oracle database.

Data Consistency Guaranteed

Arcion provides transactional integrity and data consistency through its CDC technology. To further this effort, Arcion also has built-in data validation support that works automatically and efficiently to ensure data integrity is always maintained. It offers a solution for both scalable data migration and replication while making sure that zero data loss has occurred.

Automatic Schema Conversion & Schema Evolution Support

When moving from Oracle to Postgres, Arcion can automatically map the schema and data from source to target. The automatic conversion of the schema from Oracle to PostgreSQL heavily brings down the work and time required to correctly map data from one to the other.

If a schema change happens during the migration or after, Arcion can handle the schema changes out of the box with no user intervention. This helps mitigate data loss and eliminate downtime caused by pipeline-breaking schema changes. This is possible by intercepting changes in the source database and propagating them while ensuring compatibility with the target's schema evolution. Other solutions would reload (re-do the snapshot) the data when there is a schema change in the source databases, which causes pipeline downtime and requires a lot of computing resources, which can be expensive.   

20+ Pre-Built Enterprise Data Connectors

Arcion has a large library of pre-built data connectors, including support for Oracle and Postgres. These connectors can provide support for almost 20 enterprise databases, data warehouses, and cloud-native analytics platforms (see full list). Unlike other ETL tools, Arcion provides full control over data while still maintaining a high degree of automation. Data can be moved and migrated from one source to multiple targets or multiple sources to a single target depending on your use case. Since Arcion supports more than just Oracle and Postgres, this means that if you branch out into other technologies, you’ll already have the capability within Arcion to handle your new sources and targets without the need for another pipeline and data migration technology.

Conclusion

This article has provided you with a general overview of how to migrate data from Oracle to Postgres. It defined what data migration is all about and the nuances of moving data from Oracle to Postgres. It went further to explain how the process can be carried out and mentioned steps to be considered to enable a smooth operation without hiccups. 

Finally, an alternative and easy way to migrate your data from Oracle to Postgres is to use Arcion. Arcion’s no-code solution offers migration support for 20+ sources and target databases and data warehouses, including Oracle and Postgres. Arcion can provide zero-downtime migrations with guaranteed data consistency and automatic schema conversions.

To get started with Arcion today, download Arcion Self-hosted for free and see Arcion in action yourself, no payment info is required. If you prefer, you can also book a personal demo with our Oracle migration experts today to get started!

Matt is a developer at heart with a passion for data, software architecture, and writing technical content. In the past, Matt worked at some of the largest finance and insurance companies in Canada before pivoting to working for fast-growing startups.
Luke has two decades of experience working with database technologies and has worked for companies like Oracle, AWS, and MariaDB. He is experienced in C++, Python, and JavaScript. He now works at Arcion as an Enterprise Solutions Architect to help companies simplify their data replication process.

Take Arcion for a Spin

Deploy the only cloud-native data replication platform you’ll ever need. Get real-time, high-performance data pipelines today.

8 sources & 6 targets

Pre-configured enterprise instance

Available in four US AWS regions

Free download

20+ enterprise source and target connectors

Deploy on-prem or VPC

Satisfy security requirements

Join the waitlist for Arcion Cloud (beta)

Fully managed, in the cloud.

Start your 30-day free trial with Arcion self-hosted edition

Self managed, wherever you want it.

Please use a valid email so we can send you the trial license.