I'm trying to read unmounted EDB files via esent.dll . Everything works with 4k paged databases, but when I try to read 8k paged one, it returns error-1414 -> The secondary index is corrupt and the database must be defragmented. But defragmenting with eseutil won't solve the issue. (the eseutil is from the bin folder of the same exchange server created the .edb)
JET_ERR err;
JET_INSTANCE instance;
JET_SESID sesid;
JET_DBID dbid;
JET_TABLEID tableid;
JET_COLUMNDEF columndef = { 0 };
JET_COLUMNID columnid;
Call(JetSetSystemParameter(&instance, JET_sesidNil, 64, 8192, NULL)); //JET_paramDatabasePageSize - 64
Call(JetSetSystemParameter(&instance, JET_sesidNil, 34, 0, NULL)); //JET_paramRecovery - 34
//Call(JetSetSystemParameter(&instance, JET_sesidNil, JET_paramCircularLog, 1, NULL));
Call(JetCreateInstance(&instance, "instance"));
Call(JetInit(&instance));
Call(JetBeginSession(instance, &sesid, 0, 0));
JET_PCSTR FileName = "C:\\Users\\user\\Desktop\\EDB\\First Storage Group\\Mailbox Database.edb";
Call(JetAttachDatabase(sesid, FileName, 0));`
And it won't attach the database.. What seems to be the problem, in your opinion?
First of all, it isn't recommended that you use databases created with ese.dll with esent.dll, and vice versa. Although the APIs are very similar, there are internal differences. Also, esent.dll is published on MSDN, and ese.dll is not published.
Is there a reason you're using esent.dll to read an ese.dll-created database?
A secondary index corruption is usually due to an OS sort order change. Defragmenting the database will read all of the data from the original database, and create an all-new database. The secondary indices are completely recreated.
Since you said an offline defrag (eseutil.exe -d, right?) doesn't help the issue, then it's probably not due to the OS sort order change. It's likely due to another of the internal differences between ese.dll and esent.dll.
Which versions of ese.dll and esent.dll are you talking about anyway? Exchange hasn't used 4k pages for many releases.