Re: Database Recovery from Corrupted Dump or Raw database table file.

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "'Howard News *EXTERN*'" <howardnews(at)selestial(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Database Recovery from Corrupted Dump or Raw database table file.
Date: 2016-11-07 13:12:43
Message-ID: A737B7A37273E048B164557ADEF4A58B53979266@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Howard News wrote:
> I have a raid catastrophe which has effectively blitzed a cluster data
> directory. I have several pg_dump backups but these will not restore
> cleanly. I assume the disk has been failing for some time and the
> backups are of the corrupted database.
>
> Using a selective pg_restore on the dumps, I have restored 2/3rds of the
> data but some tables I cannot recover directly, so I would like to see
> if it is possible to examine the dumps (they are in compressed format)
> to see if there are any rows which are recoverable. I do not know how or
> if it is even possible to pick out rows from an individual table, when
> in all likelyhood the file itself is corrupted.
>
> I also have some parts of the data directory, so the tables may be
> accessible if I know the ID of the corrupt datatables. Is the ID listed
> in the pg_dump --list file? And can the data be extracted from the raw
> data files without running a cluster. I am unsure if there is enough
> data to actually start a cluster.

A backup created with pg_dump consists of SQL statements to recreate the
objects.

You can extract the SQL statements as text with

pg_restore -f sqlfile backupfilename

That should help you with restoring the data.

What exactly do you mean by "do not restore cleanly"?
Do you get error messages or is the content not ok?

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Westermann 2016-11-07 13:15:42 Documentation archive links broken for 6.3 up to 7.1
Previous Message Durumdara 2016-11-07 13:12:13 Surviving connections after internet problem