webapp_product
为了创建转储文件,我使用以下命令:
docker-compose exec db1 pg_dump -F tar -d db -U user -t webapp_product > /home/backup.tar
然后,在另一台机器上:
sudo mv backup.tar ../pgdata
docker-compose exec db1 sh
pg_restore -Ft -C -U user -d db /var/lib/postgresql/data/pgdata/backup.tar
很不幸,它总是以相同的情况结束。我确实收到以下错误日志:
pg_restore: error: could not read from input file: end of file
我还尝试了另一种方法。在移动备份文件之后,我一直在尝试使用:
cat /var/lib/postgresql/data/pgdata/backup.sql | psql -d db -U user
在调用该命令后,我一直收到一个错误,说我无法创建重复项(记录的ID相同)。
为了继续进行,我尝试关闭所有约束,但没有产生预期的效果。
@更新1
backup.tar文件包含以下行:
-- NOTE:
--
-- File paths need to be edited. Search for $$PATH$$ and
-- replace it with the path to the directory containing
-- the extracted data files.
--
--
-- PostgreSQL database dump
--
-- Dumped from database version 12.1 (Debian 12.1-1.pgdg100+1)
-- Dumped by pg_dump version 12.1 (Debian 12.1-1.pgdg100+1)
它能影响数据恢复的过程吗?
并且有以下结尾:
--
-- PostgreSQL database dump complete
--
tar -tf backup.tar会发生什么? - jjanestar -tf backup.tar. toc.dat.tar: 跳至下一个头文件。
tar: 390 处有单独的零块。 tar: 由于先前的错误,以失败状态退出。 - D Komo