开发者社区> 问答> 正文

pg_dump备份失败,错误信息提示pg_dump: [archiver (db)] query failed: ERROR: schema "pgs_distribution_metadata" does not exist

用pg_dump备份失败,错误信息提示pg_dump: [archiver (db)] query failed: ERROR: schema "pgs_distribution_metadata" does not exist

[postgres@node1 backup]$ pg_dump -Fc shop > shop.dump
pg_dump: [archiver (db)] query failed: ERROR: schema "pgs_distribution_metadata" does not exist
pg_dump: [archiver (db)] query was: COPY public.chars (chr) TO stdout;

postgres=# dn

       List of schemas
       Name            |  Owner
pgs_distribution_metadata postgres
public postgres

(2 rows)

尝试删除 pgs_distribution_metadata,后再试

postgres=# drop schema pgs_distribution_metadata cascade;
ERROR: cannot drop schema pgs_distribution_metadata because extension pg_shard requires it
HINT: You can drop extension pg_shard instead.

postgres=# drop extension pg_shard cascade;
DROP EXTENSION

postgres=# dn
List of schemas

Name Owner
public postgres

(1 row)

同事注释掉postgresql.con里关于pg_shard的相关设定,

shared_preload_libraries = 'pg_shard' # (change requires restart)

restart后再试,用pg_dump备份依然失败

[postgres@node1 backup]$ pg_dump -Fc shop > shop.dump
pg_dump: [archiver (db)] query failed: ERROR: schema "pgs_distribution_metadata" does not exist
pg_dump: [archiver (db)] query was: COPY public.chars (chr) TO stdout;

寻求解决办法,谢谢!

展开
收起
simon007 2016-05-14 00:57:43 9579 0
2 条回答
写回答
取消 提交回答
  • 德哥,谢谢你的回复。
    我shop库的owner也是postgres。

    [postgres@node1 backup]$ psql
    psql (9.4.1)
    Type "help" for help.

    postgres=# set
    AUTOCOMMIT = 'on'
    PROMPT1 = '%/%R%# '
    PROMPT2 = '%/%R%# '
    PROMPT3 = '>> '
    VERBOSITY = 'default'
    VERSION = 'PostgreSQL 9.4.1 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4), 64-bit'
    DBNAME = 'postgres'
    USER = 'postgres'
    PORT = '5432'
    ENCODING = 'LATIN1'
    postgres=# l

                                 List of databases
        Name        |  Owner   | Encoding | Collate | Ctype |   Access privileges
    contrib_regression postgres UTF8 C C
    movies postgres UTF8 C C
    postgres postgres UTF8 C C
    re_bookstore postgres UTF8 C C
    shop postgres UTF8 C C
    supermarket postgres UTF8 C C
    template0 postgres UTF8 C C =c/postgres +
    postgres=CTc/postgres
    template1 postgres UTF8 C C postgres=CTc/postgres+

    我用pg_dump备份postrges库,依然出现同样的错误。

    [postgres@node1 backup]$ pg_dump -Fc postgres > postgres.dump
    pg_dump: [archiver (db)] query failed: ERROR: schema "pgs_distribution_metadata" does not exist
    pg_dump: [archiver (db)] query was: COPY public.customer_reviews (customer_id, review_date, review_rating, review_votes, review_helpful_votes, product_id, product_title, product_sales_rank, product_group, product_category, product_subcategory, similar_product_ids) TO stdout;

    麻烦你帮助详细解释一下该问题的发生原因及解决方案,谢谢!

    2019-07-17 19:03:05
    赞同 展开评论 打赏
  • 公益是一辈子的事, I am digoal, just do it. 阿里云数据库团队, 擅长PolarDB, PostgreSQL, DuckDB, ADB等, 长期致力于推动开源数据库技术、生态在中国的发展与开源产业人才培养. 曾荣获阿里巴巴麒麟布道师称号、2018届OSCAR开源尖峰人物.

    你备份的是shop库,所以在postgres库操作是没用的。

    2019-07-17 19:03:05
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Borgaonkar-New-Adventures-In-Spying-3G-And-4G-Users-Locate-Track-And-Monitor 立即下载
SPARK + FLASHBLADE DELIVERING INSIGHTS FROM 5PB OF PRODUCT LOGS AT PURE STORAGE 立即下载
Spark SQL:Past Present &Future 立即下载