Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group