postgresql 错误:无法读取关系 1663/16384/16564 的块 4707:成功
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6895736/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ERROR: could not read block 4707 of relation 1663/16384/16564: Success
提问by lamostreta
I am using psql 8.1.18 on Glassfishserver. I have a query like this:
我在 Glassfishserver 上使用 psql 8.1.18。我有一个这样的查询:
select ip,round((select sum(t1.size) from table t1))
from table
where date > '2011.07.29'
and date < '2011.07.30'
and ip = '255.255.255.255'
group by ip;
When I run this query I got this error:
当我运行此查询时,出现此错误:
ERROR: could not read block 4707 of relation 1663/16384/16564: Success
However this query works fine:
但是这个查询工作正常:
select ip,round(sum(size)/175)
from table
where date > '2011.07.29'
and l_date < '2011.07.30'
and ip = '255.255.255.255'
group by ip;
I think it might be a database error and I need to restore the table from the backup, maybe. But first I need to learn where this corrupted data exist. Does anyone know how to find 1663/16384/16564 relation? Or 4707 block?
我认为这可能是数据库错误,我可能需要从备份中恢复表。但首先我需要了解这些损坏的数据存在于何处。有谁知道如何找到 1663/16384/16564 的关系?还是4707块?
EDIT: I tried this code:
编辑:我试过这个代码:
select relname , relfilenode from pg_class where relname in ('1663','16384','16564');
but it returns:
但它返回:
relname | relfilenode
---------+-------------
(0 rows)
回答by francs
It looks like there are bad blocks in a table or an index.
看起来表或索引中有坏块。
To find the bad data, Maybe you can query pg_class views ;
要查找坏数据,也许您可以查询 pg_class 视图;
select oid,relname from pg_class where oid =1663 or oid=16564;
select oid,relname from pg_class where oid =1663 or oid=16564;
just see what's the result!
看看结果如何!
IF the result is an index, just recreate the corrupted index;
如果结果是索引,则重新创建损坏的索引;
IF the result is a table , than it means that there are some data of the table is damaged, you can set the parameter "zero_damaged_pages" to on to by pass those corrupted data or restore the table from your recently backup set !
如果结果是一张表,那么这意味着该表的某些数据已损坏,您可以将参数“zero_damaged_pages”设置为 on 以绕过那些损坏的数据或从您最近的备份集中恢复该表!
more information about the parameter "zero_damaged_pages" http://www.postgresql.org/docs/9.0/static/runtime-config-developer.html
有关参数“zero_damaged_pages”的更多信息 http://www.postgresql.org/docs/9.0/static/runtime-config-developer.html