5

我有一个 Postgres 数据库“rafiu”,其中包含许多模式,即 test1、test2、test3。在此我想转储 test2 模式及其数据。我尝试了以下查询

pg_dump -U postgres -n test2 -t t1 -t t2 rafiu > test_schema.sql

但它在结果转储文件中转储了 public.t1、public.t2 表而不是 test2 模式表。

请建议我如何在数据库中创建转储特定的特定模式。

提前致谢。

4

1 回答 1

12

-n test2意味着转储模式test2

如果要转储 tabletest2.t1test2.t2,您可能需要尝试以下语句:

pg_dump -U postgres -t test2.t1 -t test2.t2 rafiu > test_schema.sql
于 2013-11-22T07:18:13.287 回答