Re: Restoring a database

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Chris Henderson" <henders254(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Restoring a database
Date: 2008-10-15 21:26:32
Message-ID: dcc563d10810151426u347754a3h464973daf6e12d62@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Oct 15, 2008 at 3:19 PM, Chris Henderson <henders254(at)gmail(dot)com> wrote:
> I backup all my databases by using pg_dumpall - pg_dumpall >
> /tmp/postgres.backup.`hostname`. It should backup four DBs: analyze,
> postgres, template0 and template1
> I guess this backs up the schemas as well.
>
> Now I want to restore one of the databases and schema from this backup
> dump file onto a different server. The databases is call "analyze".
> Does anyone know how to do that with pg_restore? Thanks.

This is a common mistake. Regular pg_dump / pg_dumpall without custom
format are just plain text dumps and are designed to be restored with
psql. You can take a text editor (or tail / head etc) to the text
file and chop out the parts you want, or you can make a compressed
backup and use pg_restore to do things like what you want.

I generally do a pg_dumpall --globals, and then pg_dump for each
database into a separate file.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Frost 2008-10-15 21:26:49 Re: Restoring a database
Previous Message Chris Henderson 2008-10-15 21:19:36 Restoring a database