Oracle to PostgreSQL Migration: Avoiding the Obstacles

When organizations look to migrate from Oracle to PostgreSQL database, they usually see the advanced features, high performance, flexible open-source licensing, data integrity and easy availability from public cloud providers. But the way to migration is not easy, and you need to know how to avoid the obstacles if you are to be successful.


PostgreSQL Overview

PostgreSQL is an open-source relational database management system (RDBMS) that uses and extends the SQL language. PostgreSQL originated back to 1986 as part of the POSTGRES project at Berkeley University. PostgreSQL has since earned a strong reputation for its robust feature set, proven architecture, data integrity, reliability, extensibility. In addition, PostgreSQL has the support of a dedicated open-source community that delivers performant and innovative solutions.


PostgreSQL characteristics include:

  • Highly extensible━you can build out custom functions, define your own data types, and write code in various programming languages without recompiling your database.
  • Runs on all major operating systems and has been ACID-compliant since 2001. Provides add-ons like PostGIS geospatial database extender.
  • Offers a sophisticated locking mechanism.
  • Supports multi-version concurrency control.
  • Has mature Server-Side Programming Functionality.
  • Compliant with the ANSI SQL standard.
  • Provides full support for client-server network architecture.
  • Uses log-based and trigger-based replication SSL.
  • Has a standby server and high availability.
  • Object-oriented and ANSI-SQL2008 compatible.
  • Supports JSON to link with other data stores like NoSQL
  • Offers security features such as a robust access control system and column-and-row-level security.


Advantages of PostgreSQL:

  • PostgreSQL can run dynamic websites and web apps as a LAMP stack option
  • PostgreSQL's write-ahead logging makes it a highly fault-tolerant database.
  • PostgreSQL source code is freely available under an open-source license. This allows you the freedom to use, modify, and implement it to your business needs.
  • PostgreSQL supports geographic objects so you can use it for location-based services and geographic information systems.
  • Learning PostgreSQL does not require massive training.
  • Low maintenance administration for both embedded and enterprise use.
  • PostgreSQL community adds new features and improving existing features on an ongoing basis.


The Challenges to Migration and How to Overcome Them

Oracle databases available on-premises, on AWS, and Oracle databases on Azure. However, organizations are migrating from Oracle and adopting PostgreSQL as their open-source alternative. The benefits companies expect to gain are deployment flexibility, ease of use, and developer innovation. But database migration from Oracle to PostgreSQL may not be an easy task. Here are some of the challenges you will have during the migration process, and how to overcome them:


1. Maintaining service continuity

Providing continuous and reliable service and minimizing downtime during migrating databases is a primary challenge. To avoid unexpected events, start by evaluating all your Oracle databases to determine which will be the easiest to migrate, and migrate them first. This will allow the team to gain experience and confidence when they move on to more complex databases.


2. Migration Assessment

Migration from Oracle to PostgreSQL is a costly and time-consuming task. The initial challenge is to analyze the application and database object, identify the inconsistencies between Oracle and PostgreSQL, and estimate the migration time and cost.


3. Training your team to be familiar with PostgreSQL

Your team should acquire the skills needed to support and maintain the daily management, maintenance, and provisioning of PostgreSQL databases. You can ease the transition to PostgreSQL by encouraging your team to embrace the open-source culture. Open-source emphasizes collaboration, innovation, and transparency.


4. Data types and schema conversion

PostgreSQL has a comprehensive set of data types and support for custom extension types. The core Oracle data types should be mapped to PostgreSQL types.


5. Migrating database

After you convert your schema and tweak the tables to meet your specific application, the database should be moved from Oracle to your cloud storage. For smaller (100 GB or less) databases, you can use the data migration service of your cloud vendor. For larger data volumes an online migration is time and bandwidth consuming.

The solution can use an export, reload, and sync migration approach. In this migration method, you export your largest tables. Then, you can use AWS Snowball to migrate them to an AWS Region and load to S3 or compress and push them to  S3 storage. After you migrate the data to Amazon S3, you can bulk load the data to PostgreSQL.


6. Migrating code

The most time-consuming effort during the migration of Oracle to PostgreSQL is making the code work with PostgreSQL. This applies to the packages, stored procedures, and functions within the database and the application code that reads and writes to the database.


7. Migrating applications

PostgreSQL supports most development languages, including Java, C#, Python, PHP, C/C++, and JavaScript/Node.js. But if you’re using a packaged software application which are not certified on PostgreSQL, migrating will not be easy.


If you want to move your commercial ERP, CRM, or accounting application from Oracle to PostgreSQL, you might have to get your vendor to add PostgreSQL to their supported database list, or else migrate to a new business application which supports PostgreSQL. Another option is to leverage automated tools that evaluate and translate code and/or suggest alternatives in PostgreSQL.


Wrap Up

Oracle is one of the most popular databases today. However, it’s also one of the most expensive databases. Overall complexity, licensing fees, and support costs all add up are the main reasons that make companies leave Oracle behind for open-source alternatives like PostgreSQL.

There are several challenges when migrating Oracle databases to PostgreSQL, but giving your team the necessary skills, tools and knowledge is the best way to ensure success.


Author Bio: Gilad David Maayan


Gilad David Maayan is a technology writer who has worked with over 150 technology companies including SAP, Imperva, Samsung NEXT, NetApp and Ixia, producing technical and thought leadership content that elucidates technical solutions for developers and IT leadership. Today he heads Agile SEO, the leading marketing agency in the technology industry.