如何解决将 psql 转储恢复到其他新数据库名称 -d/--dbname 和 -f/--file 不能一起使用 问题
pg_dump --file "dump_file.sql" \
--host "localhost" \
--port "5432" \
--username "username" \
--verbose \
--format=c \
--blobs \
--encoding "UTF8" \
--schema "public" \
"dbname"
然后当我尝试恢复它时:
pg_restore --file "dump_file.sql" \
--clean \
--create \
--no-privileges \
--no-owner \
--format=c \
-U "username" \
-d "newdatabasename"
它说:
pg_restore: error: options -d/--dbname and -f/--file cannot be used together.
如果我删除 -d "newdatabasename"
,它会说:
pg_restore: error: Could not read from input file: end of file
问题
经过一些阅读,我认为 --no-privileges --no-owner
会修复它,但事实并非如此......
解决方法
对于 pg_restore
,转储文件不是 --file
的参数。它根本不是一个选项参数。
pg_restore --clean \
--create \
--no-privileges \
--no-owner \
--format=c \
-U "username" \
-d "newdatabasename" \
"dump_file.sql"
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。