Re: copy a database

From: David Suela Fernández <dsuela(at)xsto(dot)info>
To: Christopher Browne <cbbrowne(at)acm(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: copy a database
Date: 2004-08-25 14:08:18
Message-ID: 1093442898.20806.13.camel@yen-lo-wang
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

El mié, 25-08-2004 a las 14:58, Christopher Browne escribió:
> In an attempt to throw the authorities off his trail, dsuela(at)xsto(dot)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

The problem is that pg_dump always give me the next error:

pg_dump: SQL command failed
pg_dump: Error message from server: ERROR: relation "pg_user" does not exist
pg_dump: The command was: SELECT (SELECT usename FROM pg_user WHERE usesysid = datdba) as dba, pg_encoding_to_char(encoding) as encoding, datpath FROM pg_database WHERE datname = 'ez3'

I have the db scheme (tables and basic data), but what i need is the new
data of the db. I can access the db and make queries.

I think i'll make a script to pass data from the corrupt database to the
new one.

--
David Suela Fernández <dsuela(at)xsto(dot)info>
xsto.info <el acceso a la información>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ennio-Sr 2004-08-25 14:15:13 Display of text fields
Previous Message Matthew Marlowe 2004-08-25 13:46:17 Re: Gentoo for production DB server?