input file appears to be a text format dump. Please use psql

前端 未结 7 1122
星月不相逢
星月不相逢 2020-12-04 09:33

I take backup using

pg_dump db_production > postgres_db.dump

and then I copy it to localhost using scp.

Now when I import on my

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-04 10:11

    In order to create a backup using pg_dump that is compatible with pg_restore you must use the --format=custom / -Fc when creating your dump.

    From the docs:

    Output a custom-format archive suitable for input into pg_restore.

    So your pg_dump command might look like:

    pg_dump --file /tmp/db.dump --format=custom --host localhost --dbname my-source-database --username my-username --password
    

    And your pg_restore command:

    pg_restore --verbose --clean --no-acl --no-owner --host localhost --dbname my-destination-database /tmp/db.dump
    

提交回复
热议问题