postgresql - 在 PostgreSQL 中不使用 pg_restore 恢复分区表数据
问题描述
需要帮忙 !!
虽然我要使用以下方法恢复分区表:
pg_restore -U (username) -d (Database) -p (port_number) -t (partition_table) -f (filename)
结果是成功,但该分区表中的数据没有恢复,有人可以帮我吗?
解决方案
当指定 -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
推荐阅读
- python - 使用 Selenium 和 Xpath 进行网页抓取
- php - 在 Yii2 中为 url 添加语言
- python - 通过python保存文件后现有条件格式被破坏
- angularjs - 如何在 Angular 中为 Azure blob 容器生成 SAS 令牌?
- c++ - C++ CSV 获取线
- mysql - 外键可以是sql中的主键
- java - 我收到 com.ibm.wsspi.injectionengine.InjectionException: CWNEN0030E
- reactjs - Axios 出现错误 404 未找到(Laravel 和 React)
- sorting - 排序列表