使用ps_restore恢复备份数据库出错:pg_restore: [archiver] input file does not appear to be a valid archive
使用
pg_dump -Fp -t mytable > mytable_back
或
g_dump -t mytable > mytable_back
备份出来的为脚本(纯文本)文件,不能直接使用pg_restore进行恢复。
需要使用命令psql \i
user>psql -U username -d mydb
username=# \i mytable_back
pg_dump和pg_restore的时候使用 格式为 custom(-F c )或tar格式(-F t)即可进行恢复
本文详细介绍了如何使用pg_dump和pg_restore命令进行PostgreSQL数据库的备份与恢复操作。通过示例演示了如何创建备份脚本文件,并提供了在恢复过程中遇到错误时的解决方案。

被折叠的 条评论
为什么被折叠?



