dbTalk Databases Forums  

restor plain text on 7.4

comp.databases.postgresql comp.databases.postgresql


Discuss restor plain text on 7.4 in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dade
 
Posts: n/a

Default restor plain text on 7.4 - 05-07-2007 , 09:37 AM






Hello all,
i would like to restore a backup make in plain text format but i'm not able
to do it. when i give the command:
pg_restore -i -h 192.168.50.3 -p 5432 -U root -d db -l --format=c
"pgsql.sql"

it answer me that he can't find the magic string... how can i solve? i can't
re-make the backup now

thanx in advance
Dade


Reply With Quote
  #2  
Old   
Dade
 
Posts: n/a

Default Re: restor plain text on 7.4 - 05-07-2007 , 09:58 AM







"Dade" <cucca77NOSPAM (AT) gmail (DOT) com> ha scritto nel messaggio
news:463f39b2 (AT) newsgate (DOT) x-privat.org...
Quote:
Hello all,
i would like to restore a backup make in plain text format but i'm not
able to do it. when i give the command:
pg_restore -i -h 192.168.50.3 -p 5432 -U root -d db -l --format=c
"pgsql.sql"

it answer me that he can't find the magic string... how can i solve? i
can't re-make the backup now

thanx in advance
Dade
I forgot to say that the backup has been made in plain text in a postgresql
8.2.4... maybe the 2 versions are not compatibles?




Reply With Quote
  #3  
Old   
jpd
 
Posts: n/a

Default Re: restor plain text on 7.4 - 05-07-2007 , 10:26 AM



Begin <463f413a (AT) newsgate (DOT) x-privat.org>
On 2007-05-07, Dade <cucca77NOSPAM (AT) gmail (DOT) com> wrote:
Quote:
"Dade" <cucca77NOSPAM (AT) gmail (DOT) com> ha scritto nel messaggio
news:463f39b2 (AT) newsgate (DOT) x-privat.org...
pg_restore -i -h 192.168.50.3 -p 5432 -U root -d db -l --format=c
^^^^^^^^^^
it answer me that he can't find the magic string... how can i solve? i
can't re-make the backup now
[snip]
I forgot to say that the backup has been made in plain text in a postgresql
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8.2.4... maybe the 2 versions are not compatibles?
I've found the postgresql documentation scrupulous in documenting what
changed and where backup/restores might give trouble.

In this case, you already gave the answer. If you care to look in the
manpages pg_dump(1) and pg_restore(1) for the values you can pass to
--format, I think you'll find the answer obvious also.


--
j p d (at) d s b (dot) t u d e l f t (dot) n l .
This message was originally posted on Usenet in plain text.
Any other representation, additions, or changes do not have my
consent and may be a violation of international copyright law.


Reply With Quote
  #4  
Old   
przemek tomczyk
 
Posts: n/a

Default Re: restor plain text on 7.4 - 05-07-2007 , 03:46 PM



Dade wrote:

Quote:
"Dade" <cucca77NOSPAM (AT) gmail (DOT) com> ha scritto nel messaggio
news:463f39b2 (AT) newsgate (DOT) x-privat.org...
Hello all,

I forgot to say that the backup has been made in plain text in a
postgresql 8.2.4... maybe the 2 versions are not compatibles?
for now this doesnt't matter:

Quote:
i would like to restore a backup make in plain text format but i'm not
able to do it. when i give the command:
pg_restore -i -h 192.168.50.3 -p 5432 -U root -d db -l --format=c
"pgsql.sql"

it answer me that he can't find the magic string... how can i solve? i
can't re-make the backup now
format=c specifies "custom" format, not plaintext :-)
pg_restore raises error, becuse obviously your backup is not in "custom"
format.

you shall feed this plaintext backup to postgres as text commands - by
smething like "psql --file=pgsql.sql" for example.



--
przemek tomczyk



Reply With Quote
  #5  
Old   
Dade
 
Posts: n/a

Default Re: restor plain text on 7.4 - 05-07-2007 , 06:08 PM




"przemek tomczyk" <cafebabe (AT) zgadnij (DOT) gdzie.pl> ha scritto nel messaggio
news:jqf4h4-o9q.ln1 (AT) proxx (DOT) 9-10.tsi.tychy.pl...
Quote:
Dade wrote:


"Dade" <cucca77NOSPAM (AT) gmail (DOT) com> ha scritto nel messaggio
news:463f39b2 (AT) newsgate (DOT) x-privat.org...
Hello all,

I forgot to say that the backup has been made in plain text in a
postgresql 8.2.4... maybe the 2 versions are not compatibles?
for now this doesnt't matter:

i would like to restore a backup make in plain text format but i'm not
able to do it. when i give the command:
pg_restore -i -h 192.168.50.3 -p 5432 -U root -d db -l --format=c
"pgsql.sql"

it answer me that he can't find the magic string... how can i solve? i
can't re-make the backup now

format=c specifies "custom" format, not plaintext :-)
pg_restore raises error, becuse obviously your backup is not in "custom"
format.

you shall feed this plaintext backup to postgres as text commands - by
smething like "psql --file=pgsql.sql" for example.
I've tryed but this give me errors in a lot of commands...





Reply With Quote
  #6  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: restor plain text on 7.4 - 05-08-2007 , 02:16 AM



Dade <cucca77(NOSPAM)@(nospam)gmail.com> wrote:
Quote:
i would like to restore a backup make in plain text format but i'm not
able to do it. when i give the command:
pg_restore -i -h 192.168.50.3 -p 5432 -U root -d db -l --format=c
"pgsql.sql"

it answer me that he can't find the magic string... how can i solve? i
can't re-make the backup now

format=c specifies "custom" format, not plaintext :-)
pg_restore raises error, becuse obviously your backup is not in "custom"
format.

you shall feed this plaintext backup to postgres as text commands - by
smething like "psql --file=pgsql.sql" for example.

I've tryed but this give me errors in a lot of commands...
Still, this is the only way to do it.

You will have to fix the errors.

If you need assistance, you should show error messages and the commands
in the backup file that caused them.

What was the version of the database from which the dump was taken?
Do you remember the exact dump command line?

Yours,
Laurenz Albe


Reply With Quote
  #7  
Old   
Dade
 
Posts: n/a

Default Re: restor plain text on 7.4 - 05-15-2007 , 10:55 AM




Today i tryed with the pgAdmi III 1.6.3 to backup a database, create a new
one in the same server and restore it in the new db... I get a lot of
errors:

pg_restore: connecting to database for restore
pg_restore: [archiver (db)] Error while INITIALIZING:
pg_restore: [archiver (db)] could not execute query: ERROR: parameter
"standard_conforming_strings" cannot be changed
Command was: SET standard_conforming_strings = off;
pg_restore: [archiver (db)] could not execute query: ERROR: language
"plpgsql" already exists
Command was: CREATE PROCEDURAL LANGUAGE plpgsql;
pg_restore: [archiver (db)] Error from TOC entry 1206; 1259 16385 SEQUENCE
banks_id_seq postgres
pg_restore: [archiver (db)] could not execute query: ERROR: la relazione
"banks_id_seq" esiste già (trad: the sequence allready exist)
Command was: CREATE SEQUENCE banks_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

and the others are for the sequence...
This means that i can't backup a db and replicate it in an other server???
How should i do it in *safe* mode?

thanx all
Dade


Reply With Quote
  #8  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: restor plain text on 7.4 - 05-16-2007 , 02:00 AM



Dade <cucca77NOSPAM (AT) gmail (DOT) com> wrote:
Quote:
Today i tryed with the pgAdmi III 1.6.3 to backup a database, create a new
one in the same server and restore it in the new db... I get a lot of
errors:

pg_restore: connecting to database for restore
pg_restore: [archiver (db)] Error while INITIALIZING:
pg_restore: [archiver (db)] could not execute query: ERROR: parameter
"standard_conforming_strings" cannot be changed
Command was: SET standard_conforming_strings = off;
pg_restore: [archiver (db)] could not execute query: ERROR: language
"plpgsql" already exists
Command was: CREATE PROCEDURAL LANGUAGE plpgsql;
pg_restore: [archiver (db)] Error from TOC entry 1206; 1259 16385 SEQUENCE
banks_id_seq postgres
pg_restore: [archiver (db)] could not execute query: ERROR: la relazione
"banks_id_seq" esiste già (trad: the sequence allready exist)
Command was: CREATE SEQUENCE banks_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

and the others are for the sequence...
This means that i can't backup a db and replicate it in an other server???
No, that means that you restored to the wrong database :^)

First: what version of PostgreSQL do you restore to?
The command "SET standard_conforming_strings = off;" should work on any
8.2 database.

pg_restore could not restore the sequence because it already existed.
Makes sense, doesn't it?
Did you by mistake try to restore into the original database?

Here's how you do it (assuming that the cluster is on the default port on
localhost, else you'll have to season with a couple of -h and -p):

Make a dump of database "orig":

pg_dump -F c -U postgres -f orig.dmp orig

Connect to the "postgres" database and create a new database "dbcopy":

psql -U postgres -d postgres -c 'CREATE DATABASE dbcopy TEMPLATE template0'

Restore the dump into the new database:

pg_restore -d dbcopy -U postgres orig.dmp

Quote:
How should i do it in *safe* mode?
Hmm? Whaddayamean? You have made backups, no?

Yours,
Laurenz Albe


Reply With Quote
  #9  
Old   
Dade
 
Posts: n/a

Default Re: restor plain text on 7.4 - 05-16-2007 , 08:41 AM




"Laurenz Albe" <invite (AT) spam (DOT) to.invalid> ha scritto nel messaggio
news:1179298839.505138 (AT) proxy (DOT) dienste.wien.at...
Quote:
Dade <cucca77NOSPAM (AT) gmail (DOT) com> wrote:
[CUT]
This means that i can't backup a db and replicate it in an other
server???

No, that means that you restored to the wrong database :^)

First: what version of PostgreSQL do you restore to?
The command "SET standard_conforming_strings = off;" should work on any
8.2 database.
that's why! I used a backup to trasfer data from a server to an other one...
from 8.3 to a 7.4 and that istruction is not supported than!

Quote:
pg_restore could not restore the sequence because it already existed.
Makes sense, doesn't it?
Did you by mistake try to restore into the original database?

Here's how you do it (assuming that the cluster is on the default port on
localhost, else you'll have to season with a couple of -h and -p):

Make a dump of database "orig":

pg_dump -F c -U postgres -f orig.dmp orig

Connect to the "postgres" database and create a new database "dbcopy":

psql -U postgres -d postgres -c 'CREATE DATABASE dbcopy TEMPLATE
template0'

Restore the dump into the new database:

pg_restore -d dbcopy -U postgres orig.dmp

Thank you so much, i'll wrote your procedure everywhere

Quote:
How should i do it in *safe* mode?

Hmm? Whaddayamean? You have made backups, no?
now yes

Quote:
Yours,
Laurenz Albe
Thank you very much!
Dade



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.