review db dump script and difference between pg_dump & pg_dumpall

Поиск
Список
Период
Сортировка
От Chris Henderson
Тема review db dump script and difference between pg_dump & pg_dumpall
Дата
Msg-id d4ee74cf0810082029u4b0616a1k5c9a24ebd0a3acc1@mail.gmail.com
обсуждение исходный текст
Ответы Re: review db dump script and difference between pg_dump & pg_dumpall  (hubert depesz lubaczewski <depesz@depesz.com>)
Список pgsql-general
I have written the following script to backup _all_ databases on
various servers that are running postgresql. I don't want anything
fancy - just be able to backup the database and restore when bad times
come. Just posting it here to be reviewed to see if I have made any
mistake:

#!/bin/bash
DIR=/backup
[ ! $DIR ] && mkdir -p $DIR || :
# ignore any name starting with ---, List, Name, ( or template 0 and 1
LIST=$(psql -l | awk '{ print $1}' | grep -vE
'^-|^List|^Name|^\(|template[0|1]')
for d in $LIST
do
  pg_dump $d | gzip -c >  $DIR/$d.out.postgres.`hostname`.gz
done

Also, I have read the respective manpages but never understood the
difference between pg_dump & pg_dumpall. But I noticed pg_dumpall
dumps the schema (?) and pg_dump dumps the actual tables and rows etc.

Thanks.

В списке pgsql-general по дате отправления:

Предыдущее
От: Wojciech Strzałka
Дата:
Сообщение: Re: Stats collector eats my CPU
Следующее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: review db dump script and difference between pg_dump & pg_dumpall