SlideShare uma empresa Scribd logo
1 de 41
Baixar para ler offline
STUMBLING STONES
WHEN MIGRATING
FROM ORACLE
BY LAURENZ ALBE
ABOUT
ME AND MY
COMPANY
■ Who is Laurenz Albe?
■ Who is CYBERTEC?
LAURENZ ALBE
SENIOR DATABASE CONSULTANT
■ contributions to PostgreSQL and related
projects since 2006
■ maintainer of the Oracle Foreign Data Wrapper
■ PostgreSQL support, training, consulting and
development
■ working for CYBERTEC since 2017
M A I L laurenz.albe@cybertec.at
P H O N E +43 2622 930 22-7
W E B www.cybertec-postgresql.com
Specialized in data services
About Inhouse development
Owner-managed since 2000
International team of developers
DATABASE SERVICES
DATA Science
▪ Artificial Intelligence
▪ Machine Learning
▪ Big Data
▪ Business Intelligence
▪ Data Mining
▪ etc.
POSTGRESQL Services
▪ 24/7 Support
▪ Training
▪ Consulting
▪ Performance Tuning
▪ Clustering
▪ etc.
▪ ICT
▪ University
▪ Government
▪ Automotive
▪ Industry
▪ Trade
▪ Finance
▪ etc.
CLIENT
SECTORS
AGENDA
■ Overview
■ Understanding open source and PostgreSQL
■ Migrate the schema (DDL)
■ Data migration
■ Migrating stored code
■ Migrating SQL
■ Migrating the application
■ Migration tools
OVERVIEW
MIGRATION STEPS
■ understand open source software and PostgreSQL
■ migrate the schema (DDL)
■ migrate the data
■ migrate stored code (PL/SQL, Java)
■ migrate SQL
■ migrate the application
MIGRATION STEPS
(ACTUAL SIZE)
■ understand open source software and PostgreSQL
■ migrate the schema (DDL)
■ migrate the data
■ migrate stored code (PL/SQL, Java)
■ migrate SQL
■ migrate the application
UNDERSTANDING OPEN
SOURCE AND POSTGRESQL
THE SHIFT TO OPEN SOURCE
■ This is written by some enthusiasts in their spare time, right?
■ Is this “enterprise ready”?
■ Where can I get support?
■ Why do I have to install and integrate so many different pieces of
software (PostgreSQL, PostGIS, backup software, extensions, GUI clients,
monitoring,...)?
■ What if open source software is no longer maintained?
■ It’s for free, so I don’t have to invest anything, right?
TRANSACTIONS, UNDO,
MULTIVERSIONING
■ both Oracle and PostgreSQL use multiversioning, so concurrency and locking
are similar (but not equal!)
■ big transactions are no problem in PostgreSQL (but long transactions are), so
less need to “batch” large transactions
■ no UNDO tablespace in PostgreSQL, no “snapshot too old”, immediate rollback
But:
■ UPDATE-heavy workloads are problematic in PostgreSQL (may need “HOT
update” and autovacuum tuning)
■ table size will grow (all that visibility information)
■ I no statement-level rollback
SCHEMAS, USERS AND
SYNONYMS
Oracle has a reduced metadata model:
■ a schema is always tied to a user with the same name
■ ownership is determined by the schema
■ only objects in your own schema can be referenced without schema
Synonyms are there largely to overcome these limitations
■ can often be replaced by an appropriate search_path setting
■ for other uses, a view is usually just as good
VIEWS AND DEPENDENCIES
■ Oracle tables be dropped/modified even if views depend on them
■ views become “invalid” and cause an error when used
■ PostgreSQL is stricter about data integrity
■ Schema upgrade procedures more difficult in PostgreSQL
■ but to make up for it, we have transactional DDL
■ Materialized View support much more sophisticated in Oracle
■ replace ON COMMIT REFRESHwith triggers in PostgreSQL
TABLESPACES
■ tablespaces are important in Oracle
■ Oracle essentially implements its own file system
■ PostgreSQL uses the host file system
■ tablespaces are rarely necessary
■ Resist the urge to create tablespaces during migration!
MIGRATE THE
SCHEMA (DDL)
DATA TYPE TRANSLATION
■ PostgreSQL has way more data types, so the problem is often which
one to choose
■ DATE to date or timestamp(0)?
■ NUMBER to integer, bigint, double precision or numeric?
■ Oracle allows foreign keys from NUMBER(5) to NUMBER
■ must take care to migrate them to the same data type
■ BLOB to bytea or Large Objects?
■ easy, use bytea
DATA MIGRATION
GENERAL CONSIDERATIONS
■ Oracle makes it hard to export data in clear text
■ probably on purpose to make migration harder
■ this is often the least complicated step, but the one that causes the
most down time
■ reducing down time is difficult
■ run migration of table data in parallel
■ use “change data capture” for replication and switch-over with
little down time (only available with commercial tools)
DATA MIGRATION PROBLEMS
■ corrupted strings in Oracle (more common than you think!)
invalid byte sequence for encoding "UTF8": 0x80
■ zero bytes in Oracle
invalid byte sequence for encoding "UTF8": 0x00
■ can be filtered out during migration
■ infinite numbers (~ and -~)
■ can be mapped to Infinity in double precision, problematic
otherwise
Most of these problems have to be solved in Oracle before migration.
MIGRATING STORED CODE
MIGRATING PL/SQL
■ PL/pgSQL is a clone of PL/SQL, but sufficiently different
(e.g., RETURNS vs. RETURN)
■ some tools provide automated translation, but a lot of manual work may remain
■ no COMMIT/ROLLBACKin PostgreSQL functions, limited support in procedures
■ often in “batched deletes”, → can be omitted
■ no PRAGMA AUTONOMOUS_TRANSACTIONin PostgreSQL
■ can sometimes be worked around with dblink
■ no BULK COLLECTwith arrays
■ process row by row
Shift transaction management to the application.
MIGRATING PL/SQL PACKAGES
■ option to use closed source fork from EDB
■ workaround: creating a schema with functions
■ no “package global variables” and types
■ no large PL/SQL library in PostgreSQL
■ move code to the application
■ re-implement code in PL/Python or PL/PerlU
■ extension “orafce” provides some compatibility
MIGRATING PL/SQL TRIGGERS
■ has to be split in two parts: trigger function and trigger
■ benefit: easier code reuse
■ auto-increment triggers fetching from a sequence can be simplified to
column DEFAULT
■ no “logon triggers” in PostgreSQL
■ avoid or shift code to the application
MIGRATING SQL
WHERE DOES SQL OCCUR?
■ application code
■ ORMs and other abstraction layers reduce this
■ views
■ PL/SQL code
■ column DEFAULT clauses
■ index definitions
Usually requires manual intervention; migration tools may help.
SQL: JOIN SYNTAX
SELECT b.col1, a.col2
FROM base_table b, attributes a
WHERE b.id=a.b_id(+);
has to be translated to
SELECT b.col1, a.col2
FROM base_table b
LEFT JOIN attributes a ON b.id = a.b_id;
Always simple, but annoying!
SQL: EMPTY STRINGS
■ Oracle treats empty strings as NULL
■ as a consequence,
'hello' || NULL
is not NULL in Oracle
■ translate into
concat('hello', NULL)
or use “coalesce(strcol, '')”
This is a very frequent problem.
SQL: CURRENT DATE/TIME
■ most Oracle code uses proprietary functions:
■ SYSDATE
■ SYSTIMESTAMP
■ has to be translated:
■ the literal translation would be clock_timestamp()
■ sometimes current_dateor current_timestampis better
■ easy with search and replace
SQL: SEQUENCES
■ Oracle code to fetch the next sequence value:
asequence.NEXTVAL
■ PostgreSQL code to fetch the next sequence value:
nextval('asequence')
■ both don’t support the SQL standard way:
NEXT VALUE FOR asequence
MIGRATING THE APPLICATION
MIGRATING THE APPLICATION
■ can be hard
■ hard coded dynamically composed SQL everywhere
■ can be almost trivial
■ use an ORM that supports both Oracle and PostgreSQL
■ requires thorough testing
■ some differences (transaction handling, concurrency) may cause
problems only during testing
MIGRATION TOOLS
POSTGRESQL FORKS
■ some PostgreSQL forks (for example EDB) provide good compatibility
■ but believe no claim of “drop-in replacement”
■ carefully consider if you want to end up with closed source
■ consider using “orafce” for more compatibility
■ open source, but still another dependency
■ it may be worth the effort to invest a little more and end up with free
standard PostgreSQL
ORA2PG
■ the most widely used open source migration tool
■ time-tested and proven, but not 100% bug free
■ generates a DDL script, exports and imports data
■ universally usable, but takes its time
■ attempts to translate PL/SQL
■ simple search/replace, quality limited
ORA_MIGRATOR
■ open source, uses the Oracle Foreign Data Wrapper
■ directly migrates data into the target database
■ no export/import, therefore faster
■ requires oracle_fdw in the target database
■ usually not an option with hosted databases
■ no attempt to migrate PL/SQL
■ provides a simple replication solution using triggers to reduce down
time
CYBERTEC MIGRATOR
CYBERTEC MIGRATOR
■ commercial
■ comfortable GUI driven migration
■ fast, highly parallelized data migration
■ high-quality PL/SQL conversion
■ close-to zero downtime with change data capture under development
More information:
https://www.cybertec-postgresql.com/en/products/cybertec-migrator/
QUESTIONS?

Mais conteúdo relacionado

Mais procurados

Conquering Data Migration from Oracle to Postgres
Conquering Data Migration from Oracle to PostgresConquering Data Migration from Oracle to Postgres
Conquering Data Migration from Oracle to PostgresEDB
 
Migrating Your Oracle Database to PostgreSQL - AWS Online Tech Talks
Migrating Your Oracle Database to PostgreSQL - AWS Online Tech TalksMigrating Your Oracle Database to PostgreSQL - AWS Online Tech Talks
Migrating Your Oracle Database to PostgreSQL - AWS Online Tech TalksAmazon Web Services
 
GoldenGate and Stream Processing with Special Guest Rakuten
GoldenGate and Stream Processing with Special Guest RakutenGoldenGate and Stream Processing with Special Guest Rakuten
GoldenGate and Stream Processing with Special Guest RakutenJeffrey T. Pollock
 
Migrating from Oracle to Postgres
Migrating from Oracle to PostgresMigrating from Oracle to Postgres
Migrating from Oracle to PostgresEDB
 
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)Jean-François Gagné
 
MariaDB MaxScale
MariaDB MaxScaleMariaDB MaxScale
MariaDB MaxScaleMariaDB plc
 
Oracle RAC Virtualized - In VMs, in Containers, On-premises, and in the Cloud
Oracle RAC Virtualized - In VMs, in Containers, On-premises, and in the CloudOracle RAC Virtualized - In VMs, in Containers, On-premises, and in the Cloud
Oracle RAC Virtualized - In VMs, in Containers, On-premises, and in the CloudMarkus Michalewicz
 
PostgreSQL for Oracle Developers and DBA's
PostgreSQL for Oracle Developers and DBA'sPostgreSQL for Oracle Developers and DBA's
PostgreSQL for Oracle Developers and DBA'sGerger
 
Getting started with postgresql
Getting started with postgresqlGetting started with postgresql
Getting started with postgresqlbotsplash.com
 
Hands-on Lab: Migrating Oracle to PostgreSQL
Hands-on Lab: Migrating Oracle to PostgreSQL Hands-on Lab: Migrating Oracle to PostgreSQL
Hands-on Lab: Migrating Oracle to PostgreSQL Amazon Web Services
 
How to Migrate from Oracle to EDB Postgres
How to Migrate from Oracle to EDB PostgresHow to Migrate from Oracle to EDB Postgres
How to Migrate from Oracle to EDB PostgresAshnikbiz
 
MAA for Oracle Database, Exadata and the Cloud
MAA for Oracle Database, Exadata and the CloudMAA for Oracle Database, Exadata and the Cloud
MAA for Oracle Database, Exadata and the CloudMarkus Michalewicz
 
Zero Data Loss Recovery Appliance - Deep Dive
Zero Data Loss Recovery Appliance - Deep DiveZero Data Loss Recovery Appliance - Deep Dive
Zero Data Loss Recovery Appliance - Deep DiveDaniele Massimi
 
Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0Olivier DASINI
 
Oracle RAC - Roadmap for New Features
Oracle RAC - Roadmap for New FeaturesOracle RAC - Roadmap for New Features
Oracle RAC - Roadmap for New FeaturesMarkus Michalewicz
 
Oracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsOracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsAnil Nair
 
Oracle RAC 19c and Later - Best Practices #OOWLON
Oracle RAC 19c and Later - Best Practices #OOWLONOracle RAC 19c and Later - Best Practices #OOWLON
Oracle RAC 19c and Later - Best Practices #OOWLONMarkus Michalewicz
 
MySQL Performance Schema in Action: the Complete Tutorial
MySQL Performance Schema in Action: the Complete TutorialMySQL Performance Schema in Action: the Complete Tutorial
MySQL Performance Schema in Action: the Complete TutorialSveta Smirnova
 

Mais procurados (20)

Conquering Data Migration from Oracle to Postgres
Conquering Data Migration from Oracle to PostgresConquering Data Migration from Oracle to Postgres
Conquering Data Migration from Oracle to Postgres
 
Migrating Your Oracle Database to PostgreSQL - AWS Online Tech Talks
Migrating Your Oracle Database to PostgreSQL - AWS Online Tech TalksMigrating Your Oracle Database to PostgreSQL - AWS Online Tech Talks
Migrating Your Oracle Database to PostgreSQL - AWS Online Tech Talks
 
GoldenGate and Stream Processing with Special Guest Rakuten
GoldenGate and Stream Processing with Special Guest RakutenGoldenGate and Stream Processing with Special Guest Rakuten
GoldenGate and Stream Processing with Special Guest Rakuten
 
Migrating from Oracle to Postgres
Migrating from Oracle to PostgresMigrating from Oracle to Postgres
Migrating from Oracle to Postgres
 
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
 
MariaDB MaxScale
MariaDB MaxScaleMariaDB MaxScale
MariaDB MaxScale
 
Oracle RAC Virtualized - In VMs, in Containers, On-premises, and in the Cloud
Oracle RAC Virtualized - In VMs, in Containers, On-premises, and in the CloudOracle RAC Virtualized - In VMs, in Containers, On-premises, and in the Cloud
Oracle RAC Virtualized - In VMs, in Containers, On-premises, and in the Cloud
 
PostgreSQL for Oracle Developers and DBA's
PostgreSQL for Oracle Developers and DBA'sPostgreSQL for Oracle Developers and DBA's
PostgreSQL for Oracle Developers and DBA's
 
Getting started with postgresql
Getting started with postgresqlGetting started with postgresql
Getting started with postgresql
 
Hands-on Lab: Migrating Oracle to PostgreSQL
Hands-on Lab: Migrating Oracle to PostgreSQL Hands-on Lab: Migrating Oracle to PostgreSQL
Hands-on Lab: Migrating Oracle to PostgreSQL
 
How to Migrate from Oracle to EDB Postgres
How to Migrate from Oracle to EDB PostgresHow to Migrate from Oracle to EDB Postgres
How to Migrate from Oracle to EDB Postgres
 
Autonomous Database Explained
Autonomous Database ExplainedAutonomous Database Explained
Autonomous Database Explained
 
MAA for Oracle Database, Exadata and the Cloud
MAA for Oracle Database, Exadata and the CloudMAA for Oracle Database, Exadata and the Cloud
MAA for Oracle Database, Exadata and the Cloud
 
Zero Data Loss Recovery Appliance - Deep Dive
Zero Data Loss Recovery Appliance - Deep DiveZero Data Loss Recovery Appliance - Deep Dive
Zero Data Loss Recovery Appliance - Deep Dive
 
Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0Upgrade from MySQL 5.7 to MySQL 8.0
Upgrade from MySQL 5.7 to MySQL 8.0
 
Oracle RAC - Roadmap for New Features
Oracle RAC - Roadmap for New FeaturesOracle RAC - Roadmap for New Features
Oracle RAC - Roadmap for New Features
 
Oracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsOracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret Internals
 
Oracle RAC 19c and Later - Best Practices #OOWLON
Oracle RAC 19c and Later - Best Practices #OOWLONOracle RAC 19c and Later - Best Practices #OOWLON
Oracle RAC 19c and Later - Best Practices #OOWLON
 
MySQL Performance Schema in Action: the Complete Tutorial
MySQL Performance Schema in Action: the Complete TutorialMySQL Performance Schema in Action: the Complete Tutorial
MySQL Performance Schema in Action: the Complete Tutorial
 
Introduction to Galera Cluster
Introduction to Galera ClusterIntroduction to Galera Cluster
Introduction to Galera Cluster
 

Semelhante a Stumbling stones when migrating from Oracle

Oracle vs NoSQL – The good, the bad and the ugly
Oracle vs NoSQL – The good, the bad and the uglyOracle vs NoSQL – The good, the bad and the ugly
Oracle vs NoSQL – The good, the bad and the uglyJohn Kanagaraj
 
COUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_FeaturesCOUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_FeaturesAlfredo Abate
 
NoSQL and CouchDB: the view from MOO
NoSQL and CouchDB: the view from MOONoSQL and CouchDB: the view from MOO
NoSQL and CouchDB: the view from MOOJames Hollingworth
 
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQLPL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQLReactive.IO
 
Data Pipline Observability meetup
Data Pipline Observability meetup Data Pipline Observability meetup
Data Pipline Observability meetup Omid Vahdaty
 
Introducing NoSQL and MongoDB to complement Relational Databases (AMIS SIG 14...
Introducing NoSQL and MongoDB to complement Relational Databases (AMIS SIG 14...Introducing NoSQL and MongoDB to complement Relational Databases (AMIS SIG 14...
Introducing NoSQL and MongoDB to complement Relational Databases (AMIS SIG 14...Lucas Jellema
 
What SQL should actually be...
What SQL should actually be...What SQL should actually be...
What SQL should actually be...Open Academy
 
Are we there Yet?? (The long journey of Migrating from close source to opens...
Are we there Yet?? (The long journey of Migrating from close source to opens...Are we there Yet?? (The long journey of Migrating from close source to opens...
Are we there Yet?? (The long journey of Migrating from close source to opens...Marco Tusa
 
PostgreSQL versus MySQL - What Are The Real Differences
PostgreSQL versus MySQL - What Are The Real DifferencesPostgreSQL versus MySQL - What Are The Real Differences
PostgreSQL versus MySQL - What Are The Real DifferencesAll Things Open
 
SQL vs NoSQL: Why you’ll never dump your relations - Dave Shuttleworth, EXASOL
SQL vs NoSQL: Why you’ll never dump your relations - Dave Shuttleworth, EXASOLSQL vs NoSQL: Why you’ll never dump your relations - Dave Shuttleworth, EXASOL
SQL vs NoSQL: Why you’ll never dump your relations - Dave Shuttleworth, EXASOLBCS Data Management Specialist Group
 
CDC patterns in Apache Kafka®
CDC patterns in Apache Kafka®CDC patterns in Apache Kafka®
CDC patterns in Apache Kafka®confluent
 
A Journey from Oracle to PostgreSQL
A Journey from Oracle to PostgreSQLA Journey from Oracle to PostgreSQL
A Journey from Oracle to PostgreSQLEDB
 
Lessons PostgreSQL learned from commercial databases, and didn’t
Lessons PostgreSQL learned from commercial databases, and didn’tLessons PostgreSQL learned from commercial databases, and didn’t
Lessons PostgreSQL learned from commercial databases, and didn’tPGConf APAC
 
The Real Scoop on Migrating from Oracle Databases
The Real Scoop on Migrating from Oracle DatabasesThe Real Scoop on Migrating from Oracle Databases
The Real Scoop on Migrating from Oracle DatabasesEDB
 
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)Gabriele Bartolini
 
Ten query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should knowTen query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should knowKevin Kline
 

Semelhante a Stumbling stones when migrating from Oracle (20)

Oracle vs NoSQL – The good, the bad and the ugly
Oracle vs NoSQL – The good, the bad and the uglyOracle vs NoSQL – The good, the bad and the ugly
Oracle vs NoSQL – The good, the bad and the ugly
 
NoSQL
NoSQLNoSQL
NoSQL
 
COUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_FeaturesCOUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_Features
 
CDC to the Max!
CDC to the Max!CDC to the Max!
CDC to the Max!
 
Rails DB migrate SAFE.pdf
Rails DB migrate SAFE.pdfRails DB migrate SAFE.pdf
Rails DB migrate SAFE.pdf
 
NoSQL and CouchDB: the view from MOO
NoSQL and CouchDB: the view from MOONoSQL and CouchDB: the view from MOO
NoSQL and CouchDB: the view from MOO
 
Plpgsql russia-pgconf
Plpgsql russia-pgconfPlpgsql russia-pgconf
Plpgsql russia-pgconf
 
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQLPL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
 
Data Pipline Observability meetup
Data Pipline Observability meetup Data Pipline Observability meetup
Data Pipline Observability meetup
 
Introducing NoSQL and MongoDB to complement Relational Databases (AMIS SIG 14...
Introducing NoSQL and MongoDB to complement Relational Databases (AMIS SIG 14...Introducing NoSQL and MongoDB to complement Relational Databases (AMIS SIG 14...
Introducing NoSQL and MongoDB to complement Relational Databases (AMIS SIG 14...
 
What SQL should actually be...
What SQL should actually be...What SQL should actually be...
What SQL should actually be...
 
Are we there Yet?? (The long journey of Migrating from close source to opens...
Are we there Yet?? (The long journey of Migrating from close source to opens...Are we there Yet?? (The long journey of Migrating from close source to opens...
Are we there Yet?? (The long journey of Migrating from close source to opens...
 
PostgreSQL versus MySQL - What Are The Real Differences
PostgreSQL versus MySQL - What Are The Real DifferencesPostgreSQL versus MySQL - What Are The Real Differences
PostgreSQL versus MySQL - What Are The Real Differences
 
SQL vs NoSQL: Why you’ll never dump your relations - Dave Shuttleworth, EXASOL
SQL vs NoSQL: Why you’ll never dump your relations - Dave Shuttleworth, EXASOLSQL vs NoSQL: Why you’ll never dump your relations - Dave Shuttleworth, EXASOL
SQL vs NoSQL: Why you’ll never dump your relations - Dave Shuttleworth, EXASOL
 
CDC patterns in Apache Kafka®
CDC patterns in Apache Kafka®CDC patterns in Apache Kafka®
CDC patterns in Apache Kafka®
 
A Journey from Oracle to PostgreSQL
A Journey from Oracle to PostgreSQLA Journey from Oracle to PostgreSQL
A Journey from Oracle to PostgreSQL
 
Lessons PostgreSQL learned from commercial databases, and didn’t
Lessons PostgreSQL learned from commercial databases, and didn’tLessons PostgreSQL learned from commercial databases, and didn’t
Lessons PostgreSQL learned from commercial databases, and didn’t
 
The Real Scoop on Migrating from Oracle Databases
The Real Scoop on Migrating from Oracle DatabasesThe Real Scoop on Migrating from Oracle Databases
The Real Scoop on Migrating from Oracle Databases
 
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
 
Ten query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should knowTen query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should know
 

Mais de EDB

Cloud Migration Paths: Kubernetes, IaaS, or DBaaS
Cloud Migration Paths: Kubernetes, IaaS, or DBaaSCloud Migration Paths: Kubernetes, IaaS, or DBaaS
Cloud Migration Paths: Kubernetes, IaaS, or DBaaSEDB
 
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr UnternehmenDie 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr UnternehmenEDB
 
Migre sus bases de datos Oracle a la nube
Migre sus bases de datos Oracle a la nube Migre sus bases de datos Oracle a la nube
Migre sus bases de datos Oracle a la nube EDB
 
EFM Office Hours - APJ - July 29, 2021
EFM Office Hours - APJ - July 29, 2021EFM Office Hours - APJ - July 29, 2021
EFM Office Hours - APJ - July 29, 2021EDB
 
Benchmarking Cloud Native PostgreSQL
Benchmarking Cloud Native PostgreSQLBenchmarking Cloud Native PostgreSQL
Benchmarking Cloud Native PostgreSQLEDB
 
Las Variaciones de la Replicación de PostgreSQL
Las Variaciones de la Replicación de PostgreSQLLas Variaciones de la Replicación de PostgreSQL
Las Variaciones de la Replicación de PostgreSQLEDB
 
NoSQL and Spatial Database Capabilities using PostgreSQL
NoSQL and Spatial Database Capabilities using PostgreSQLNoSQL and Spatial Database Capabilities using PostgreSQL
NoSQL and Spatial Database Capabilities using PostgreSQLEDB
 
Is There Anything PgBouncer Can’t Do?
Is There Anything PgBouncer Can’t Do?Is There Anything PgBouncer Can’t Do?
Is There Anything PgBouncer Can’t Do?EDB
 
Data Analysis with TensorFlow in PostgreSQL
Data Analysis with TensorFlow in PostgreSQLData Analysis with TensorFlow in PostgreSQL
Data Analysis with TensorFlow in PostgreSQLEDB
 
Practical Partitioning in Production with Postgres
Practical Partitioning in Production with PostgresPractical Partitioning in Production with Postgres
Practical Partitioning in Production with PostgresEDB
 
A Deeper Dive into EXPLAIN
A Deeper Dive into EXPLAINA Deeper Dive into EXPLAIN
A Deeper Dive into EXPLAINEDB
 
IOT with PostgreSQL
IOT with PostgreSQLIOT with PostgreSQL
IOT with PostgreSQLEDB
 
Psql is awesome!
Psql is awesome!Psql is awesome!
Psql is awesome!EDB
 
EDB 13 - New Enhancements for Security and Usability - APJ
EDB 13 - New Enhancements for Security and Usability - APJEDB 13 - New Enhancements for Security and Usability - APJ
EDB 13 - New Enhancements for Security and Usability - APJEDB
 
Comment sauvegarder correctement vos données
Comment sauvegarder correctement vos donnéesComment sauvegarder correctement vos données
Comment sauvegarder correctement vos donnéesEDB
 
Cloud Native PostgreSQL - Italiano
Cloud Native PostgreSQL - ItalianoCloud Native PostgreSQL - Italiano
Cloud Native PostgreSQL - ItalianoEDB
 
New enhancements for security and usability in EDB 13
New enhancements for security and usability in EDB 13New enhancements for security and usability in EDB 13
New enhancements for security and usability in EDB 13EDB
 
Best Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLBest Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLEDB
 
Cloud Native PostgreSQL - APJ
Cloud Native PostgreSQL - APJCloud Native PostgreSQL - APJ
Cloud Native PostgreSQL - APJEDB
 
Best Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLBest Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLEDB
 

Mais de EDB (20)

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

Último

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 

Último (20)

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 

Stumbling stones when migrating from Oracle

  • 1. STUMBLING STONES WHEN MIGRATING FROM ORACLE BY LAURENZ ALBE
  • 2. ABOUT ME AND MY COMPANY ■ Who is Laurenz Albe? ■ Who is CYBERTEC?
  • 3. LAURENZ ALBE SENIOR DATABASE CONSULTANT ■ contributions to PostgreSQL and related projects since 2006 ■ maintainer of the Oracle Foreign Data Wrapper ■ PostgreSQL support, training, consulting and development ■ working for CYBERTEC since 2017 M A I L laurenz.albe@cybertec.at P H O N E +43 2622 930 22-7 W E B www.cybertec-postgresql.com
  • 4. Specialized in data services About Inhouse development Owner-managed since 2000 International team of developers
  • 5. DATABASE SERVICES DATA Science ▪ Artificial Intelligence ▪ Machine Learning ▪ Big Data ▪ Business Intelligence ▪ Data Mining ▪ etc. POSTGRESQL Services ▪ 24/7 Support ▪ Training ▪ Consulting ▪ Performance Tuning ▪ Clustering ▪ etc.
  • 6.
  • 7. ▪ ICT ▪ University ▪ Government ▪ Automotive ▪ Industry ▪ Trade ▪ Finance ▪ etc. CLIENT SECTORS
  • 8. AGENDA ■ Overview ■ Understanding open source and PostgreSQL ■ Migrate the schema (DDL) ■ Data migration ■ Migrating stored code ■ Migrating SQL ■ Migrating the application ■ Migration tools
  • 10. MIGRATION STEPS ■ understand open source software and PostgreSQL ■ migrate the schema (DDL) ■ migrate the data ■ migrate stored code (PL/SQL, Java) ■ migrate SQL ■ migrate the application
  • 11. MIGRATION STEPS (ACTUAL SIZE) ■ understand open source software and PostgreSQL ■ migrate the schema (DDL) ■ migrate the data ■ migrate stored code (PL/SQL, Java) ■ migrate SQL ■ migrate the application
  • 13. THE SHIFT TO OPEN SOURCE ■ This is written by some enthusiasts in their spare time, right? ■ Is this “enterprise ready”? ■ Where can I get support? ■ Why do I have to install and integrate so many different pieces of software (PostgreSQL, PostGIS, backup software, extensions, GUI clients, monitoring,...)? ■ What if open source software is no longer maintained? ■ It’s for free, so I don’t have to invest anything, right?
  • 14. TRANSACTIONS, UNDO, MULTIVERSIONING ■ both Oracle and PostgreSQL use multiversioning, so concurrency and locking are similar (but not equal!) ■ big transactions are no problem in PostgreSQL (but long transactions are), so less need to “batch” large transactions ■ no UNDO tablespace in PostgreSQL, no “snapshot too old”, immediate rollback But: ■ UPDATE-heavy workloads are problematic in PostgreSQL (may need “HOT update” and autovacuum tuning) ■ table size will grow (all that visibility information) ■ I no statement-level rollback
  • 15. SCHEMAS, USERS AND SYNONYMS Oracle has a reduced metadata model: ■ a schema is always tied to a user with the same name ■ ownership is determined by the schema ■ only objects in your own schema can be referenced without schema Synonyms are there largely to overcome these limitations ■ can often be replaced by an appropriate search_path setting ■ for other uses, a view is usually just as good
  • 16. VIEWS AND DEPENDENCIES ■ Oracle tables be dropped/modified even if views depend on them ■ views become “invalid” and cause an error when used ■ PostgreSQL is stricter about data integrity ■ Schema upgrade procedures more difficult in PostgreSQL ■ but to make up for it, we have transactional DDL ■ Materialized View support much more sophisticated in Oracle ■ replace ON COMMIT REFRESHwith triggers in PostgreSQL
  • 17. TABLESPACES ■ tablespaces are important in Oracle ■ Oracle essentially implements its own file system ■ PostgreSQL uses the host file system ■ tablespaces are rarely necessary ■ Resist the urge to create tablespaces during migration!
  • 19. DATA TYPE TRANSLATION ■ PostgreSQL has way more data types, so the problem is often which one to choose ■ DATE to date or timestamp(0)? ■ NUMBER to integer, bigint, double precision or numeric? ■ Oracle allows foreign keys from NUMBER(5) to NUMBER ■ must take care to migrate them to the same data type ■ BLOB to bytea or Large Objects? ■ easy, use bytea
  • 21. GENERAL CONSIDERATIONS ■ Oracle makes it hard to export data in clear text ■ probably on purpose to make migration harder ■ this is often the least complicated step, but the one that causes the most down time ■ reducing down time is difficult ■ run migration of table data in parallel ■ use “change data capture” for replication and switch-over with little down time (only available with commercial tools)
  • 22. DATA MIGRATION PROBLEMS ■ corrupted strings in Oracle (more common than you think!) invalid byte sequence for encoding "UTF8": 0x80 ■ zero bytes in Oracle invalid byte sequence for encoding "UTF8": 0x00 ■ can be filtered out during migration ■ infinite numbers (~ and -~) ■ can be mapped to Infinity in double precision, problematic otherwise Most of these problems have to be solved in Oracle before migration.
  • 24. MIGRATING PL/SQL ■ PL/pgSQL is a clone of PL/SQL, but sufficiently different (e.g., RETURNS vs. RETURN) ■ some tools provide automated translation, but a lot of manual work may remain ■ no COMMIT/ROLLBACKin PostgreSQL functions, limited support in procedures ■ often in “batched deletes”, → can be omitted ■ no PRAGMA AUTONOMOUS_TRANSACTIONin PostgreSQL ■ can sometimes be worked around with dblink ■ no BULK COLLECTwith arrays ■ process row by row Shift transaction management to the application.
  • 25. MIGRATING PL/SQL PACKAGES ■ option to use closed source fork from EDB ■ workaround: creating a schema with functions ■ no “package global variables” and types ■ no large PL/SQL library in PostgreSQL ■ move code to the application ■ re-implement code in PL/Python or PL/PerlU ■ extension “orafce” provides some compatibility
  • 26. MIGRATING PL/SQL TRIGGERS ■ has to be split in two parts: trigger function and trigger ■ benefit: easier code reuse ■ auto-increment triggers fetching from a sequence can be simplified to column DEFAULT ■ no “logon triggers” in PostgreSQL ■ avoid or shift code to the application
  • 28. WHERE DOES SQL OCCUR? ■ application code ■ ORMs and other abstraction layers reduce this ■ views ■ PL/SQL code ■ column DEFAULT clauses ■ index definitions Usually requires manual intervention; migration tools may help.
  • 29. SQL: JOIN SYNTAX SELECT b.col1, a.col2 FROM base_table b, attributes a WHERE b.id=a.b_id(+); has to be translated to SELECT b.col1, a.col2 FROM base_table b LEFT JOIN attributes a ON b.id = a.b_id; Always simple, but annoying!
  • 30. SQL: EMPTY STRINGS ■ Oracle treats empty strings as NULL ■ as a consequence, 'hello' || NULL is not NULL in Oracle ■ translate into concat('hello', NULL) or use “coalesce(strcol, '')” This is a very frequent problem.
  • 31. SQL: CURRENT DATE/TIME ■ most Oracle code uses proprietary functions: ■ SYSDATE ■ SYSTIMESTAMP ■ has to be translated: ■ the literal translation would be clock_timestamp() ■ sometimes current_dateor current_timestampis better ■ easy with search and replace
  • 32. SQL: SEQUENCES ■ Oracle code to fetch the next sequence value: asequence.NEXTVAL ■ PostgreSQL code to fetch the next sequence value: nextval('asequence') ■ both don’t support the SQL standard way: NEXT VALUE FOR asequence
  • 34. MIGRATING THE APPLICATION ■ can be hard ■ hard coded dynamically composed SQL everywhere ■ can be almost trivial ■ use an ORM that supports both Oracle and PostgreSQL ■ requires thorough testing ■ some differences (transaction handling, concurrency) may cause problems only during testing
  • 36. POSTGRESQL FORKS ■ some PostgreSQL forks (for example EDB) provide good compatibility ■ but believe no claim of “drop-in replacement” ■ carefully consider if you want to end up with closed source ■ consider using “orafce” for more compatibility ■ open source, but still another dependency ■ it may be worth the effort to invest a little more and end up with free standard PostgreSQL
  • 37. ORA2PG ■ the most widely used open source migration tool ■ time-tested and proven, but not 100% bug free ■ generates a DDL script, exports and imports data ■ universally usable, but takes its time ■ attempts to translate PL/SQL ■ simple search/replace, quality limited
  • 38. ORA_MIGRATOR ■ open source, uses the Oracle Foreign Data Wrapper ■ directly migrates data into the target database ■ no export/import, therefore faster ■ requires oracle_fdw in the target database ■ usually not an option with hosted databases ■ no attempt to migrate PL/SQL ■ provides a simple replication solution using triggers to reduce down time
  • 40. CYBERTEC MIGRATOR ■ commercial ■ comfortable GUI driven migration ■ fast, highly parallelized data migration ■ high-quality PL/SQL conversion ■ close-to zero downtime with change data capture under development More information: https://www.cybertec-postgresql.com/en/products/cybertec-migrator/