简体   繁体   English

在python中打开berkeley db的问题

[英]Problem opening berkeley db in python

I have problems opening a berkeley db in python using bdtables. 我在使用bdtables在python中打开一个berkeley数据库时遇到问题。 As bdtables is used by the library I am using to access the database, I need it to work. 由于我用来访问数据库的库使用了bdtables,我需要它才能工作。

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. 问题似乎是我试图打开的数据库环境(我打开了数据库的副本),版本为4.4,而libdb是版本4.6。 I get the following error using bsddb.dbtables.bsdTableDB([dbname],[folder]): 我使用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. 但是,bsddb.btopen([dbname])有效。

I have also tried installing db4.4-util, db4.5-util and db4.6-util. 我也尝试过安装db4.4-util,db4.5-util和db4.6-util。 Trying to use db4.6_verify results in: 尝试使用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 results in the computer just hanging, and nothing happening. db4.4_verify导致计算机挂起,没有任何事情发生。

Finally, if I run db4.4_recover on the database, that works. 最后,如果我在数据库上运行db4.4_recover,那就行了。 However, afterwards I get the following error 'No such file or directory' in python. 但是,之后我在python中收到以下错误'没有这样的文件或目录'。

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. “没有这样的文件或目录”是由一些__db.XXX文件丢失引起的。 Using 运用

bsddb.dbtables.bsdTableDB([dbname],[folder], create=1)

after db4.4_recover, these files got created and everything is now working. 在db4.4_recover之后,这些文件已经创建,现在一切正常。

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. 但是由于CLI中检查Berkeley DB文件的问题,我得到了我需要的工具。 I'll just post it here if someone ends up with the same problem in the future and end up at stackoverflow.com 如果有人在将来遇到同样的问题并最终到达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. “没有这样的文件或目录”是由一些__db.XXX文件丢失引起的。 Using bsddb.dbtables.bsdTableDB([dbname],[folder], create=1) after db4.4_recover, these files got created and everything is now working. 在db4.4_recover之后使用bsddb.dbtables.bsdTableDB([dbname],[folder],create = 1),这些文件已经创建,现在一切正常。

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. 但是由于CLI中检查Berkeley DB文件的问题,我得到了我需要的工具。 I'll just post it here if someone ends up with the same problem in the future and end up at stackoverflow.com 如果有人在将来遇到同样的问题并最终到达stackoverflow.com,我会在这里发布

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM