PostgreSQL -从数据库转储中恢复一个备份表



我的PowerShell当前目录是备份目录/文件夹。我使用pg_dump -h localhost -p 5432 -U postgres -d postgres -t emp > empbackup.sql来备份一个特定的表。我也用pg_dump -h localhost -p 5432 -U postgres -d postgres -t emp > empbackup.dump。现在我要将该表恢复到数据库中。emp表是无外键、主键、完全隔离的表。我尝试了几种方法。都失败了。相关问题:PostgreSQL -从数据库转储中恢复一个表

pg_restore -t emp -d postgres empbackup.sql

误差Pg_restore: error:输入文件不存在

psql -U postgres -d postgres  -f empbackup.sql

误差——psql: empbackup。sql:1: ERROR:语法错误"ÿ_">
——LINE 1: ÿ_-

pg_restore --host localhost --port 5432 --username postgres -d postgres  -t     public.emp  --verbose "C:UsersJIAN HEDesktoppgempbackup.sql"

误差——pg_restore: error: input file does not appear as a valid archive

pg_restore -t emp -d postgresql empbackup.dump

误差Pg_restore: error:输入文件不存在

带点的y是对UTF字节顺序标记(BOM)的误解

在我的手中,psql -f file在powershell上不知道如何处理这些,但在管道上它知道(或者它们只是不被写在管道上)

type empbackup.sql | psql -U postgres -d postgres

相关内容

最新更新