Re: Synch to Database with same schema.

Поиск
Список
Период
Сортировка
От Frank Bax
Тема Re: Synch to Database with same schema.
Дата
Msg-id 4ADB0D6C.2030001@sympatico.ca
обсуждение исходный текст
Ответ на Synch to Database with same schema.  (roody senecal <roodysenecal@yahoo.com>)
Список 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 по дате отправления:

Предыдущее
От: Andreas Kretschmer
Дата:
Сообщение: Re: Help to dump tables in a database and restore in another database
Следующее
От: leela
Дата:
Сообщение: Does pgsql database (file) size increases automatically as we put data?