1

I had a problem opening an esent database (Windows.edb) due to some problem with the page size. The pagesize of the Windows.edb on my system is 32K. When I set this via JET_paramDatabasePageSize JetInit would return the error -1213 (The database page size does not match the engine). Laurion Burchall suggested to turn off JET_paramRecovery once I need only a ReadOnly access to the database. That solved my problem.

Until now. I have a not perfectly shutdown database. I assume that, with JET_paramRecovery=On, JetInit would automagically do the recovery and let me read the database. But if I try that I get that old -1213 error.

Now I can fix my file with ESENTUTL but the dummy user of my app won't be able to. Is there some way to have recovery on and still be able to define ANY DatabasePageSize? There are no log files present at the location of the database (and I set the Logpath to the same directory to make sure they aren't written anywhere else).

Does this mean that the engine on my machine does not support the page size or the database? Or could I solve the problem with setting another magic switch?

4

2 回答 2

1

在另一个应用程序的数据库上运行恢复是很棘手的。ESENT 是一个嵌入式引擎,每个应用程序都可以有自己的设置。在运行恢复之前,您需要了解:

  1. 日志文件所在的位置 (JET_paramLogFilePath)
  2. 日志文件大小 (JET_paramLogFileSize)
  3. 数据库页面大小 (JET_paramDatabasePageSize)
  4. 日志文件基本名称 (JET_paramBaseName)

如果您正确设置了所有这些参数,那么恢复将正常工作。如果您没有正确执行此操作,则其他应用程序可能无法恢复其数据库!

于 2011-02-18T07:07:58.000 回答
0

有一种简单(但很棘手)的方法可以“修复”未正常关闭的 EDB 数据库。在偏移量 52 处的标头中有状态标志。它是一个 4Byte 整数,应该设置为 3(如果没有正常关闭,您会发现值可能是 2)。

您可能需要在包含数据库标题副本的第二个数据库页面上重复此条目。您可以发现该页面只是数据库的页面大小(通常为 4096、8192 等)。

由于这确实是一个 hack,您应该自担风险使用它!

于 2011-09-13T08:25:45.137 回答