【问题标题】:Dump structure and data of schema转储架构的结构和数据
【发布时间】:2017-03-01 12:57:58
【问题描述】:

我执行了以下命令:

pg_dump -h 10.100.1.2 -U user -n schema1 > backup.sql

此命令创建模式“schema1”的转储,但生成的转储只有模式的结构。

如何使用结构和数据 (INSERT) 生成架构转储?

【问题讨论】:

  • 该命令包含数据。您可能改用-s schema1 吗?如果您确定您使用了-n schema1,那么该架构中的表不包含任何数据。
  • 有关标志和用法的完整列表,请参阅文档:postgresql.org/docs/9.3/static/app-pgdump.html 上面的命令包含数据。如果您使用-s,则不会。如果您只想要数据,请使用 -a 标志。

标签: postgresql postgresql-9.3 pg-dump


【解决方案1】:

只需从命令中删除-n 并运行。 即

pg_dump -h 10.100.1.2 -U user schema1 > backup.sql

-n 标志告诉 PostgreSQL 只转储命名模式,而不转储数据。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-09
    • 2012-09-19
    • 1970-01-01
    • 1970-01-01
    • 2020-08-23
    • 2013-10-21
    相关资源
    最近更新 更多