Postgres 数据库导出和导入,$$PATH$$ 问题
Postgres database export and import, problem with $$PATH$$
我正在使用 postgres
数据库进行导出和导入。
我曾使用以下命令备份 postgres
db
C:\dirs> pg_dump -U postgres -p 15432 -W -F t cgate-next-demo > .\dbexport_10th_February_2022.tar
Password:*****
我已经解压缩 dbexport_10th_February_2022.tar
文件并继续导入数据库。作为第一步,我删除了数据库。
#drop database if exists "cgate-next-demo";
并且我重新创建了空数据库。
#create database "cgate-next-demo";
为了做到这一点,我已经登录 psql
一次,
C:\dirs> psql -U postgres -p 15432
Password for user postgres:*****
postgres=#
对于数据库导入,我使用了以下命令。
C:\dirs> psql -U postgres -p 15432 -d cgate-next-demo <restore.sql
当我这样做时,出现了以下错误。我从控制台日志中摘录了这段内容。
ERROR: could not open file "$$PATH$$/6052.dat" for reading: No such
file or directory HINT: COPY FROM instructs the PostgreSQL server
process to read a file. You may want a client-side facility such as
psql's \copy.
有人可以指导导致此问题的原因。
你这样做的方式不对。与其解压缩存档,不如将其作为参数传递给 pg_restore
。这将为您完成一切。
我正在使用 postgres
数据库进行导出和导入。
我曾使用以下命令备份 postgres
db
C:\dirs> pg_dump -U postgres -p 15432 -W -F t cgate-next-demo > .\dbexport_10th_February_2022.tar
Password:*****
我已经解压缩 dbexport_10th_February_2022.tar
文件并继续导入数据库。作为第一步,我删除了数据库。
#drop database if exists "cgate-next-demo";
并且我重新创建了空数据库。
#create database "cgate-next-demo";
为了做到这一点,我已经登录 psql
一次,
C:\dirs> psql -U postgres -p 15432
Password for user postgres:*****
postgres=#
对于数据库导入,我使用了以下命令。
C:\dirs> psql -U postgres -p 15432 -d cgate-next-demo <restore.sql
当我这样做时,出现了以下错误。我从控制台日志中摘录了这段内容。
ERROR: could not open file "$$PATH$$/6052.dat" for reading: No such file or directory HINT: COPY FROM instructs the PostgreSQL server process to read a file. You may want a client-side facility such as psql's \copy.
有人可以指导导致此问题的原因。
你这样做的方式不对。与其解压缩存档,不如将其作为参数传递给 pg_restore
。这将为您完成一切。