Thread: data restore

data restore

From
"Alex Cheung Tin Ka"
Date:
Dear All,
    I have wrongly update a column data in pg database. I have the backup of the data directory on the tape.  The problem is I don't want to affect other database, who can provide some suggestion.  I have ever try to find out the data director, but only a set of number appears and don't know what these number means.  How can I find out which number corresponds to with database.
 
Thanks
Alex

Re: data restore

From
Richard Huxton
Date:
On Saturday 16 Nov 2002 3:06 am, Alex Cheung Tin Ka wrote:
> Dear All,
>     I have wrongly update a column data in pg database. I have the backup
> of the data directory on the tape.  The problem is I don't want to affect
> other database, who can provide some suggestion.  I have ever try to find
> out the data director, but only a set of number appears and don't know what
> these number means.  How can I find out which number corresponds to with
> database.

Well - it's not quite as simple as that. You can't just restore a single file
even once you've identified the files (there is a utility in contrib called
oid2name IIRC which'll do this for you). The files are named for the oid of
the corresponding item (table, index).

Your best bet is to restore the *entire* data directory to a separate machine
with a clean install of Postgresql and use pg_dump to retrieve the table(s)
you want, then restore from that.

Always use pg_dump to backup your database - it guarantees an accurate
snapshot of your database.
--
  Richard Huxton