SlideShare a Scribd company logo
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.
Oracle to Postgres
Schema Migration
Hustle
Raghavendra Rao; Managing Consultant
Marc Linster; SVP, Product Development and
Support
1
Webinar Series
Jan 22 2020 How to monitor Postgres like a Pro
Feb 5 2020 Oracle to Postgres Migration Hustle
Feb 19 2020 Data Migration from Oracle to Postgres
March 4 2020 Using Terraform to deploy highly available Postgres
March 18 2020 5 things to know about Postgres.conf
2
Agenda
● Who is EDB?
● Migration Overview
● Migration Preliminary check
● Oracle vs PostgreSQL Compatibility differences
● Oracle schema migration hurdles
○ First, what schemas to target first
○ Schema objects Classification
○ Incompatibility challenges
● Tools
● Q & A
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.3
4
Get your EDB
Socks!
Ask a question and give us your
business address in the US - and
we will send you a pair of EDB
Socks!
WHO IS EDB?
A global leader in
open-source based Postgres
software and services
5
• Founded in 2004
• Recognized RDBMS leader by:
• Gartner
• Forrester
• Customer base > 4000
• 300+ employees
• Offices worldwide
• Major PostgreSQL community contributor
ONLY OPEN
SOURCE BASED
RDBMS IN
GARTNER MQ
EDB Recognized 7 Years
In A Row on Gartner’s
Magic Quadrant
6
CONFIDENTIAL © Copyright EnterpriseDB Corporation, 2020. All rights reserved.
7
Customers working SMARTER, reducing RISK and being more PRODUCTIVE with EDB.
OVER 4,000 CUSTOMERS
U.S Customers
EMEA Customers APAC Customers
102
of the
Fortune 500
337
of the Forbes
Global 2000
EDB OPEN SOURCE LEADERSHIP
NAMED EDB OPEN SOURCE COMMITTERS AND CONTRIBUTORS
8
● CORE TEAM ● MAJOR CONTRIBUTORS ● CONTRIBUTORS
Akshay
Joshi
Amul
Sul
Ashesh
Vashi
Dilip
Kumar
Jeevan
Ladhe
Mithun
Cy
Devrim
Gündüz
Amit
Kapila
Bruce
Momjian
Dave
Page
Robert
Haas
Ashutosh
Sharma
Rushabh
Lathia
- designates committers
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.9
Migration overview
Database Migration
It means moving definitions, data and stored procedures from
one platform to another. There are many reasons to move to a
different platform, it might be cost, support or so on.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.10
Migration Preliminary Check
● Client
● Application/Data Access
● Database
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.11
Oracle vs PostgreSQL differences
• Oracle uses the proprietary "TNS" protocol
with the default TCP port 1521 and the OCI
library as native call interface
• Transactions are not auto committed.
• Supports all Isolation Levels
• Drivers: JDBC, ODBC, .NET and many more.
• Concept of Packages/Procedures/Global
• Supports many other languages
• Partitioning(Horizontal)
• Replication: Master-Master and Master-Slave
• Postgres uses its own "frontend/backend" protocol
with the default TCP port 5432 and the libpq library
as native call interface
• Transaction to control COMMIT/ROLLBACK should
start with BEGIN
• Supports all Isolation Level, but default to READ
COMMITTED, which is sufficient
• Drivers: JDBC, ODBC, .NET and very few other
drivers.
• No concept of Package/Global.
• Good set of languages are supported
• Declarative Partitioning(only Range and List)
• Replication: Only Master-Slave
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.12
Oracle Schema Migration Hurdles
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.13
First, Which Schemas to Target
● Good targets...
○ Choose the smallest schemas with few PL/SQL objects
○ Then choose the most representative, on the basis of the experience
○ Add on: if team having multiple database skill set will reduce the conversion human-days.
● More difficult targets....
○ Don't choose Oracle application databases, that are closely tied with OCI
○ Don’t choose application using proprietary software (like Oracle forms)
○ Don’t choose spatial schemas, they need a lot of manual work.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.14
Schema Object Classification
● Every RDBMS offers the ability to store data and code objects. They are classified as
○ Storage Objects : Objects that holds the data(with reference integrity): Table, Constraint,
Index, Type, Sequence and Synonyms
○ Code Objects: Objects that holds program code to access/modify data: Views, Triggers,
Procedures, Functions, Packages
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.15
Incompatibility Challenges
● Schema
○ In Oracle, users and schemas are essentially the same thing. A user is the account used to
connect to a database, and a schema is the set of objects (tables, views, etc.) that belong to
that account.
○ In Postgres, users’ objects are created in a specific schema (or namespace). When the user
connects the default search_path is “$user,public” schema. “Public” is the default schema
assigned to a user.
■ User can create different schemas, no need to create separate users
■ Users can grant permission to create objects in one of his schema to some other user.
■ Allows flexibility to divide application logically.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.16
Incompatibility Challenges...
● Identifiers
○ In Oracle, all identifiers are in UPPER CASE, unless quoted.
○ Postgres converts them to lower case, unless quoted. Identifiers in Postgres are case
insensitive, unless quoted.
■ If application quotes the identifiers then it might lead to some manual work at both the
ends.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.17
Incompatibility Challenges...
● Storage Objects
○ Tables - Mostly compatible, except
■ Global Temporary Table (use Local Temp or Unlogged Tables)
■ KEEP/CACHE/IOT/EXTERNAL/COMPRESSED/CLUSTER/NESTED - They are normal
tables, and functionality need to be handled by Postgres supported modules.
■ Partition (Only Range/List supported)
○ Constraints
■ All constraints are supported(No foreign key support on Partition Table key)
○ Indexes
■ Most of the indexes are supported
■ Reverse Key(A functional based index can be used to reverse the order)
■ Global (Not yet supported)
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.18
Incompatibility Challenges...
● Storage Objects.. contd
○ Type
■ CREATE DOMAIN or CREATE TYPE with some limitations(Use ARRAYs)
○ Sequences
■ Oracle supports 2^63 as max value(PostgreSQL supports upto 2^63)
■ NOCACHE, NOORDER not supported
■ .nextval, .curval (need to call nextval(),currval() function on sequence name)
○ Synonyms
■ Not supported in PostgreSQL (use “search_path”)
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.19
Incompatibility Challenges...
● Data Types
Oracle PostgreSQL Comment
varchar,varchar2, nvarchar,
nvarchar2
varchar or text
char,nchar char
clob,long varchar or text
number bigint, int, smallint,
real, double
precision
Limited control of scale
binary_integer, binar_float integer, float
blog, raw, long raw bytea Size limitation
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.20
Incompatibility Challenges...
Oracle PostgreSQL Comment
Date Date or timestamp Postgres, returns timestamp with
date
Timestamp with time zone Timestamptz
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.21
Incompatibility Challenges...
● In Code objects
○ RETURN statement becomes RETURNS
○ EXECUTE IMMEDIATE becomes EXECUTE
○ SELECT becomes PERFORM
○ Functions
■ MUST choose a language
■ %TYPE and %ROWTYPE supported
■ cursor_name%ROWTYPE not yet supported; Use RECORD
○ Autonomous Transaction
■ use DBLINK module (slight performance overhead due to loopback connection)
○ COMMIT/ROLLBACK in PROCEDURE
■ Use EXCEPTION handling
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.22
Incompatibility Challenges...
● In Code objects
○ REVERSE LOOPs (must rewrite with start/end condition)
○ Packages
■ Use schema to group functions/procedures (no support for private variable/function)
■ No built-in package. Use Orafce library, which support some of the standard packages
(https://github.com/orafce/orafce)
○ Accessing Remote Objects
■ DBLINK module or Foreign Data Wrapper(oracle_fdw) to access any other database
○ Optimizer Hints
■ Postgres doesn’t have them, its discarded. No conversion required.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.23
Incompatibility Challenges...
● In Code objects
○ Query Conversion
■ OUTER Joins(+) marks at the NULL augmented side - (Use FULL OUTER JOINS
or UNION)
■ Pseudocolumns
● ROWNUM - Use LIMIT clause in the query(SELECT * FROM table LIMIT 10)
● ROWID - Its ROW Physical Address in Oracle (CTID in PostgreSQL, use
ROW_NUMBER OVER() windows function)
■ Hierarchical Queries - START WITH… CONNECT BY
● Need to convert using CTE or Tablefunc module, which has support of LEVEL
and PATH
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.24
Incompatibility Challenges...
● In Code objects
○ Empty Strings vs NULL
■ In Oracle Empty String and NULL are treated as NULLs, but in PostgreSQL both are not
treated as NULL. (Need special attention of queries comparing empty strings.)
○ Usage of Oracle Built-in functions
■ NVL - Use COALESCE()
■ DECODE - Use CASE clause
■ SYSDATE - Use current_timestamp
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.25
Other option
● EDB Postgres Advanced Server
○ EDB has developed database compatibility for Oracle based on popular features across many
versions of Oracle. EDB Postgres Advanced Server database behave or produce the
identical result as they would in Oracle. It natively support some of the Oracle functionalities in
the database which makes migration exercise easy to migrate the existing Oracle Database
Objects as is and work with similar functionality and performance.
○ What all natively supported in EDB Postgres Advanced Server ?
■ All Data types (except BINARY_FLOAT, BINARY_INTEGER,.,..)
■ Sequences/Synonyms/Database Links
■ Partition/Sub-Partition
■ Some of standard Oracle built-in Packages and Functions
■ Security(DBMS_RLS/SQLProtect/Policies)
■ User defined Packages/Procedures/Type(UDT)
■ Supporting Drivers (JDBC, ODBC, .NET
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.26
Tools
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.27
Tools
● Assessment and Conversion Tools
○ Open Source
■ ora2pg (https://github.com/darold/ora2pg)
○ Free to use
■ AWS Schema Conversion Tool (https://aws.amazon.com/dms/schema-conversion-tool/)
■ EDB Migration Portal (https://www.enterprisedb.com/edb-postgres-migration-portal)
■ EDB Migration ToolKit (https://www.enterprisedb.com/downloads/edb-migration-toolkit)
(No Assessment)
● Migration Supporting tools
■ orafce - support only Packages/No Conversion (https://github.com/orafce/orafce)
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.28
Ora2Pg Sample Report
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.29
EDB Migration Portal Sample Report
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.30
AWS SCT Sample Report
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.31
Tools
Assessment
Migration of
data objects
Migration of
code objects
Migration
Data
Approach Target
EDB Migration Portal Use EDB
MTK
Native +
Transformation
Postgres
Advanced
Server
EDB MTK
Native Only Postgres
Advanced
Server
AWS SCT Transformation
Only
PostgreSQL
Ora2Pg Transformation
only
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.32
Overall Migration steps
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.33
QUESTIONS
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.
THANK YOU
info@enterprisedb.com
www.enterprisedb.com
34

More Related Content

What's hot (20)

PPTX
Domain Driven Design
Hannah Farrugia
 
PPTX
Migration from Oracle to PostgreSQL: NEED vs REALITY
Ashnikbiz
 
PDF
Stumbling stones when migrating from Oracle
EDB
 
PDF
Oracle RAC on Extended Distance Clusters - Presentation
Markus Michalewicz
 
PDF
Auditing and Monitoring PostgreSQL/EPAS
EDB
 
PDF
Oracle Multitenant meets Oracle RAC 12c OOW13 [CON8706]
Markus Michalewicz
 
PDF
DOAG Oracle Unified Audit in Multitenant Environments
Stefan Oehrli
 
PDF
Domain Driven Design
Harsh Jegadeesan
 
PDF
Migrating from Oracle to Postgres
EDB
 
PPTX
Oracle GoldenGate 21c New Features and Best Practices
Bobby Curtis
 
PDF
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Sandesh Rao
 
PDF
Midi technique - présentation docker
Olivier Eeckhoutte
 
PPTX
What to Expect From Oracle database 19c
Maria Colgan
 
PPTX
Domain-Driven Design
Andriy Buday
 
PDF
Oracle LOB Internals and Performance Tuning
Tanel Poder
 
PPTX
Brownfield Domain Driven Design
Nicolò Pignatelli
 
PPTX
Domain Driven Design
Nader Albert
 
PDF
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
Olivier DASINI
 
PDF
The Top 5 Reasons to Deploy Your Applications on Oracle RAC
Markus Michalewicz
 
PPTX
Webinar Oracle Data Integrator 12c (ODI)
avanttic Consultoría Tecnológica
 
Domain Driven Design
Hannah Farrugia
 
Migration from Oracle to PostgreSQL: NEED vs REALITY
Ashnikbiz
 
Stumbling stones when migrating from Oracle
EDB
 
Oracle RAC on Extended Distance Clusters - Presentation
Markus Michalewicz
 
Auditing and Monitoring PostgreSQL/EPAS
EDB
 
Oracle Multitenant meets Oracle RAC 12c OOW13 [CON8706]
Markus Michalewicz
 
DOAG Oracle Unified Audit in Multitenant Environments
Stefan Oehrli
 
Domain Driven Design
Harsh Jegadeesan
 
Migrating from Oracle to Postgres
EDB
 
Oracle GoldenGate 21c New Features and Best Practices
Bobby Curtis
 
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Sandesh Rao
 
Midi technique - présentation docker
Olivier Eeckhoutte
 
What to Expect From Oracle database 19c
Maria Colgan
 
Domain-Driven Design
Andriy Buday
 
Oracle LOB Internals and Performance Tuning
Tanel Poder
 
Brownfield Domain Driven Design
Nicolò Pignatelli
 
Domain Driven Design
Nader Albert
 
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
Olivier DASINI
 
The Top 5 Reasons to Deploy Your Applications on Oracle RAC
Markus Michalewicz
 
Webinar Oracle Data Integrator 12c (ODI)
avanttic Consultoría Tecnológica
 

Similar to Oracle to Postgres Schema Migration Hustle (20)

PPTX
EDB's Migration Portal - Migrate from Oracle to Postgres
EDB
 
PPTX
Expert Guide to Migrating Legacy Databases to Postgres
EDB
 
PPTX
An Expert Guide to Migrating Legacy Databases to PostgreSQL
EDB
 
PPTX
Un guide complet pour la migration de bases de données héritées vers PostgreSQL
EDB
 
PPTX
Containerized MySQL OpenWorld talk
Patrick Galbraith
 
PPTX
Ledingkart Meetup #2: Scaling Search @Lendingkart
Mukesh Singh
 
PPTX
Ein Expertenleitfaden für die Migration von Legacy-Datenbanken zu PostgreSQL
EDB
 
ODP
BlaBlaCar Elastic Search Feedback
sinfomicien
 
PDF
Big Data processing with Apache Spark
Lucian Neghina
 
PDF
Conquering Data Migration from Oracle to Postgres
EDB
 
PPTX
PostgreSQL - Object Relational Database
Mubashar Iqbal
 
PDF
Apache Spark 101 - Demi Ben-Ari
Demi Ben-Ari
 
PDF
The Real Scoop on Migrating from Oracle Databases
EDB
 
PDF
ADBA (Asynchronous Database Access)
Logico
 
PDF
Custom Pregel Algorithms in ArangoDB
ArangoDB Database
 
PDF
No sql bigdata and postgresql
Zaid Shabbir
 
PDF
Benchmarking for postgresql workloads in kubernetes
DoKC
 
PDF
Node.js and the MySQL Document Store
Rui Quelhas
 
PPTX
New enhancements for security and usability in EDB 13
EDB
 
PDF
Supersized PostgreSQL: Postgres-XL for Scale-Out OLTP and Big Data Analytics
mason_s
 
EDB's Migration Portal - Migrate from Oracle to Postgres
EDB
 
Expert Guide to Migrating Legacy Databases to Postgres
EDB
 
An Expert Guide to Migrating Legacy Databases to PostgreSQL
EDB
 
Un guide complet pour la migration de bases de données héritées vers PostgreSQL
EDB
 
Containerized MySQL OpenWorld talk
Patrick Galbraith
 
Ledingkart Meetup #2: Scaling Search @Lendingkart
Mukesh Singh
 
Ein Expertenleitfaden für die Migration von Legacy-Datenbanken zu PostgreSQL
EDB
 
BlaBlaCar Elastic Search Feedback
sinfomicien
 
Big Data processing with Apache Spark
Lucian Neghina
 
Conquering Data Migration from Oracle to Postgres
EDB
 
PostgreSQL - Object Relational Database
Mubashar Iqbal
 
Apache Spark 101 - Demi Ben-Ari
Demi Ben-Ari
 
The Real Scoop on Migrating from Oracle Databases
EDB
 
ADBA (Asynchronous Database Access)
Logico
 
Custom Pregel Algorithms in ArangoDB
ArangoDB Database
 
No sql bigdata and postgresql
Zaid Shabbir
 
Benchmarking for postgresql workloads in kubernetes
DoKC
 
Node.js and the MySQL Document Store
Rui Quelhas
 
New enhancements for security and usability in EDB 13
EDB
 
Supersized PostgreSQL: Postgres-XL for Scale-Out OLTP and Big Data Analytics
mason_s
 
Ad

More from EDB (20)

PDF
Cloud Migration Paths: Kubernetes, IaaS, or DBaaS
EDB
 
PDF
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
EDB
 
PDF
Migre sus bases de datos Oracle a la nube
EDB
 
PDF
EFM Office Hours - APJ - July 29, 2021
EDB
 
PDF
Benchmarking Cloud Native PostgreSQL
EDB
 
PDF
Las Variaciones de la Replicación de PostgreSQL
EDB
 
PDF
NoSQL and Spatial Database Capabilities using PostgreSQL
EDB
 
PDF
Is There Anything PgBouncer Can’t Do?
EDB
 
PDF
Data Analysis with TensorFlow in PostgreSQL
EDB
 
PDF
Practical Partitioning in Production with Postgres
EDB
 
PDF
A Deeper Dive into EXPLAIN
EDB
 
PDF
IOT with PostgreSQL
EDB
 
PDF
A Journey from Oracle to PostgreSQL
EDB
 
PDF
Psql is awesome!
EDB
 
PDF
EDB 13 - New Enhancements for Security and Usability - APJ
EDB
 
PPTX
Comment sauvegarder correctement vos données
EDB
 
PDF
Cloud Native PostgreSQL - Italiano
EDB
 
PDF
New enhancements for security and usability in EDB 13
EDB
 
PPTX
Best Practices in Security with PostgreSQL
EDB
 
PDF
Cloud Native PostgreSQL - APJ
EDB
 
Cloud Migration Paths: Kubernetes, IaaS, or DBaaS
EDB
 
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
EDB
 
Migre sus bases de datos Oracle a la nube
EDB
 
EFM Office Hours - APJ - July 29, 2021
EDB
 
Benchmarking Cloud Native PostgreSQL
EDB
 
Las Variaciones de la Replicación de PostgreSQL
EDB
 
NoSQL and Spatial Database Capabilities using PostgreSQL
EDB
 
Is There Anything PgBouncer Can’t Do?
EDB
 
Data Analysis with TensorFlow in PostgreSQL
EDB
 
Practical Partitioning in Production with Postgres
EDB
 
A Deeper Dive into EXPLAIN
EDB
 
IOT with PostgreSQL
EDB
 
A Journey from Oracle to PostgreSQL
EDB
 
Psql is awesome!
EDB
 
EDB 13 - New Enhancements for Security and Usability - APJ
EDB
 
Comment sauvegarder correctement vos données
EDB
 
Cloud Native PostgreSQL - Italiano
EDB
 
New enhancements for security and usability in EDB 13
EDB
 
Best Practices in Security with PostgreSQL
EDB
 
Cloud Native PostgreSQL - APJ
EDB
 
Ad

Recently uploaded (20)

PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 

Oracle to Postgres Schema Migration Hustle

  • 1. © Copyright EnterpriseDB Corporation, 2020. All rights reserved. Oracle to Postgres Schema Migration Hustle Raghavendra Rao; Managing Consultant Marc Linster; SVP, Product Development and Support 1
  • 2. Webinar Series Jan 22 2020 How to monitor Postgres like a Pro Feb 5 2020 Oracle to Postgres Migration Hustle Feb 19 2020 Data Migration from Oracle to Postgres March 4 2020 Using Terraform to deploy highly available Postgres March 18 2020 5 things to know about Postgres.conf 2
  • 3. Agenda ● Who is EDB? ● Migration Overview ● Migration Preliminary check ● Oracle vs PostgreSQL Compatibility differences ● Oracle schema migration hurdles ○ First, what schemas to target first ○ Schema objects Classification ○ Incompatibility challenges ● Tools ● Q & A © Copyright EnterpriseDB Corporation, 2020. All rights reserved.3
  • 4. 4 Get your EDB Socks! Ask a question and give us your business address in the US - and we will send you a pair of EDB Socks!
  • 5. WHO IS EDB? A global leader in open-source based Postgres software and services 5 • Founded in 2004 • Recognized RDBMS leader by: • Gartner • Forrester • Customer base > 4000 • 300+ employees • Offices worldwide • Major PostgreSQL community contributor
  • 6. ONLY OPEN SOURCE BASED RDBMS IN GARTNER MQ EDB Recognized 7 Years In A Row on Gartner’s Magic Quadrant 6 CONFIDENTIAL © Copyright EnterpriseDB Corporation, 2020. All rights reserved.
  • 7. 7 Customers working SMARTER, reducing RISK and being more PRODUCTIVE with EDB. OVER 4,000 CUSTOMERS U.S Customers EMEA Customers APAC Customers 102 of the Fortune 500 337 of the Forbes Global 2000
  • 8. EDB OPEN SOURCE LEADERSHIP NAMED EDB OPEN SOURCE COMMITTERS AND CONTRIBUTORS 8 ● CORE TEAM ● MAJOR CONTRIBUTORS ● CONTRIBUTORS Akshay Joshi Amul Sul Ashesh Vashi Dilip Kumar Jeevan Ladhe Mithun Cy Devrim Gündüz Amit Kapila Bruce Momjian Dave Page Robert Haas Ashutosh Sharma Rushabh Lathia - designates committers
  • 9. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.9 Migration overview Database Migration It means moving definitions, data and stored procedures from one platform to another. There are many reasons to move to a different platform, it might be cost, support or so on.
  • 10. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.10 Migration Preliminary Check ● Client ● Application/Data Access ● Database
  • 11. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.11 Oracle vs PostgreSQL differences • Oracle uses the proprietary "TNS" protocol with the default TCP port 1521 and the OCI library as native call interface • Transactions are not auto committed. • Supports all Isolation Levels • Drivers: JDBC, ODBC, .NET and many more. • Concept of Packages/Procedures/Global • Supports many other languages • Partitioning(Horizontal) • Replication: Master-Master and Master-Slave • Postgres uses its own "frontend/backend" protocol with the default TCP port 5432 and the libpq library as native call interface • Transaction to control COMMIT/ROLLBACK should start with BEGIN • Supports all Isolation Level, but default to READ COMMITTED, which is sufficient • Drivers: JDBC, ODBC, .NET and very few other drivers. • No concept of Package/Global. • Good set of languages are supported • Declarative Partitioning(only Range and List) • Replication: Only Master-Slave
  • 12. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.12 Oracle Schema Migration Hurdles
  • 13. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.13 First, Which Schemas to Target ● Good targets... ○ Choose the smallest schemas with few PL/SQL objects ○ Then choose the most representative, on the basis of the experience ○ Add on: if team having multiple database skill set will reduce the conversion human-days. ● More difficult targets.... ○ Don't choose Oracle application databases, that are closely tied with OCI ○ Don’t choose application using proprietary software (like Oracle forms) ○ Don’t choose spatial schemas, they need a lot of manual work.
  • 14. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.14 Schema Object Classification ● Every RDBMS offers the ability to store data and code objects. They are classified as ○ Storage Objects : Objects that holds the data(with reference integrity): Table, Constraint, Index, Type, Sequence and Synonyms ○ Code Objects: Objects that holds program code to access/modify data: Views, Triggers, Procedures, Functions, Packages
  • 15. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.15 Incompatibility Challenges ● Schema ○ In Oracle, users and schemas are essentially the same thing. A user is the account used to connect to a database, and a schema is the set of objects (tables, views, etc.) that belong to that account. ○ In Postgres, users’ objects are created in a specific schema (or namespace). When the user connects the default search_path is “$user,public” schema. “Public” is the default schema assigned to a user. ■ User can create different schemas, no need to create separate users ■ Users can grant permission to create objects in one of his schema to some other user. ■ Allows flexibility to divide application logically.
  • 16. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.16 Incompatibility Challenges... ● Identifiers ○ In Oracle, all identifiers are in UPPER CASE, unless quoted. ○ Postgres converts them to lower case, unless quoted. Identifiers in Postgres are case insensitive, unless quoted. ■ If application quotes the identifiers then it might lead to some manual work at both the ends.
  • 17. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.17 Incompatibility Challenges... ● Storage Objects ○ Tables - Mostly compatible, except ■ Global Temporary Table (use Local Temp or Unlogged Tables) ■ KEEP/CACHE/IOT/EXTERNAL/COMPRESSED/CLUSTER/NESTED - They are normal tables, and functionality need to be handled by Postgres supported modules. ■ Partition (Only Range/List supported) ○ Constraints ■ All constraints are supported(No foreign key support on Partition Table key) ○ Indexes ■ Most of the indexes are supported ■ Reverse Key(A functional based index can be used to reverse the order) ■ Global (Not yet supported)
  • 18. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.18 Incompatibility Challenges... ● Storage Objects.. contd ○ Type ■ CREATE DOMAIN or CREATE TYPE with some limitations(Use ARRAYs) ○ Sequences ■ Oracle supports 2^63 as max value(PostgreSQL supports upto 2^63) ■ NOCACHE, NOORDER not supported ■ .nextval, .curval (need to call nextval(),currval() function on sequence name) ○ Synonyms ■ Not supported in PostgreSQL (use “search_path”)
  • 19. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.19 Incompatibility Challenges... ● Data Types Oracle PostgreSQL Comment varchar,varchar2, nvarchar, nvarchar2 varchar or text char,nchar char clob,long varchar or text number bigint, int, smallint, real, double precision Limited control of scale binary_integer, binar_float integer, float blog, raw, long raw bytea Size limitation
  • 20. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.20 Incompatibility Challenges... Oracle PostgreSQL Comment Date Date or timestamp Postgres, returns timestamp with date Timestamp with time zone Timestamptz
  • 21. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.21 Incompatibility Challenges... ● In Code objects ○ RETURN statement becomes RETURNS ○ EXECUTE IMMEDIATE becomes EXECUTE ○ SELECT becomes PERFORM ○ Functions ■ MUST choose a language ■ %TYPE and %ROWTYPE supported ■ cursor_name%ROWTYPE not yet supported; Use RECORD ○ Autonomous Transaction ■ use DBLINK module (slight performance overhead due to loopback connection) ○ COMMIT/ROLLBACK in PROCEDURE ■ Use EXCEPTION handling
  • 22. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.22 Incompatibility Challenges... ● In Code objects ○ REVERSE LOOPs (must rewrite with start/end condition) ○ Packages ■ Use schema to group functions/procedures (no support for private variable/function) ■ No built-in package. Use Orafce library, which support some of the standard packages (https://github.com/orafce/orafce) ○ Accessing Remote Objects ■ DBLINK module or Foreign Data Wrapper(oracle_fdw) to access any other database ○ Optimizer Hints ■ Postgres doesn’t have them, its discarded. No conversion required.
  • 23. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.23 Incompatibility Challenges... ● In Code objects ○ Query Conversion ■ OUTER Joins(+) marks at the NULL augmented side - (Use FULL OUTER JOINS or UNION) ■ Pseudocolumns ● ROWNUM - Use LIMIT clause in the query(SELECT * FROM table LIMIT 10) ● ROWID - Its ROW Physical Address in Oracle (CTID in PostgreSQL, use ROW_NUMBER OVER() windows function) ■ Hierarchical Queries - START WITH… CONNECT BY ● Need to convert using CTE or Tablefunc module, which has support of LEVEL and PATH
  • 24. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.24 Incompatibility Challenges... ● In Code objects ○ Empty Strings vs NULL ■ In Oracle Empty String and NULL are treated as NULLs, but in PostgreSQL both are not treated as NULL. (Need special attention of queries comparing empty strings.) ○ Usage of Oracle Built-in functions ■ NVL - Use COALESCE() ■ DECODE - Use CASE clause ■ SYSDATE - Use current_timestamp
  • 25. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.25 Other option ● EDB Postgres Advanced Server ○ EDB has developed database compatibility for Oracle based on popular features across many versions of Oracle. EDB Postgres Advanced Server database behave or produce the identical result as they would in Oracle. It natively support some of the Oracle functionalities in the database which makes migration exercise easy to migrate the existing Oracle Database Objects as is and work with similar functionality and performance. ○ What all natively supported in EDB Postgres Advanced Server ? ■ All Data types (except BINARY_FLOAT, BINARY_INTEGER,.,..) ■ Sequences/Synonyms/Database Links ■ Partition/Sub-Partition ■ Some of standard Oracle built-in Packages and Functions ■ Security(DBMS_RLS/SQLProtect/Policies) ■ User defined Packages/Procedures/Type(UDT) ■ Supporting Drivers (JDBC, ODBC, .NET
  • 26. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.26 Tools
  • 27. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.27 Tools ● Assessment and Conversion Tools ○ Open Source ■ ora2pg (https://github.com/darold/ora2pg) ○ Free to use ■ AWS Schema Conversion Tool (https://aws.amazon.com/dms/schema-conversion-tool/) ■ EDB Migration Portal (https://www.enterprisedb.com/edb-postgres-migration-portal) ■ EDB Migration ToolKit (https://www.enterprisedb.com/downloads/edb-migration-toolkit) (No Assessment) ● Migration Supporting tools ■ orafce - support only Packages/No Conversion (https://github.com/orafce/orafce)
  • 28. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.28 Ora2Pg Sample Report
  • 29. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.29 EDB Migration Portal Sample Report
  • 30. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.30 AWS SCT Sample Report
  • 31. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.31 Tools Assessment Migration of data objects Migration of code objects Migration Data Approach Target EDB Migration Portal Use EDB MTK Native + Transformation Postgres Advanced Server EDB MTK Native Only Postgres Advanced Server AWS SCT Transformation Only PostgreSQL Ora2Pg Transformation only
  • 32. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.32 Overall Migration steps
  • 33. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.33 QUESTIONS
  • 34. © Copyright EnterpriseDB Corporation, 2020. All rights reserved. THANK YOU [email protected] www.enterprisedb.com 34