加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

postgresql – 当有警告时,pg_restore的退出代码问题

发布时间:2020-12-13 16:16:20 所属栏目:百科 来源:网络整理
导读:命令: bin/pg_dump -b -o -Fc -Z 0 -p 5333 -U user template1 -f db.dumpbin/pg_restore -c -h localhost -p 5333 -U user -d template1 db.dump 步骤如下: 将新表添加到DB并进行转储 删除新添加的表 尝试使用转储文件进行恢复 使用代码1恢复退出但仍然可
命令:
bin/pg_dump -b -o -Fc -Z 0 -p 5333 -U user template1 -f db.dump
bin/pg_restore -c  -h localhost -p 5333 -U user -d template1 db.dump

步骤如下:

>将新表添加到DB并进行转储
>删除新添加的表
>尝试使用转储文件进行恢复
>使用代码1恢复退出但仍然可以成功恢复表.

error in pg_restore:
pg_restore: [archiver (db)] could not execute query: err-1: table “test1” does not exist
Command was: DROP TABLE public.test1;
WARNING: errors ignored on restore: 2

这是带有表添加/删除步骤的转储/恢复功能的预期行为吗?

如果目标数据库的表只与转储中的表部分重叠,那么使用pg_restore可能会让人感到痛苦.

使用–clean标志只能部分解决问题,但您可能仍会遇到不存在的表的错误.

在我看来,最好的方法是删除目标数据库(或删除级联目标模式)并继续执行还原.

您可能想要查看类似的问题:will pg_restore overwrite the existing tables?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读