Обсуждение: Unable to user pg_restore

Поиск
Список
Период
Сортировка

Unable to user pg_restore

От
"Kumar"
Дата:
Dear Friends,
 
I have created a compressed backup for the database - sampledb using the following
$ pg_dump -h 192.128.2.51 -v -u -f /home/db_repository/sampledb20031020.sql.tar.gz wats -F c
 
while I try to restore this with the pg_restore function as follows
$ pg_restore -d sampledbtest -f /home/db_repositorysampledb.sql.tar.gz -F c -v -c -O -h 192.128.2.51 -p 5432 -u
User name: postgres
 
It never prompt for password, so I just typed the password , and get the error as follows,
postgres
pg_restore: [archiver] did not find magic string in file header
$
 
Anyone could advise me on this pls.
 
Kumar

Re: Unable to user pg_restore

От
Tom Lane
Дата:
"Kumar" <sgnerd@yahoo.com.sg> writes:
> $ pg_restore -d sampledbtest -f /home/db_repositorysampledb.sql.tar.gz -F c=
>  -v -c -O -h 192.128.2.51 -p 5432 -u
> User name: postgres

This is the wrong way to invoke pg_restore.  "-f file" is an *output*
file name.  -d and -f are mutually contradictory options ... not sure
why the thing doesn't complain about that.  What you want is just

pg_restore -d sampledbtest -v -c -O -h 192.128.2.51 -p 5432 -u inputfilename

Depending on whether -d or -f takes precedence, the program might have
tried to overwrite your dump file; better check.
        regards, tom lane