简体   繁体   English

Postgres pg_dump 目录属性丢失错误

[英]Postgres pg_dump catalog attribute missing error

I've been attempting to backup my remote database to my local system, with the following command I found in some other resources:我一直在尝试使用在其他一些资源中找到的以下命令将远程数据库备份到本地系统:

ssh user@host “pg_dump -U username -h localhost -d dbname -C —-column-inserts” \ mybackup.sql

The result was:结果是:

pg_dump: error: query failed: ERROR: catalog is missing 2 attribute(s) for relid 18141 pg_dump:错误:查询失败:错误:目录缺少 2 个用于 relid 18141 的属性

I'm actually not so much experienced with databases, I searched for the error but none of them made much sense for me to be honest.我实际上对数据库没有太多经验,我搜索了错误,但老实说,它们对我来说都没有多大意义。 Anyone can help me with the issue?任何人都可以帮助我解决这个问题吗?

You have catalog corruption: the pg_class entry for relation 18141 has a value of relnatts that is two more than the number of rows in pg_attribute that have attrelid equal to 18141. Just as the error message says: two attributes (= columns) are missing.您有目录损坏:关系 18141 的pg_class条目的 relnatts 值比pg_attributerelnatts等于attrelid的行数多两个。正如错误消息所说:缺少两个属性(= 列)。

Research your conscience what you did to corrupt the catalog.调查你的良心,你做了什么来破坏目录。 Did you use bad hardware and had crashes?您是否使用了不良硬件并发生了崩溃? Did you manually manipulate the catalog tables?您是否手动操作目录表?

You should restore your last good backup.您应该恢复上次的良好备份。

However, if you want to try to salvage data from that database: If you are extremely lucky, you are dealing with a corrupted index.但是,如果您想尝试从该数据库中挽救数据:如果您非常幸运,您正在处理一个损坏的索引。 That could be rebuilt with那可以重建

REINDEX INDEX pg_catalog.pg_attribute_relid_attnum_index;

If that works, dump the whole table and restore it to a freshly created PostgreSQL cluster to leave all corruption behind.如果可行,转储整个表并将其还原到新创建的 PostgreSQL 集群,以消除所有损坏。 If that is not enough, hire an expert who can try to salvage some data from the wreck.如果这还不够,请聘请可以尝试从沉船中抢救一些数据的专家。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 pg_dump错误:不支持“唯一关系” - pg_dump error: 'ONLY relation' not supported 在postgres的pg_dump中限制i / o? - Throttling i/o in postgres's pg_dump? 调用postgres命令,例如pg_restore或pg_dump形式的sql文件 - Calling postgres command like pg_restore or pg_dump form sql file 在Postgres中,在截断或删除行之后,在pg_dump之前执行reindex是否可以优化pg_restore? - In Postgres, after truncating or deleting rows, does executing reindex before pg_dump optimize pg_restore? 使用 pg_dump 的选择性模式转储 - Selective Schema dump using pg_dump 在 Postgres 上仅使用 CTE 生成创建表 DDL(无 pg_dump,无函数) - generation create-table DDL with CTE only ( no pg_dump, no functions) on Postgres 从 pg_dump 输出中删除注释 - Removing comments from pg_dump output 在OS终端中创建pg_dump文件 - Creating pg_dump file in OS terminal 使用pg_dump在PostgreSQL中导入数据库时​​出现错误:42601:“ psql”处或附近的语法错误 - Importing database in PostgreSQL using pg_dump having ERROR: 42601: syntax error at or near “psql” 无法摆脱Lion OSX上的以下错误“ pg_dump:由于服务器版本不匹配而中止” - Cannot get rid of following error “pg_dump: aborting because of server version mismatch” on Lion OSX
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM