在 python 中打开 berkeley db 时出现问题
我在使用 bdtables 在 python 中打开 berkeley 数据库时遇到问题。 由于我用来访问数据库的库使用 bdtables,因此我需要它才能工作。
问题似乎是我尝试打开的数据库环境(我有要打开的数据库副本)是版本 4.4,而 libdb 是版本 4.6。 我使用 bsddb.dbtables.bsdTableDB([dbname],[folder]) 收到以下错误:
(-30972, "DB_VERSION_MISMATCH: Database environment version mismatch -- Program version 4.6 doesn't match environment version 4.4")
但是,bsddb.btopen([dbname]) 有效。
我还尝试安装 db4.4-util、db4.5-util 和 db4.6-util。 尝试使用 db4.6_verify 会导致:
db4.6_verify: Program version 4.6 doesn't match environment version 4.4
db4.6_verify: DB_ENV->open: DB_VERSION_MISMATCH: Database environment version mismatchs
db4.4_verify 导致计算机挂起,并且没有任何反应。
最后,如果我在数据库上运行 db4.4_recover,那就可以了。 但是,之后我在 python 中收到以下错误“没有这样的文件或目录”。
I have problems opening a berkeley db in python using bdtables. As bdtables is used by the library I am using to access the database, I need it to work.
The problem seems to be that the db environment I am trying to open (I got a copy of the database to open), is version 4.4 while libdb is version 4.6. I get the following error using bsddb.dbtables.bsdTableDB([dbname],[folder]):
(-30972, "DB_VERSION_MISMATCH: Database environment version mismatch -- Program version 4.6 doesn't match environment version 4.4")
However, bsddb.btopen([dbname]) works.
I have also tried installing db4.4-util, db4.5-util and db4.6-util. Trying to use db4.6_verify results in:
db4.6_verify: Program version 4.6 doesn't match environment version 4.4
db4.6_verify: DB_ENV->open: DB_VERSION_MISMATCH: Database environment version mismatchs
db4.4_verify results in the computer just hanging, and nothing happening.
Finally, if I run db4.4_recover on the database, that works. However, afterwards I get the following error 'No such file or directory' in python.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为答案应该放在“答案”部分,而不是作为问题的附录,因为这标志着问题在各个问题列表页面上都有答案。 我会为你做这件事,但是,如果你也抽出时间来做这件事,请在我的答案上发表评论,以便我可以删除它。
引用“有问题的答案”:
验证了这个问题中的所有内容,我最终解决了问题。 “没有这样的文件或目录”是由于某些 __db.XXX 文件丢失造成的。 在 db4.4_recover 之后使用
,这些文件已创建,现在一切正常。
尽管如此,这仍然是一个有点晦涩难懂的问题,最初很难弄清楚。 但是由于问题 Examing Berkeley DB files from the CLI,我得到了我需要的工具。 如果将来有人遇到同样的问题并最终访问 stackoverflow.com,我会将其发布在这里
I think answers should go in the "answer" section rather than as an addendum to the question since that marks the question as having an answer on the various question-list pages. I'll do that for you but, if you also get around to doing it, leave a comment on my answer so I can delete it.
Quoting "answer in question":
Verifying everything in this question, I eventually solved the problem. The 'No such file or directory' are caused by some __db.XXX files missing. Using
after db4.4_recover, these files got created and everything is now working.
Still, it was a bit of an obscure problem, and initially hard to figure out. But thanks to the question Examining Berkeley DB files from the CLI, I got the tools I needed. I'll just post it here if someone ends up with the same problem in the future and end up at stackoverflow.com
该死的,验证了这个问题中的所有内容我最终解决了问题。 “没有这样的文件或目录”是由于某些 __db.XXX 文件丢失造成的。 在 db4.4_recover 之后使用 bsddb.dbtables.bsdTableDB([dbname],[folder], create=1),创建了这些文件,现在一切正常。
尽管如此,这仍然是一个有点晦涩难懂的问题,最初很难弄清楚。 但由于问题 Examining Berkeley DB files from the CLI 我得到了我需要的工具。 如果将来有人遇到同样的问题并最终访问 stackoverflow.com,我会将其发布在这里
Damn, verifying everything in this question I eventually solved the problem. The 'No such file or directory' are caused by some __db.XXX files missing. Using bsddb.dbtables.bsdTableDB([dbname],[folder], create=1) after db4.4_recover, these files got created and everything is now working.
Still, it was a bit of an obscure problem, and initially hard to figure out. But thanks to the question Examining Berkeley DB files from the CLI I got the tools I needed. I'll just post it here if someone ends up with the same problem in the future and end up at stackoverflow.com