Re: split pg_dumpall backups per database

From: "Andrej Ricnik-Bay" <andrej(dot)groups(at)gmail(dot)com>
To: "Luca Ferrari" <fluca1978(at)infinito(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: split pg_dumpall backups per database
Date: 2008-03-11 17:37:24
Message-ID: b35603930803111037g68894783r34d4eae073edcacd@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/03/2008, Luca Ferrari <fluca1978(at)infinito(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Robert Haas 2008-03-11 17:37:42 Re: contributing patches
Previous Message Joshua 2008-03-11 17:26:49 basic plpgsql / sql funtion question