Re: split pg_dumpall backups per database - Mailing list pgsql-general

From Andrej Ricnik-Bay
Subject Re: split pg_dumpall backups per database
Date
Msg-id b35603930803111037g68894783r34d4eae073edcacd@mail.gmail.com
Whole thread Raw
In response to split pg_dumpall backups per database  (Luca Ferrari <fluca1978@infinito.it>)
List pgsql-general
On 11/03/2008, Luca Ferrari <fluca1978@infinito.it> wrote:
> Hi all,
>  is it possible to instrument pg_dumpall to produce separate sql files for each
>  database it is going to backup? I'd like to keep separate backups of my
>  databases, but using pg_dump can lead to forgetting a database.....

You could use the method described here for a single database:
http://archives.postgresql.org/pgsql-general/2008-02/msg00343.php

Just slap a wrapper around it (untested),  out.sql being the name of
the dump-file:

for i in  $(awk '/^CREATE DATABASE/ {print $3}' out.sql); do dump.sh
${i} out.sql  ${i}.sql; done

Of course you won't be getting the creation of specific roles or
anything that way.


>  Thanks,
>  Luca
Cheers,
Andrej

--
Please don't top post, and don't use HTML e-Mail :}  Make your quotes concise.

http://www.american.edu/econ/notes/htmlmail.htm

pgsql-general by date:

Previous
From: Joshua
Date:
Subject: basic plpgsql / sql funtion question
Next
From: "Mike"
Date:
Subject: Re: message contents do not agree with length in message type "T"