Tired of your old DB2 databases ? Here’s a new migration kit that will ship your data to PostgreSQL !
Marc Cousin, one of my teamates at Dalibo released yesterday a new migration called db2topg. As he’s a bit too lazy to present his own work, let me introduce you to this tool:
Move from DB2 to Postgres in 8 simple Steps
1- Extract your database schema with db2look
. This will generate a db2 SQL script
2- Launch db2topg.pl
against the db2 SQL script. This will produce 3 Postgres SQL scripts:
before.sql
contains orders that must be run before importing dataafter.sql
contains orders that must be run after importing dataunsure.sql
contains everything the could not be transformed automatically
3- Run the before.sql
script on PosgreSQL.
4- Extract the data from db2 with something like /path/to/db2 -f export.db2
5- Load the data into PostgreSQL with deltocopy -d my_output_dir | psql -e --set=ON_ERROR_STOP=1 my_new_database
6- Run the after.sql
script on PosgreSQL
7- Run the unsure.sql
script on PosgreSQL. Watch it fail and fix the statements that could not be translated automatically.
8- Launch a VACUUM ANALYZE
and enjoy your new PostgreSQL database :)
This is of course a basic tutorial. There’s a bunch of options and parallel modes. Please read the README file for more details.
Last year, Marc wrote a SQL Server to PostgreSQL Migration kit. Together with Gilles Darold (author of ora2pg an Oracle/MySQL Migration tool), they’re now on a personal quest to liberate the DBA of the world from proprietary databases :)
As always this tool is free software. If you use it, please send us feedback and new ideas on the Github page : https://github.com/dalibo/db2topg
blog comments powered by Disqus