输入文件似乎是文本格式的转储。请使用psql [英] input file appears to be a text format dump. Please use psql

查看:1273
本文介绍了输入文件似乎是文本格式的转储。请使用psql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用

pg_dump db_production > postgres_db.dump

然后我使用scp将其复制到localhost。

and then I copy it to localhost using scp.

现在,当我在本地数据库上导入时,它会给出错误

Now when I import on my local db it gives an error

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

使用逗号

pg_restore -d db_development postgres_db.dump


推荐答案

pg_dump 文档:

示例

要将名为mydb的数据库转储到SQL脚本文件

$ pg_dump mydb > db.sql

要将这样的脚本重新加载到名为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

要将存档文件重新加载到名为newdb的(新创建的)数据库中:

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

$ pg_restore -d newdb db.dump

pg_restore 文档:

示例

假设我们已将名为mydb的数据库转储到自定义格式的转储文件中:

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

这篇关于输入文件似乎是文本格式的转储。请使用psql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆