我使用这个为我的 Postgres 9.3.4 生成了一个转储备份文件:
pg_dump table_name -U myusername -h localhost -O > backup.dump
现在我正在尝试使用以下方法备份旧数据库:
pg_restore -U myusername -n public -d table_name backup.dump
但我一直收到这个错误:
pg_restore: [archiver] input file appears to be a text format dump. Please use psql.
请注意,该文件不是普通的 sql 文件,因为我是使用 pg_dump 生成的。
我使用了以下命令:
psql perchwell -U myusername -f backup.dump -v ON_ERROR_STOP=1
并开始收到以下错误:
SET
SET
SET
SET
SET
SET
psql:backup.dump:16: ERROR: schema "propertydir" already exists
最佳答案
pg_dump默认的输出格式其实是明文sql脚本。因此,使用 psql 进行导入或转储,并带有 -Fc
标志。
关于postgresql - 无法使用 pg_restore 为 Postgres 恢复转储备份文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29634404/