Re: restore a dump db from tar file

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Alain Roger <raf(dot)news(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: restore a dump db from tar file
Date: 2008-10-06 16:31:35
Message-ID: 48EA3D67.9030502@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 06/10/2008 16:12, Alain Roger wrote:

> AFAIK, pg_dump -v -o -U username -ci -Ft -f tarname.tar dbname
> backup the DB but without inserting code to create the BD itself... just

What's -ci? Looking at the docs, there's are -c and -i options, but I
don't see -ci.

> how can i do that automatically ?
> i mean when i dump my db, how can i dump ALSO the script to create the
> BD and its property ?

From the docs:

<quote>
-C
--create

Begin the output with a command to create the database itself and
reconnect to the created database. (With a script of this form, it
doesn't matter which database you connect to before running the script.)

This option is only meaningful for the plain-text format. For the
archive formats, you can specify the option when you call pg_restore.
</quote>

So it seems that you can't do it when using a non-text format - you'll
have to do a plain-text dump, and maybe pipe it to tar if you want that.

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod(at)iol(dot)ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gerfried Fuchs 2008-10-06 16:39:56 Re: [Pkg-postgresql-public] Postgres major version support policy on Debian
Previous Message Scott Marlowe 2008-10-06 16:11:16 Re: restore a dump db from tar file