Recovery API

Nov 27, 2010 at 2:16 AM

During my testing I occasionally crash badly and leave a database unopenable due to a DirtyShutdownException. I then run esentutl /r edb to recover and continue.

Is any of the esentutl functionality (especially Recovery) exposed by the managed classes or the API? A quick look around the source code and API doc hints the answer is no.

Greg

Nov 27, 2010 at 6:05 PM

The recovery functionality is automatically invoked by JetInit -- all esentutl /r does is set some system parameters (basename, log path, system path) and call JetInit.

If you are calling JetInit and the database isn't being recovered then a few different things could be wrong:

  • You have turned recovery off (JET_param.Recovery).
  • The basename (JET_param.BaseName) isn't correct.
  • The system or log paths aren't correct.

 

Nov 27, 2010 at 11:22 PM

It was the first option. Until now I thought the JET_param.Recovery was an int value 0 or 1. After looking at the source I can see that it's the string "on" or "off". Now I get the correct behaviour.

If I open a badly shutdown database in readonly mode with Recovery "off" then I get the exception as expected. If I open for update with Recovery "on" then it silently recovers and opens.

Cheers, Greg