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

From: Karl DeBisschop <kdebisschop(at)h00a0cc3b7988(dot)ne(dot)mediaone(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Mirroring a DB (was Re: [GENERAL] \d shows all my tables twice)
Date: 1999-12-11 23:20:18
Message-ID: 199912112320.SAA12300@h00a0cc3b7988.ne.mediaone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> > 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 <live> <table> | psql -h <mirror> <table>
>
> (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 <live> <database> | psql -h <mirror> <database>

Note the addition of the -c option and the correction of my typo --
where I meant <database> I said <table> earlier.

Hope this helps.

Karl

Browse pgsql-general by date

  From Date Subject
Next Message Rick Dearman 1999-12-11 23:51:59 Getting lists of databases
Previous Message Peter Eisentraut 1999-12-11 14:51:44 Re: Mirroring a DB