Re: Restoring databases using only data/ dir

Поиск
Список
Период
Сортировка
От Afra
Тема Re: Restoring databases using only data/ dir
Дата
Msg-id 3D9CAA6F.5000409@cse.buffalo.edu
обсуждение исходный текст
Ответ на Restoring databases using only data/ dir  (Afra <aa4@cse.buffalo.edu>)
Ответы Re: Restoring databases using only data/ dir
Список 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@postgresql.org)


В списке pgsql-general по дате отправления:

Предыдущее
От: Tino Wildenhain
Дата:
Сообщение: Re: [HACKERS] Anyone want to assist with the
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Restoring databases using only data/ dir