thclpr
thclpr

Reputation: 5938

Restoring backup file with Postgresql pg_dump

How can i restore a file generated by the command:

pg_dump -i -h localhost -p 5432 -U user -F c -b  -f bkp_file.backup "alfa"

I tried to use psql -U user -d alfa-f bkp_file.backup

But i got tons of errors regarding invalid characters. so i'm not sure if i'm doing the pg_dump correctly.

An exemple of the error output:

psql:cmdb_21-11-2012.backup:1399: invalid command \3?6IÅñå|J‼▼§↓OTaIEDóP&5¶◄▲Ct±^ºO-²
psql:cmdb_21-11-2012.backup:1400: invalid command \ÖÿYÇ/µèI=ÜdUEàmß¿ê÷E|>I▬ßf♂*»Å?B/÷
IYñAªóS`Wö3ßAÆ?l*ádECIY‼)á¢'ul#`aåAArZæp2_í_ÉY-ëU&>ïIìO·▼$5

In fact, theres a lot of those characters on the dumped backup file

Upvotes: 3

Views: 5730

Answers (1)

hd1
hd1

Reputation: 34657

You're dumping a compressed form of the data and restoring it using a program expecting the uncompressed form. Either remove the -F c from your pg_dump line or use pg_restore.

Upvotes: 6

Related Questions