Untraditional point in time recovery. - Mailing list pgsql-admin

From Jesper Krogh
Subject Untraditional point in time recovery.
Date
Msg-id 4EB981F7.5040802@krogh.cc
Whole thread Raw
List pgsql-admin
Hi List.

I have somehow, come up with a postgresql left in this state..

The database crashed today, needing to do a point in time restore that
should stop today before 10:30. I do have wal-files from today - 7 days
available
and I have a scheduled base backup that runs:

pg_start_backup before and pg_stop backup after, once a week. The
last one being -2 days old and the former being -9 days old.

When inspecting the backup I can see that the former backup had
failed to run "pg_stop_backup" so, the pg_start_backup command
of the -2 base backup has failed.

Can I instruct to postgresql to start from the -2 days base backup and
go back to the last "checkpoint" prior to the backup start form the
transaction logs and apply log from that point up until today?

Normally I would just start by the -9 base and apply wal-log from there, but
I am missing a days worth log-file to do that.

So the situation is:
pg_start_backup was run 9 days ago
pg-dirs was copied 2 days ago
pg_stop_backup was run 2 days ago.
I have now-7days worth of archived logs.

It should be safe to just apply "wal-log" from any state prior to -2
days ago?
Can somehow instruct pg to do just that? And reach consistent state
after that.

Should I manually craft a backup_label file?

thanks.


Jesper .. and yes, I'll make sure that the exitstatus from
pg_start_backup gets propagated
correctly back from now on..

pgsql-admin by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: streaming replication
Next
From: "Ruslan A. Bondar"
Date:
Subject: How to deal with corrupted database?