Re: copy a database

Поиск
Список
Период
Сортировка
От Christopher Browne
Тема Re: copy a database
Дата
Msg-id m3pt5f9xxu.fsf@wolfe.cbbrowne.com
обсуждение исходный текст
Ответ на copy a database  (David Suela Fernández <dsuela@xsto.info>)
Ответы Re: copy a database  (David Suela Fernández <dsuela@xsto.info>)
Список pgsql-general
In an attempt to throw the authorities off his trail, dsuela@xsto.info (David Suela Fernández) transmitted:
> Is it possible to copy/migrate one database from one postgres server to
> other copying just the files in /var/lib/postgres/data/ ?
>
> I can't use pg_dump because it give me an error. I think than the
> instalation of postgres is corrupt because it give me a lot of error
> like "ERROR:  relation "pg_catalog.pg_user" does not exist".

Copying files from a corrupted database will just get you a _second_
corrupt database.

If it's corrupted, then the best you can do is to get what data you
can out of the database, and put it into a NEW database.

What you might try would be to dump it table by table:

for table in this_table that_table other_table; do
  pg_dump -p $SOURCEPORT -t $table $SOURCEDB | psql -p $NEWPORT $NEWDB
done

If the database is corrupted, that's likely to partly break, but I
doubt you'll do much better any other way.
--
If this was helpful, <http://svcs.affero.net/rm.php?r=cbbrowne> rate me
http://cbbrowne.com/info/lisp.html
"Natives who beat drums to drive off evil spirits are objects of scorn
to smart Americans who blow horns to break up traffic jams."
-- Unknown

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

Предыдущее
От: David Suela Fernández
Дата:
Сообщение: copy a database
Следующее
От: Mark Gibson
Дата:
Сообщение: Re: Gentoo for production DB server?