【问题标题】:Partition table data are not restored using pg_restore in PostgreSQL在 PostgreSQL 中不使用 pg_restore 恢复分区表数据
【发布时间】:2021-06-02 09:19:36
【问题描述】:

需要帮助!!

虽然我将使用以下方法恢复分区表:

pg_restore -U (username) -d (Database) -p (port_number) -t (partition_table) -f (filename)

结果是成功了,但是那个分区表中的数据没有恢复,谁能帮帮我?

【问题讨论】:

  • 我猜你也必须恢复分区。
  • 但是当我在不提及表的情况下恢复完整数据库时,分区表数据被恢复。
  • 当然。但是如果你告诉它恢复分区表而不恢复任何分区,那么只有分区表被恢复。

标签: postgresql pg-dump pg-restore


【解决方案1】:

当指定 -t 时,pg_restore 不会尝试转储所选表可能依赖的任何其他数据库对象。因此,不能保证特定分区表转储的结果可以成功恢复

但是你可以使用转储

pg_dump --host=hostname --username=user -t "child_table_*" --data-only --file=dump_out.sql dbname

然后恢复它,这可能是设计决定将分区作为 SQL 级别上的单个表可见的结果。

请参考: https://www.postgresql.org/docs/13/app-pgrestore.html https://www.postgresql.org/docs/11/app-pgdump.html

【讨论】:

    猜你喜欢
    • 2016-12-07
    • 2013-10-15
    • 2018-12-21
    • 2020-12-04
    • 2021-07-10
    • 1970-01-01
    • 1970-01-01
    • 2018-07-29
    • 1970-01-01
    相关资源
    最近更新 更多