Re: pg_dump in stand alone backend

From: Daniel Martini <dmartini(at)uni-hohenheim(dot)de>
To: Ulrich Wisser <ulrich(dot)wisser(at)relevanttraffic(dot)se>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pg_dump in stand alone backend
Date: 2004-08-23 10:18:40
Message-ID: 1093256320.4129c4801b826@webmail.uni-hohenheim.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Citing Ulrich Wisser <ulrich(dot)wisser(at)relevanttraffic(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Csaba Nagy 2004-08-23 10:41:25 Re: view triggers/procedures
Previous Message SVGK, Raju (Raju) 2004-08-23 10:06:03 view triggers/procedures