Mirroring a DB (was Re: [GENERAL] \d shows all my tables twice)

Поиск
Список
Период
Сортировка
Искать

Mirroring a DB (was Re: [GENERAL] \d shows all my tables twice)

От:
Karl DeBisschop <kdebisschop@h00a0cc3b7988.ne.mediaone.net>
Дата:

>  > By the way, I know about using pg_dump to backup the database and I do
>  > that.  Is there a good way to maintain a second identical copy of the
>  > database on another machine?  Will simply copying the dump over and
>  > restoring it with psql do the trick?  Would I need to delete an old copy
>  > of the same database first?  We have a somewhat slow Internet connection
>  > to our Linux system's location and it would be nice to have an alternate
>  > site with the same data.
>  
>  We sometimes do:
>  
>   pg_dump -o -h   | psql -h  
> > (Note that you will probably want -z as well if pre-6.5) > > This generally works, but has a habit recreating the views as actual > tables. Often you can live with this, and there may be a simple way > to prevent it. I just haven't found one yet. Based on notes from the PostgreSQL development team and subsequent testing on our machines, it appears this issue was fixed by either 6.5.2 or 6.5.3 - so the pipe above should work reliably now, assuming your view was created using a DBMS version 6.5.3 (or maybe 6.5.2 will do as well). To avoid needing to destory/create the DB, use: pg_dump -c -o -h | psql -h Note the addition of the -c option and the correction of my typo -- where I meant I said
earlier. Hope this helps. Karl
FAQ