[英]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_attribute
中relnatts
等于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.