-
Notifications
You must be signed in to change notification settings - Fork 11
Home
In an Oracle to PostgreSQL project, the database has to be migrated. Many tools can help you in this task (with ora2pg
being the most well known one) and will migrate your data and most objects in your database.
But your application code may also have specific Oracle instructions and those need to be translated too. code2pg
is here to help by estimating in man-days how difficult such a migration is and by telling you where Oracle instructions were identified.
There is a little reference to the excellent ora2pg
tool.
You need a Perl distribution and the possibility of installing a few extra packages. This should be trivial on RHEL/Centos, Debian distributions. Bear in mind that it is only very lightly tested on Windows.
If you are behind a proxy, you will have to configure your CPAN client to go through the proxy. Launch your CPAN client:
o conf init /proxy/
Your ftp_proxy ? http://proxyaddress:port
Your http_proxy ? http://proxyaddress:port
Your no_proxy ? http://proxyaddress:port
Your proxy user id ? Your ID
Your proxy password ? Your password
If everything is correct, you could now install the required modules:
install File::Slurp File::Find::Rule Text::ASCIITable Config::General
A command line help is available by launching ./code2pg --help
. The full documentation is available here.
TL;DR: it can work with almost any language.
Here is the long version and is quite important to understand how code2pg
should be used. Oracle instructions can be found anywhere in the source code (for example in SQL files) or in strings (for example in .java files). Looking only in strings will help avoid many false positives. If you know that you are looking for Oracle instructions in "
delimited strings, you can either specify java as a language, or define your own string delimiters in the %REGEX_BEFORE and %REGEX_AFTER variables. This should be made available in the configuration file in a further release.
In the case of Oracle, estimates are now not done for the following:
- DDL
- sql loader files (usually .ctl files)
Automatic translation is a very difficult subject in its own. What makes it even more difficult here is the presence of dynamic sql that can be generated in your application code. This will require implementing a proper parser and a huge number of rules. Such a work will not be done in the near future.
No software is perfect and code2pg
does not have such ambitions. If something is not working as documented, if you notice a bug or wish to add new features, do not hesitate to fill issues or make pull requests.
If you think some SQL instructions are missing, please raise an issue.