Thread: Restoring from pg_data
Hello all.
I'm a newbie in need of help :)
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?
Thanks in advance.
Rafael Ortiz
Rafael Enrique Ortiz Guerrero <dirakx@gmail.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
Hi Tom
On Mon, Dec 6, 2010 at 7:18 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Rafael Enrique Ortiz Guerrero <dirakx@gmail.com> writes:If you have a complete undamaged copy of the $PGDATA directory tree,
> 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?
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.
I have a server executable of the postgres version that the DB was working on, the problem is that i have two versions of postgres running in that server, but only the latest version (8.4) seems to be getting up the DBs, while the old version don't, I've checked and all the DBs are there in $PGDATA, I've tried with psql and it only shows the 8.4 DBs not the 8.2 DBs.
What can I do?
Thanks for your reply Tom!
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
On 2010-12-07, Rafael Enrique Ortiz Guerrero <dirakx@gmail.com> wrote: > I have a server executable of the postgres version that the DB was working > on, the problem is that i have two versions of postgres running in that > server, but only the latest version (8.4) seems to be getting up the DBs, > while the old version don't, I've checked and all the DBs are there in > $PGDATA, I've tried with psql and it only shows the 8.4 DBs not the 8.2 DBs. > > What can I do? what os + distro for debian linux you could try psql --cluster 8.2/main -l and/or pg_dumpall --cluster 8.2/main for more info on the debian weirdness see the documentation for the postgresql-common package and the pg_wrapper man-page -- ⚂⚃ 100% natural
Hi Jasen
On Sat, Dec 11, 2010 at 4:52 AM, Jasen Betts <jasen@xnet.co.nz> wrote:
On 2010-12-07, Rafael Enrique Ortiz Guerrero <dirakx@gmail.com> wrote:what os + distro
> I have a server executable of the postgres version that the DB was working
> on, the problem is that i have two versions of postgres running in that
> server, but only the latest version (8.4) seems to be getting up the DBs,
> while the old version don't, I've checked and all the DBs are there in
> $PGDATA, I've tried with psql and it only shows the 8.4 DBs not the 8.2 DBs.
>
> What can I do?
for debian linux you could try
psql --cluster 8.2/main -l
and/or
pg_dumpall --cluster 8.2/main
Great this is what was looking for, I'm always running Ubuntu/Debian servers so this is useful.
for more info on the debian weirdness see the documentation for the
postgresql-common package and the pg_wrapper man-page
Thanks!
--
⚂⚃ 100% natural
--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice