Recovering a messed-up database

From: "Reuven M(dot) Lerner" <reuven(at)lerner(dot)co(dot)il>
To: pgsql-general(at)postgresql(dot)org
Subject: Recovering a messed-up database
Date: 2007-05-14 23:04:40
Message-ID: 4648EB08.4010107@lerner.co.il
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm running a PostgreSQL 8.2.0 system on RHEL WS (update 5). The
machine is administered by someone else.

To make a long story short, I thought that the site administrator was
making regular backups, and that I was running pg_dump every night.
Unfortunately, neither assumption was quite right. The administrator
was using rsync to back things up, and accidentally reversed the
parameters a few nights ago, thus wiping out the contents of our PGDATA
directory. Well, not *all* of PGDATA. Among the things that were
partly or completely saved are PGDATA/base. But PGDATA/global, as well
as pg_clog, pg_xlog, and so forth are completely gone.

Now, I can rebuild this thing starting with a pg_dump backup that I made
a month or so ago. (And yes, you can be sure that I'll be making even
more regular backups of this sort in the future. Every other database I
run has a daily cron job to do pg_dump, and this one of all things
slipped through the cracks. Argh.) I'll then have to apply a bunch of
programs that I've written since then to update things. It'll take
time, but it's doable.

I assume that it would be smartest to work from the month-old backup,
rather than take my chances with sketchy data and a lack of any WAL
files. But I just wanted to get a sanity check from the PostgreSQL
community, saying that it would be foolish to try to do surgery on a
potentially flawed database, when a good version will simply take time
to restore.

Thanks for any advice you might have to offer!

Reuven

Responses

Browse pgsql-general by date

  From Date Subject
Next Message marcelo Cortez 2007-05-14 23:46:23 dns less connection
Previous Message Daniel Barlow 2007-05-14 23:01:01 stats collector spins my disk up every 500ms (8.2.3)