Automating backup - Mailing list pgsql-general

From Richard Sydney-Smith
Subject Automating backup
Date
Msg-id 43E2CE50.3040904@ibisau.com
Whole thread Raw
Responses Re: Automating backup  (Doug McNaught <doug@mcnaught.org>)
List pgsql-general
I would like each database to encapsulate its own backup procedure.

Each database contains a table (fsyslog) which has a record of each
backup taken:
<rowid><Operator><timestamp><destination path>

At the application level I presently
a) check for time since the last backup
b) if older than <x> hrs
      (i) perform a vacuum analyze
      (ii) force a call to dbbackup
      (iii) add a new record into fsyslog

I would like to add a procedure to the database that does the backup and
thus ensure that all applications use the same methodology.

The procedure would take only the backup path as a parameter.

presently I send the command :

      pch := pchar('pg_dump -C -h '+host+' -U '+usr+' -p '+pswd+ ' -f
'+bckup_path+' '+dbase);

to postgres.

as the operator is obviously logged in how do I
(1) trap their user id
(2) Send the call to pg_dump without knowing their password?

I expect this is a well worn route and am hoping not to have to reinvent
a wheel.

thanks very much as always

Richard



pgsql-general by date:

Previous
From: Mark Dilger
Date:
Subject: Re: Primary keys for companies and people
Next
From: Richard Sydney-Smith
Date:
Subject: Automating Backup