Re: copy a database - Mailing list pgsql-general

From David Suela Fernández
Subject Re: copy a database
Date
Msg-id 1093442898.20806.13.camel@yen-lo-wang
Whole thread Raw
In response to Re: copy a database  (Christopher Browne <cbbrowne@acm.org>)
Responses Re: copy a database
Re: copy a database
Re: copy a database
List 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@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

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@xsto.info>
xsto.info <el acceso a la información>


pgsql-general by date:

Previous
From: "Matthew Marlowe"
Date:
Subject: Re: Gentoo for production DB server?
Next
From: Ennio-Sr
Date:
Subject: Display of text fields