StrikrSystemsLLP Oracle to Strikr case on Database Migration
StrikrSystemsLLP What tools were used ● A variety of "freeware" tools were investigated such as – MyOraDump – SQLines – Ora2Pg – ESF DB migration ● On multiple Oracle databases of varying sizes starting from 10Mb to 80Gb (spanning control experiment db to real-life DB)
StrikrSystemsLLP What was the goal ● Within the context of the schema, the focus was high fidelity migration of – Schema – Tablespace – Identifier name(s) – Table – Views – Stored procedures – User-defined functions – Triggers – Index – Constraints
StrikrSystemsLLP What went well ● Dump of data from Oracle in CSV format was obtained ● The following objects were migrated – Table – View – Index, but no other database object.
StrikrSystemsLLP Challenges faced ● Stored procedures, user-defined function have not migrated at all. ● The storage size of data types of the column(s) changed across both PostgreSQL and MariaDB ●
StrikrSystemsLLP utf8mb4 ● utf8mb4 is a 4-byte UTF-8 encoding used in Oracle, where as MariaDB and PostgreSQL use utf8 encoding. ● tuned tool settings to utilize variable length encoding ● Encoding expands the storage used by the table(s) and – impacts 65535 bytes row restriction – impacts 3072 bytes index key-size restriction. ● post multiple customization's, the following object(s) were successfully migrated – Schema – Table – View – Index (partial)
StrikrSystemsLLP Stored Procedures CREATE OR REPLACE FUNCTION cs_fmt_browser_version( v_name varchar2, v_version varchar2 ) RETURN varchar2 IS BEGIN IF v_version IS NULL THEN RETURN v_name; END IF; RETURN v_name || '/' || v_version; END; / show errors; CREATE OR REPLACE FUNCTION cs_fmt_browser_version( v_name varchar, v_version varchar ) RETURNS varchar AS $$ BEGIN IF v_version IS NULL THEN RETURN v_name; END IF; RETURN v_name || '/' || v_version; END; $$ LANGUAGE plpgsql; plPERL, plPython, plJava PostgreSQLOracle
StrikrSystemsLLP Stored procedures ● Unless the migration tool can successfully parse the SQL grammar for Oracle functions and navigate compiled object representations (ie. stored procedures) and also understand how to map it to the grammar of target PostgreSQL, the migration of procedures, functions would not happen as is
StrikrSystemsLLP Way forward ● We strongly recommend using PostgreSQL for all new application and service initiatives. ● We must use this opportunity to refactor existing application database(s) prior to migration to PostgreSQL or MariaDB. ● However, this effort should be split across two parallel efforts – consistent correct and verified data dump – strict SQL standard compliant DDL usage ● We would also recommend that application teams implement business logic inside application server and not push it inside the database under the pretext of performance. ● In the context of PostgreSQL, a strategic decision should be taken regarding which language would be used for writing pgSQL functions aka user-defined functions ie. PERL, Python, Java or some other language.
StrikrSystemsLLP Thanks for your time Thanks for viewing Strikr case study on Oracle to PostgreSQL and MariaDB migration. Engineering Ragini Jain Saifi Khan 94 80 87 33 52 hello@strikr.in

Oracle to PostgreSQL migration

  • 1.
  • 2.
    StrikrSystemsLLP What tools wereused ● A variety of "freeware" tools were investigated such as – MyOraDump – SQLines – Ora2Pg – ESF DB migration ● On multiple Oracle databases of varying sizes starting from 10Mb to 80Gb (spanning control experiment db to real-life DB)
  • 3.
    StrikrSystemsLLP What was thegoal ● Within the context of the schema, the focus was high fidelity migration of – Schema – Tablespace – Identifier name(s) – Table – Views – Stored procedures – User-defined functions – Triggers – Index – Constraints
  • 4.
    StrikrSystemsLLP What went well ● Dumpof data from Oracle in CSV format was obtained ● The following objects were migrated – Table – View – Index, but no other database object.
  • 5.
    StrikrSystemsLLP Challenges faced ● Stored procedures,user-defined function have not migrated at all. ● The storage size of data types of the column(s) changed across both PostgreSQL and MariaDB ●
  • 6.
    StrikrSystemsLLP utf8mb4 ● utf8mb4 is a4-byte UTF-8 encoding used in Oracle, where as MariaDB and PostgreSQL use utf8 encoding. ● tuned tool settings to utilize variable length encoding ● Encoding expands the storage used by the table(s) and – impacts 65535 bytes row restriction – impacts 3072 bytes index key-size restriction. ● post multiple customization's, the following object(s) were successfully migrated – Schema – Table – View – Index (partial)
  • 7.
    StrikrSystemsLLP Stored Procedures CREATE ORREPLACE FUNCTION cs_fmt_browser_version( v_name varchar2, v_version varchar2 ) RETURN varchar2 IS BEGIN IF v_version IS NULL THEN RETURN v_name; END IF; RETURN v_name || '/' || v_version; END; / show errors; CREATE OR REPLACE FUNCTION cs_fmt_browser_version( v_name varchar, v_version varchar ) RETURNS varchar AS $$ BEGIN IF v_version IS NULL THEN RETURN v_name; END IF; RETURN v_name || '/' || v_version; END; $$ LANGUAGE plpgsql; plPERL, plPython, plJava PostgreSQLOracle
  • 8.
    StrikrSystemsLLP Stored procedures ● Unless themigration tool can successfully parse the SQL grammar for Oracle functions and navigate compiled object representations (ie. stored procedures) and also understand how to map it to the grammar of target PostgreSQL, the migration of procedures, functions would not happen as is
  • 9.
    StrikrSystemsLLP Way forward ● We stronglyrecommend using PostgreSQL for all new application and service initiatives. ● We must use this opportunity to refactor existing application database(s) prior to migration to PostgreSQL or MariaDB. ● However, this effort should be split across two parallel efforts – consistent correct and verified data dump – strict SQL standard compliant DDL usage ● We would also recommend that application teams implement business logic inside application server and not push it inside the database under the pretext of performance. ● In the context of PostgreSQL, a strategic decision should be taken regarding which language would be used for writing pgSQL functions aka user-defined functions ie. PERL, Python, Java or some other language.
  • 10.
    StrikrSystemsLLP Thanks for yourtime Thanks for viewing Strikr case study on Oracle to PostgreSQL and MariaDB migration. Engineering Ragini Jain Saifi Khan 94 80 87 33 52 hello@strikr.in