[英]pg_restore: [directory archiver] could not open input file. Error while trying to restore DB
[英]pg_restore: [archiver] input file appears to be a text format dump. Please use psql
我试图通过以下命令从 sql 文件在远程服务器上创建一个新数据库 (analyses_db):
pg_restore -d analyses_db byoryn_resource.sql
我收到了错误信息
pg_restore:[archiver] 输入文件似乎是文本格式转储。 请使用 psql。`
当我尝试按照说明操作时:(来自https://stackoverflow.com/a/40632316/15721796 )
将这样的脚本重新加载到名为 newdb 的(新创建的)数据库中:
$ psql -d newdb -f db.sql
我收到了:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
作为菜鸟,我不知道如何解决这个问题。 提供的 SQL 文件应该没问题。
解决连接错误后,我尝试了命令sudo -u postgres psql db_name < 'file_path'
(来自https://stackoverflow.com/a/26610212/15721796 )
效果很好。
希望这可以帮助有同样问题的人。
这里还有一些有用的文档https://www.postgresql.org/docs/9.1/backup-dump.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.