0
我有問題可以用損壞的文檔恢復數據庫。 mongorestore
停止恢復破碎的文件出來時。這是錯誤。Mongodb:使用損壞的文檔恢復數據庫
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()
和mongod --repair
恢復它。我的臨時措施是使用mongodump
備份數據,然後使用.remove()
命令刪除損壞的文檔。
現在的問題是如何從備份中恢復完整的數據庫以及如何正確地修復它。有沒有辦法用(或不用)破損的文件恢復數據庫?
MongoDB的版本:2.6.1