views:

156

answers:

3

I am doing some research on migrating away from Microsoft sql server to postgresql and am looking for the best tools to get the job done.

Specifically looking for a tool similar to MySQL Migration Toolkit, I did a test migration of our databases to MySQL and had each one under way in under an hour.

It looks like pgAdmin will do most of what were doing with Sql Server Management Studio and the pg_stat tables will be good enough for performance tuning.

So what are the other key tools that everyone uses when developing for and working with postgresql ?

+1  A: 

In migrating postgressql from one version to another which had no tools for it I used only one tool, unix's sed.

My recommendation is to simply export the sql. Clean up the export client specific eccentrics (usually in comments), then try importing it into a sql database and see what happens. The errors are your guidelines. Use sed to go through the mssql file and output the postgres sql file correcting the errors. Once you are in a functional environment, look at the data itself, some things may be other than you expected. After testing and further correction you are good to go.

Chisum
this is going to be a little painful on tables with millions of records but doable, I may just end up writing a small script to connect to both databases and move the data.
Lance
That might work smoother. The number of edits you have to do with Sed isn't too much. The lines are hard to craft sometimes as regular expressions. But you're essentially solving one TYPE of problem at a time, instead of each individual problem one on one. I wish I had the script I wrote, I would post as example. If you are a reg expression guru tho, it is fairly easy. Good luck :)
Chisum
+1  A: 

I agree with Chisum. I would export the data from MSSQL as a SQL script (or a subset if it's huge - perhaps one table at a time or smaller ranges); and try running it against postgres; and see what happens. You may have to write a sed or a small perl script if there's any gnarlies to make it work right, but I wouldn't expect it to be ridiculous.

Import the data into postgres and see what happens. You're likely to run into more issues with the table structure, indices and references than other things.

Theres some info on the Postgres website here: http://wiki.postgresql.org/wiki/Converting_from_other_Databases_to_PostgreSQL#Microsoft_SQL_Server

Fiid