data restore

Started by Alex Cheung Tin Kaover 23 years ago2 messagesgeneral
Jump to latest
#1Alex Cheung Tin Ka
tkcheung@vtc.edu.hk

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

#2Richard Huxton
dev@archonet.com
In reply to: Alex Cheung Tin Ka (#1)
Re: data restore

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