By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,654 Members | 1,816 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,654 IT Pros & Developers. It's quick & easy.

Migrating data between dbs with different schemas

P: 2
Hi all,
I have a database (postgresql) designed with a particular schema. I have now set up a new postgresql database to store the same data (possibly some new info added) but has a different schema. (Basically, we have designed a new application and tweaked the database schema). The new db is set up using Java5 Java Persitence Architecture (annotations etc). The problem is we need to migrate the data from the old db to the new db. Is there an easy way to do this (other than manually entering the data).
Cheers steve
Feb 13 '07 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 534
One easy way to import your data is to create a data-dump with pg_dump utility.
Whether or not you can use this approach depends on how the new schema differs from the old one.
If you only added new fields you can probably use pg_dump, but you need to opt for INSERT, not COPY and you also have to use field-names

This should work unless the new fields require values.
But even if they do, there's an easy workaround.

Take a look at this:

http://www.postgresql.org/docs/8.0/s...pp-pgdump.html

Hope it helps, but in any case let us know.
Feb 13 '07 #2

P: 4
Hi all,
Is there an easy way to do this (other than manually entering the data).
Cheers steve
Well there are commecial and free software exists to solve this
e.g.
EMS DB Comparer for PostgreSQL (http://www.sqlmanager.net/en/products/postgresql/dbcomparer)
PremiumSoft Navicat, function Structure Synchronization (http://www.navicat.com)
pgdiff project (http://pgdiff.sourceforge.net)
and so on...
Feb 20 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.