Обсуждение: pg_restore

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

pg_restore

От
Branka Stancic
Дата:
Hi=2CI have problem.I want to restore only data in database.In pgAdmin I wa=
s backup only data from old database and now i have  backup file backup.sql=
.In terminale I want restore only data in new database and I using command =
pg_restore -i -h localhost -p 5432 -U postgres -d payroll --data-only -v "/=
home/postgres/backup.sql"=2Cbut i get an error:pg_restore:[archiver] input =
file appears to be a text format dump.Please use psql
Thanks in advance for your suggestions.

                           =

Re: pg_restore

От
"Kevin Grittner"
Дата:
Branka Stancic wrote:

> I using command pg_restore

> get an error: pg_restore: [archiver] input file appears to be a
> text format dump. Please use psql

pg_restore is not used for restoring text files; psql is. If you
want to use pg_restore you should use -Fc when you run pg_dump. At
this point, you need to run the script file in through psql. If it
contains steps you don't want to execute, you will need to copy and
edit the file to leave just the portions you want to run.

-Kevin

Re: pg_restore

От
John R Pierce
Дата:
On 12/5/2012 4:40 AM, Branka Stancic wrote:
> I have problem.
> I want to restore only data in database.
> In pgAdmin I was backup only data from old database and now i have
>  backup file backup.sql.
> In terminale I want restore only data in new database and I using
> command pg_restore -i -h localhost -p 5432 -U postgres -d payroll
> --data-only -v "/home/postgres/backup.sql",
> but i get an error:
> pg_restore:[archiver] input file appears to be a text format
> dump.Please use psql

pg_restore is only for binary dumps such as are generated by pg_dump -Fc

plain text dumps are restored with psql -f filename.sql

if you dumped just the data, then thats all it will restore (data only
mean it won't create the tables and such),   but you probably should
truncate the existing tables first if there's old data in them.