Re: pg_dump in stand alone backend

Поиск
Список
Период
Сортировка
От Daniel Martini
Тема Re: pg_dump in stand alone backend
Дата
Msg-id 1093256320.4129c4801b826@webmail.uni-hohenheim.de
обсуждение исходный текст
Ответ на pg_dump in stand alone backend  (Ulrich Wisser <ulrich.wisser@relevanttraffic.se>)
Ответы Re: pg_dump in stand alone backend  (Ulrich Wisser <ulrich.wisser@relevanttraffic.se>)
Список pgsql-general
Hi,

Citing Ulrich Wisser <ulrich.wisser@relevanttraffic.se>:
> I would like to stop the postmaster every night and run
>
> vacuum
> pg_dump
> reindex
>
> in the stand alone backend.
>
> Vacuum and reindex seem to be quite easy, as I can setup a small script
> with both commands. But what about pg_dump. That seems "somewhat" more
> complex.

What exactly is your problem about putting pg_dump in a (shell)script as
well?
In the simplest case you could use something like:

#!/bin/sh
psql --command vacuum your_database
cd /somewhere/with/write/access
pg_dump your_database > dump_`date %Y%m%d%H%M%S`.bak
psql --command 'reindex whatever_you_want_to_reindex' your_database

which will vacuum, dump to a file named dump_timewhendumpoccured.bak and
reindex whatever_you_want_to_reindex. All kinds of stuff could be added
(like mailing command output to you, loading the backup up to another
machine for storage etc. etc.), but above script does basically what
you were asking for.

Regards,
Daniel

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

Предыдущее
От: Graeme Hinchliffe
Дата:
Сообщение: Catching server shutdown in C
Следующее
От: "SVGK, Raju (Raju)"
Дата:
Сообщение: view triggers/procedures