Re: Dump all in several files

From: javier wilson <javier(dot)wilson(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Dump all in several files
Date: 2005-03-15 16:32:38
Message-ID: da884c2005031508323f6d571c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 15 Mar 2005 12:15:39 -0400, Alvaro Herrera
<alvherre(at)dcc(dot)uchile(dot)cl> wrote:
> On Tue, Mar 15, 2005 at 05:01:39PM +0100, Frederic Massot wrote:
> > Lonni J Friedman wrote:
> > >On Tue, 15 Mar 2005 16:43:01 +0100, Frederic Massot
> > ><frederic(at)juliana-multimedia(dot)com> wrote:
> > >
> > >>Hi,
> > >>
> > >>On the PostgreSQL 6.5 server I use this shell script (see below) for the
> > >>backup all of the database in several files, one file per database.
> > >
> > >Maybe i'm just not following you, but why can't you just do:
> > >pg_dump $DBNAME >$DB_NAME
> > >
> > >where $DB_NAME is the name of each database on the box?
> > >
> >
> > This script is called in a crontab the every day at 6 o'clock in the
> > morning.
>
> You can obtain the list of databases for scripting with
>
> psql -tlA | cut -d\| -f1
>

i didn't know that. very nice. try:

psql -Upostgres -tlA |cut -d\| -f1|xargs -i pg_dump -Upostgres -f
'{}'.dump.sql '{}'

javier

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2005-03-15 16:35:06 Re: Filesystem level backup and 32 / 64 bit
Previous Message Marco Colombo 2005-03-15 16:27:43 Re: plpython function problem workaround