0

我在用损坏的文档恢复我们的数据库时遇到问题。mongorestore当损坏的文档出来时停止恢复。这是错误。

INVALID OBJECT - going to try and print out
size: 2760
error: bson length doesn't match what we found in object with _id: 2
2014-11-21T12:29:48.717+0900 Assertion: 10330:Element extends past end of object
2014-11-21T12:29:48.740+0900 mongorestore.exe    mongo::parseNumberFromStringWithBase<unsigned char>+0x730af3
2014-11-21T12:29:48.741+0900 mongorestore.exe    mongo::parseNumberFromStringWithBase<unsigned char>+0x6db6bc
2014-11-21T12:29:48.741+0900 mongorestore.exe    mongo::parseNumberFromStringWithBase<unsigned char>+0x6c86db
2014-11-21T12:29:48.745+0900 mongorestore.exe    mongo::parseNumberFromStringWithBase<unsigned char>+0x4280
2014-11-21T12:29:48.749+0900 mongorestore.exe    mongo::parseNumberFromStringWithBase<unsigned char>+0x6c1382
2014-11-21T12:29:48.755+0900 mongorestore.exe    mongo::parseNumberFromStringWithBase<unsigned char>+0xafd52b
2014-11-21T12:29:48.758+0900 mongorestore.exe    mongo::parseNumberFromStringWithBase<unsigned char>+0xaff663
2014-11-21T12:29:48.762+0900 mongorestore.exe    mongo::parseNumberFromStringWithBase<unsigned char>+0xafe97b
2014-11-21T12:29:48.765+0900 mongorestore.exe    mongo::parseNumberFromStringWithBase<unsigned char>+0xafe97b
2014-11-21T12:29:48.772+0900 mongorestore.exe    mongo::parseNumberFromStringWithBase<unsigned char>+0xb01584
2014-11-21T12:29:48.777+0900 mongorestore.exe    mongo::parseNumberFromStringWithBase<unsigned char>+0x6c1b03
2014-11-21T12:29:48.780+0900 mongorestore.exe    mongo::parseNumberFromStringWithBase<unsigned char>+0x6c1beb
2014-11-21T12:29:48.784+0900 mongorestore.exe    mongo::parseNumberFromStringWithBase<unsigned char>+0xb364e3
2014-11-21T12:29:48.792+0900 kernel32.dll        BaseThreadInitThunk+0xd
2014-11-21T12:29:48.795+0900
object up to error: { HERE IS BROKEN DOCUMENT 
assertion: 10330 Element extends past end of object

实际上在备份之前发生了同样的错误。文档被破坏的原因仍然未知(只是猜测可能是意外关闭)。该服务器未使用副本集,并且启用了日志记录。检索损坏文档的.find()命令总是失败。损坏的文档也由.valid()命令识别。但是 mongodb 无法使用db.repairDatabase()and恢复它mongod --repair。我的临时措施是使用 备份数据,然后使用命令mongodump删除损坏的文档。.remove()

现在的问题是如何从备份中恢复完整的数据库以及如何正确修复它。有没有办法在有(或没有)损坏的文档的情况下恢复数据库?

MongoDB版本:2.6.1

4

1 回答 1

1

听起来您备份了一个一开始就损坏的数据库。尝试使用 --noobjcheck 选项运行 mongorestore。
希望这可以帮助。

于 2014-11-22T19:15:28.063 回答