Automating backup

From: Richard Sydney-Smith <richard(at)ibisau(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Automating backup
Date: 2006-02-03 03:30:24
Message-ID: 43E2CE50.3040904@ibisau.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Sydney-Smith 2006-02-03 03:40:19 Automating Backup
Previous Message Madison Kelly 2006-02-03 03:30:03 Solved: Re: Logging queries