Search code examples
esentedb

Esent database engine limited to specific page sizes?


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?


Solution

  • Running recovery on another application's database is tricky. ESENT is an embedded engine and each application can have its own settings. Before you run recovery you need to know:

    1. Where the logfiles are located (JET_paramLogFilePath)
    2. The logfile size (JET_paramLogFileSize)
    3. The database page size (JET_paramDatabasePageSize)
    4. The logfile basename (JET_paramBaseName)

    If you set all those parameters correctly then recovery will work properly. If you don't do that properly then the other application may have problems recovering its database!