All Projects → societe-generale → code2pg

societe-generale / code2pg

Licence: BSD-2-Clause License
Tool to help migrate application code from Oracle to PostgreSQL

Programming Languages

perl
6916 projects

Projects that are alternatives of or similar to code2pg

exodus
Migration tools for Tabular Data to Oracle JSON/Tabular Data
Stars: ✭ 19 (+5.56%)
Mutual labels:  oracle, migration
Fluentmigrator
Fluent migrations framework for .NET
Stars: ✭ 2,636 (+14544.44%)
Mutual labels:  oracle, migration
Experdb Db2pg
eXperDB-DB2PG is a data migration solution that transfers data extracted from various DBMSs to eXperDB or PostgreSQL. Currently, Oracle and Oracle Spatial, MySQL, SQL Server(MS-SQL) and Sybase data can be transferred.
Stars: ✭ 24 (+33.33%)
Mutual labels:  oracle, migration
pg global temp tables
Oracle-style global temporary tables for PostgreSQL
Stars: ✭ 16 (-11.11%)
Mutual labels:  oracle, migration
Capgemini-ADAPT-2020
All Solutions for Capgemini 2020-2021 ADAPT Program, use it for your reference after you have tried the problems by yourself THANK YOU!
Stars: ✭ 37 (+105.56%)
Mutual labels:  oracle
carry
Python ETL(Extract-Transform-Load) tool / Data migration tool
Stars: ✭ 115 (+538.89%)
Mutual labels:  migration
esm
An Elasticsearch Migration Tool.
Stars: ✭ 669 (+3616.67%)
Mutual labels:  migration
laravel-online-migrator
Apply Laravel's database migrations with minimal disruptions using tools like Percona Online Schema Change
Stars: ✭ 43 (+138.89%)
Mutual labels:  migration
oracdc
Oracle database CDC (Change Data Capture)
Stars: ✭ 51 (+183.33%)
Mutual labels:  oracle
roda
RODA - Repository of Authentic Digital Objects
Stars: ✭ 54 (+200%)
Mutual labels:  migration
oci-ansible-collection
Oracle Cloud Infrastructure Ansible Collection provides an easy way to provision and manage resources in Oracle Cloud using Ansible.
Stars: ✭ 106 (+488.89%)
Mutual labels:  oracle
development-best-practices
程序员开发规范,其中包括Java、JavaScript、CSS、Oracle、MySQL的开发编码规范和规约
Stars: ✭ 14 (-22.22%)
Mutual labels:  oracle
web-haskell-graphql-postgres-boilerplate
Modern webserver in Haskell: Graphql + Postgresql + Authentication + DB migration + Dotenv and more
Stars: ✭ 114 (+533.33%)
Mutual labels:  migration
carpenter
Carpenter is a tool to manage DB schema and data
Stars: ✭ 41 (+127.78%)
Mutual labels:  migration
SampleOAuth2 UsingPythonClient
Django Sample app using Python OAuth client
Stars: ✭ 23 (+27.78%)
Mutual labels:  migration
db-oracle
Oracle Database support for Yii
Stars: ✭ 21 (+16.67%)
Mutual labels:  oracle
docker-apex-stack
Utility scripts for creating an Oracle Application Express stack as a Docker container.
Stars: ✭ 67 (+272.22%)
Mutual labels:  oracle
cloud-services-to-service-fabric
Migrate a Cloud Services application to Service Fabric
Stars: ✭ 27 (+50%)
Mutual labels:  migration
container-images
Oracle Linux container images
Stars: ✭ 93 (+416.67%)
Mutual labels:  oracle
mongration
MongoDB data migration tool for Spring Boot projects
Stars: ✭ 21 (+16.67%)
Mutual labels:  migration

code2pg

What is code2pg ?

code2pg is a tool that help migrating application code that contains SQL queries from Oracle to PostgreSQL standard.

It can:

  • estimate in man-days how difficult a migration will be for application code (in Java files for example);
  • tag the source file for Oracle instructions that might need to be migrated;
  • generate different reports: html, text or minimal;
  • connect directly to a SVN repository or use local files;
  • be tuned according to the team's expertise.

Prerequisites :

code2pg is a standalone script. It requires Perl >= 5.20 and the File::Slurp, File::Find::Rule, List::MoreUtils, Getopt::Long and Config::General Perl modules. They can be obtained either from a CPAN client or from your distribution.

On a Centos 7(+) box, it can be installed this way:

sudo yum install perl-File-Slurp perl-File-Find-Rule perl-Config-General perl-List-MoreUtils perl-Getopt-Long

On a Debian box, the packages could be installed with:

sudo apt-get install libfile-slurp-perl libfile-find-rule-perl libconfig-general-perl liblist-moreutils-perl libgetopt-mixed-perl

The script has been tested very lightly on Windows with Strawberry Perl (v5.24.3) with the proper modules installed (the CPAN client can be used for this). A warning is issued though as wc is usually not recognized.

Installation

git clone https://github.com/societe-generale/code2pg

The script should then be made executable:

chmod +x code2pg

Usage

Please refer to the complete generated documentation for more details. Here are a few examples:

  • show the command line options of the tool:
./code2pg --help
  • get some help on a specific instruction. The output is in markdown format:
./code2pg --help COMMIT
  • get some help on all available instructions and generate a pdf file :
./code2pg --help ALL_INSTRUCTIONS | pandoc -f markdown -o myfile.pdf
  • analyze files in the current directory with an extension .java and generate an estimation.html report. SQL instructions will have to searched in comma delimited strings:
./code2pg -e java -l comma-strings
  • analyze java, jsp and .properties files in the current directory. This will so far need two reports as Oracle instructions will need to be analyzed in comma delimited strings, but directly in .properties files:
./code2pg -e java -e jsp -l comma-strings -o myproject_java.html
./code2pg -e properties -l plain -o myproject_properties.html
  • analyze plsql files in two directories with extension .properties and generate a named html report. When SQL files must be analyzed directly (such as pl/sql or .properties files), please configure the language as "plain". For other languages, Oracle instructions will be searched between string delimiters.
./code2pg -e properties -l plain -d /tmp/project1 -d /tmp/project2 -o project_estimate.html
  • analyze java files in a SVN repository and generate a text report:
./code2pg -D svn -d https://mysvnrepo/project/trunk -l comma-strings -e java -f txt
  • use a configuration file
./code2pg -c code2pg.conf

Report examples

  • minimal output:
Done !
Estimation: 0.19 man-days
  • text output:
Settings
========

- Version code2pg: 0.13.0
- Analysis date: 29/04/2019
- Source code directory: /home/user/migration-project/
- Number of .java files: 76
- Language: comma-strings
- Number of analyzed LOC: 0
- Log file: 
- orafce usage: No

Estimates
=========

|            | Number of instructions | Time/instruction | Estimated time (minutes) | Man-days |
|------------|------------------------|------------------|--------------------------|----------|
| Level 1    |                    265 |                1 |                      265 |      0.7 |
| Level 2    |                     27 |                4 |                      108 |      0.3 |
| Level 3    |                     26 |                8 |                      208 |      0.6 |
| Level 4    |                    140 |               20 |                     2800 |      7.8 |
| estimation |                    458 |              7.4 |                     3381 |      9.4 |

Instructions
============

| Level | Instruction          | Number |
|-------|----------------------|--------|
|     1 |                ASCII |     60 |
|     1 |                COUNT |     11 |
|     1 |                LOWER |    178 |
|     1 |                  MAX |      4 |
|     1 |                  MIN |      9 |
|     1 |                UPPER |      3 |
|     2 |                  NVL |      8 |
|     2 |                  SUM |     17 |
|     2 |            TO_NUMBER |      2 |
|     3 |                 CAST |      1 |
|     3 |               DECODE |     20 |
|     3 |                HINTS |      4 |
|     3 |               ROWNUM |      1 |
|     4 |              CONVERT |    140 |
  • html output:

code2pg html output screenshot

  • help output:
ADD_MONTHS
==========

ORACLE
------

- Instruction: ADD_MONTHS
- Documentation: http://docs.oracle.com/database/121/SQLRF/functions011.htm

POSTGRESQL
-----------

- Postgresql instruction: No equivalent
- Documentation: 
- Level 3 - estimated time : 8 minutes.

COMMENTS
---------

A function can be created. For example: 
```
CREATE OR REPLACE FUNCTION public.add_months(date date, months integer)
 RETURNS date
 LANGUAGE plpgsql
AS $function$
BEGIN
RETURN (date + (months * '1 month' :: interval)) :: date;
END;
$function$
```

How to contribute?

See CONTRIBUTING.md

License

License is under the 2-Clause BSD License.
License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].