Re: Synch to Database with same schema. - Mailing list pgsql-novice

From Frank Bax
Subject Re: Synch to Database with same schema.
Date
Msg-id 4ADB0D6C.2030001@sympatico.ca
Whole thread Raw
In response to Synch to Database with same schema.  (roody senecal <roodysenecal@yahoo.com>)
List 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.

pgsql-novice by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: Help to dump tables in a database and restore in another database
Next
From: leela
Date:
Subject: Does pgsql database (file) size increases automatically as we put data?