Skip site navigation (1) Skip section navigation (2)

Re: Restoring from pg_data

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: dirakx(at)gmail(dot)com
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Restoring from pg_data
Date: 2010-12-07 00:18:34
Message-ID: 4828.1291681114@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
Rafael Enrique Ortiz Guerrero <dirakx(at)gmail(dot)com> writes:
> I'm trying to restore a BD from pg_data, (i don't have a dump).
> I only have the physical files, googling around have not give useful
> results.

> how can i restore my db from files?

If you have a complete undamaged copy of the $PGDATA directory tree,
then what you do is install a server executable that matches the version
that built the database originally, fire it up, and you have a working
database.  From there you can either dump, or just use it as-is.

If you're not sure which version generated the database, looking into
the PG_VERSION file found at the top level of the tree would be a good
first step.  You also have to match the hardware architecture and
certain configuration properties (such as whether timestamps are
float-based or int-based), but the server should complain if you try to
start it against an incompatible database.  Generally you *don't* need
to worry about minor version, eg, any 8.4.x release will do for an 8.4
database.

			regards, tom lane

In response to

Responses

pgsql-novice by date

Next:From: Rafael Enrique Ortiz GuerreroDate: 2010-12-07 01:58:15
Subject: Re: Restoring from pg_data
Previous:From: Rafael Enrique Ortiz GuerreroDate: 2010-12-06 22:26:22
Subject: Restoring from pg_data

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group