Re: Restoring databases using only data/ dir

From: Afra <aa4(at)cse(dot)buffalo(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: Restoring databases using only data/ dir
Date: 2002-10-03 20:37:03
Message-ID: 3D9CAA6F.5000409@cse.buffalo.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Thank you for the quick reply. Here is a more detailed account of what
is happening...

Well, we were hosting our Postgres boxes at a co-host place. The machine
crashed and has no dumps of any databases on there. However, luckily, I
do have a tar backup of the pgsql directory, which contains all the
files in data/.

Now, the old server was running postgres 7.1. So I installed the same
version in house and moved over the data/ directory from the backup tar
file to the newly build data directory:

# mv backup/pgsql/data/global /usr/local/psql/data/
# mv backup/pgsql/data/base /usr/local/psql/data/
# mv backup/pgsql/data/pg_xlog /usr/local/psql/data
# su - postgres

Postgres starts up fine after the move, but then I cannot actually
retrieve any databases:

$ pg_dump wdcx > wdcx
pg_dump: couldn't find the pg_database entry.
There is no entry in the 'pg_database' table for this database.

Odd thing is, the database is in there and Postgres knows it:

$ createdb wdcx
ERROR: CREATE DATABASE: database "wdcx" already exists
createdb: database creation failed

How do I retrieve all the databases from the directory? I hope I am not
doomed...

Thank you very much.

Afra

> Restoring the *entire* data directory should work.
>
> It seems to me that there's a great deal you haven't told us; if you
> want useful help it's better to err on the side of too much info,
> not too little. For starters, what happens when you try to pg_dump?
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2002-10-03 20:55:35 Re: [HACKERS] Large databases, performance
Previous Message Tino Wildenhain 2002-10-03 20:35:08 Re: [HACKERS] Anyone want to assist with the