I wrote a Perl program to help my company migrate from Interbase to
PostgreSQL by extracting a database's data and metadata and dumping it as a
set of SQL commands (similar to pg_dump or mysqldump).
I wrote the program originally to do a row-level backup of our Interbase
databases. We had a few that were corrupted, and the standard tools were
unable to extract data from them without segfaulting, so I came up with this
to scavenge as much information as possible from the failing databases.
Recently, I convinced my company to dump Interbase in favor of PostgreSQL
(yay!), but we host about 20 websites, each with databases in the hundreds
of thousands of rows, and we weren't looking forward to the data transfer at
all. I happened to remember this program, made a few modifications, and
came up with something that Works Good Enough For Now.
My boss was gracious to let me release this under the terms of the GPL
(thanks, Don!), so feel free to mangle it to your heart's content.
Please, please, PLEASE note that this was never written to be the end-all
be-all of database conversion utilities. It's simply the solution to a
problem that we had, and written with the needs of my company in mind. I
hope that someone else can use it, but it may turn out to be worthless for
anyone but us.
It supports:
- Full exporting of all data and metadata in a database.
- A rudimentary mechanism for re-writing datatype names (a simple one-way
Perl hash).
- Support for converting Interbase auto-incremement triggers to PostgreSQL
SERIAL fields, including setting the current value at the end of the
process.
If you're interested, it can be found at:
http://www.honeypot.net/~kirk/dbreplicate.gz
Let me know if you like it, hate it, or find it remotely useful!
--
Kirk Strauser
Internet Software Engineer
NMotion, Inc.