我用
pg_dump db_production > postgres_db.dump
然后使用scp将其复制到localhost。
现在当我导入我的本地db时,它给出了一个错误
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 db_production > postgres_db.dump
然后使用scp将其复制到localhost。
现在当我导入我的本地db时,它给出了一个错误
pg_restore: [archiver] input file appears to be a text format dump. Please use psql.
使用命令行
pg_restore -d db_development postgres_db.dump
当前回答
对我来说,当我试图从远程主机恢复我使用
psql -U username -p 5432 -h 10.10.10.1 -d database < db.dump
工作得很好。如果不是远程,只是下面的命令工作。
psql -d database < db.dump
其他回答
这是解,
pg_restore -U username -p 5432 -h 10.10.10.1 -d database_name < dump_file . pg_restore -U username -p 5432
如果使用pg_dump和-Fp进行明文备份,则使用以下命令:
cat db.txt | psql dbname
将所有数据复制到名为dbname的数据库
psql -U <username> -d <database-name> -h <host-name> -f <backup.sql> . p
上面的答案对我没用,下面这个有用:
PSQL db_development < postgres_db.dump
对我来说,就像这样。
C:\Program Files\PostgreSQL\12\bin> psql -U postgres -p 5432 -d dummy -f C:\Users\Downloads\d2cm_test.sql