From: | Frank Bax <fbax(at)sympatico(dot)ca> |
---|---|
To: | PostgreSQL List - Novice <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Synch to Database with same schema. |
Date: | 2009-10-18 12:43:24 |
Message-ID: | 4ADB0D6C.2030001@sympatico.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
roody senecal wrote:
> Hello
> We have a custom app running at two locations, where DB is at Location A
> and location B connects to it via a VPN. Our internet went down (long
> story) at location A. As a temporary solution I install the DB at
> Location B, so now location A and B are on different DB. After about
> four weeks internet is back online. How can I synch and compare the two
> databases and make them the same, so I can go back to the original
> setup. (I need a tool that can compare the two db and add all the
> entries that are in B, but not in A to A)
pg_dump DatabaseA > BackupA
pg_dump DatabaseB > BackupB
diff BackupA BackupB > Changes
If conditions are exactly as you think they are; then "Changes" should
only contain INSERT statements which are in BackupB, but not in BackupA.
Use psql to execute the INSERT statements.
If "Changes" file indicates that some rows were changed instead of
inserted; then you can still contruct an approriate "UPDATE" from the
output of diff.
From | Date | Subject | |
---|---|---|---|
Next Message | leela | 2009-10-19 10:33:30 | Does pgsql database (file) size increases automatically as we put data? |
Previous Message | Andreas Kretschmer | 2009-10-18 05:56:14 | Re: Help to dump tables in a database and restore in another database |