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

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

Reason: pg_dump by default creates the sql commands necessary to recreate the data. To recover it, you just need to invoke psql (not pg_restore ) with the file as input . pg_restore is only to be used for the binary format of pg_dump.

Resolution: Use -Fc option with pg_dump. Then, only we will be able to restore database with pg_restore.

1. Take backup of database/table using pg_dump with option -Fc.

pg_dump -d bank --format=c >/home/vijay/dumps/bankldump_31052017.dmp

or

pg_dump -d bank -Fc

2. Restore the database with above backup file.

pg_restore -d bank_dev

More about pg_dump optio -Fc
-F format
–format=format

c(custom): Output a custom-format archive suitable for input into pg_restore. Together with the directory output format, this is the most flexible output format in that it allows manual selection and reordering of archived items during restore. This format is also compressed by default.

Related Posts

Responses are currently closed, but you can trackback from your own site.

Comments are closed.

Powered by k2schools
%d bloggers like this: