【问题标题】:pg_restore toc errorpg_restore 目录错误
【发布时间】:2012-03-23 09:19:35
【问题描述】:

我对 pg_dump 和 restore 使用了以下语法

pg_dump eval --inserts -b -c --encoding UTF8 -Fc -f eval.sql.tar.gz -x -U postgres
createdb -T template0 test -U postgres
pg_restore -d test eval.sql.tar.gz -e -U postgres

转储成功,没有错误,但恢复时出现了一些错误,我正在使用相同的用户和权限在同一台机器上转储和恢复...

我也尝试过其他格式,plain、tar、compressed 都得到相同的错误..

我的pg版本是8.4.11,psql版本是8.4.11

我不确定是什么导致了这些错误.. 谁能帮助我

 pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 4965; 0 138871 TABLE DATA ir_act_report_xml insigni
pg_restore: [archiver (db)] could not execute query: ERROR:  invalid input syntax for integer: "purchase.order"
LINE 1: ...st for Quotation', 'ir.actions.report.xml', NULL, 'purchase....
                                                             ^
    Command was: INSERT INTO ir_act_report_xml VALUES (350, 'Request for Quotation', 'ir.actions.report.xml', NULL, 'purchase.order', 'purcha...

【问题讨论】:

  • 看来你转储的是一个需要使用psql运行的SQL脚本,而不是pg_restore

标签: postgresql pg-dump pg-restore


【解决方案1】:

成功了

pg_dump database_name -c -Ft -f file_name.tar 

pg_restore -d database_name -c file_name.tar

在此之前,我试图在不包含 -c(clean) 的情况下进行恢复

即使 -c 包含在 pg_dump 中,它也不会在 pg_restore 中使用,除非我们说要使用...

【讨论】:

  • 使用“clean”标志也会导致很多问题,因为它会在使用新数据库时抱怨缺少对象。
  • -c 标志不起作用。仍然收到相同的错误:
    $ pg_restore -d development -t integrations -c b7c5 pg_restore: [archiver (db)] Error while PROCESSING TOC: pg_restore: [archiver (db)] 来自 TOC 条目 210 的错误; 1259 16535 TABLE 集成 u5j7 pg_restore: [archiver (db)] 无法执行查询:错误:角色“u5j7”不存在命令是:ALTER TABLE public.integrations OWNER TO u5j7;警告:还原时忽略错误:1
【解决方案2】:

我的解决方案:

pg_restore --verbose --clean --no-acl --no-owner -h localhost -U username -d database_name dump_name.dump

【讨论】:

【解决方案3】:

This 为我工作:

postgresql.conf 中增加max_wal_size postgresql 设置(max_wal_size = 2GB)

【讨论】:

    猜你喜欢
    • 2019-12-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-28
    • 2012-04-27
    • 2016-09-13
    • 2021-01-04
    相关资源
    最近更新 更多