恢复部分转储
提取和恢复 PostgreSQL 数据库转储的特定部分(DDL、DML 或约束/索引)的技巧
- 从
pg_dump文件中恢复 DDL、DML 和/或约束/索引的任意部分 -
问题:您有一个数据库转储,但只想例如仅恢复 DDL,或者只恢复数据而不应用约束和生成索引。
解决方案:使用
pg_restore的--section选项,该选项将恢复过程分为三个独立的部分pg_restore --section=pre-data ... restores the database schema pg_restore --section=data ... restores data only pg_restore --section=post-data ... restore constraints and indexes
