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

前端 未结 7 1062
星月不相逢
星月不相逢 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:15

    From the pg_dump documentation:

    Examples

    To dump a database called mydb into a SQL-script file:

    $ pg_dump mydb > db.sql
    

    To reload such a script into a (freshly created) database named newdb:

    $ psql -d newdb -f db.sql
    

    To dump a database into a custom-format archive file:

    $ pg_dump -Fc mydb > db.dump
    

    To dump a database into a directory-format archive:

    $ pg_dump -Fd mydb -f dumpdir
    

    To reload an archive file into a (freshly created) database named newdb:

    $ pg_restore -d newdb db.dump
    

    From the pg_restore documentation:

    Examples

    Assume we have dumped a database called mydb into a custom-format dump file:

    $ pg_dump -Fc mydb > db.dump
    

    To drop the database and recreate it from the dump:

    $ dropdb mydb
    $ pg_restore -C -d postgres db.dump
    
    0 讨论(0)
提交回复
热议问题