Re: Migration from db2 to postgres' - Mailing list pgsql-sql

From Tim Andersen
Subject Re: Migration from db2 to postgres'
Date
Msg-id 20030819124345.62081.qmail@web10005.mail.yahoo.com
Whole thread Raw
In response to Migration from db2 to postgres'  (shyamperi@davlin.co.in)
List pgsql-sql
> I wanted to know how can I migrate all my data
> including the schema and their definitions,from
> IBM's db2 to the postgres.
> 

I have done this with other DBMSs before by writing a
program (using PowerBuilder).  The core concept is
this:

two ODBC datasources (source, target)

for (loop through source's schemas){ for (loop through source's tables){   for(loop through source's rows){     "select
[row]from [source table]"     "insert into [target table]"   } }
 
}

The key is this:  I have a view in both databases to
compare system catalog tables across DBMS platforms.
It is actually the view I was trying to create if you
look back at the SQL questions I asked to this mailing
list a few days ago. the subject was: "Re: [SQL] About
primary keys -- made some progress"

In the past, I ran into several problems with
different datatypes and have had to write workarounds
for those (mainly blobs and timestamps).

Concerning referential integrity:  Two options.  You
could wait to add all of your foreign keys until after
all of the data has transferred from the source to the
target.  The other option is to run the nested loops
several times (this "fills in the gaps" and allows
other tables to be filled each time you run it).  I
prefer the second.

I also have a feature to compare the rowcounts of the
source and target so I can be sure all of my data has
been transferred.

I have not yet implemented PostgreSQL into this
application, but I intend to do that over the next few
months.

Tim


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


pgsql-sql by date:

Previous
From: shyamperi@davlin.co.in
Date:
Subject: Migration from db2 to postgres'
Next
From: Rado Petrik
Date:
Subject: Query problem