This project has moved and is read-only. For the latest updates, please go here.

EsentSoftRecoveryOnBackupDatabaseException

Nov 29, 2012 at 2:43 PM

One of my users is getting the following error:

 

Microsoft.Isam.Esent.Interop.EsentSoftRecoveryOnBackupDatabaseException: Soft recovery is intended on a backup database. Restore should be used instead

   at Microsoft.Isam.Esent.Interop.Api.Check(Int32 err)

   at Microsoft.Isam.Esent.Interop.Api.JetAttachDatabase(JET_SESID sesid, String database, AttachDatabaseGrbit grbit)

 

He backed up the db, then restored it, then got this error.

This only happens on Server 2003 machine. Server 2008 R2 works fine.

Nov 29, 2012 at 8:27 PM

How are the backup and restore being done?

Are the files simply getting copied out and copied in? Or are you using the APIs like JetBeginExternalBackupInstance()?

(History: The reason that Server 2003 doesn't work Win7 (2008r2) does is that initially backup/restore was more complicate. It was written in the days of tape backup when you couldn't rewind and write something at the beginning. First there was something called a 'patch file', which was removed ~2000. The updated database header was tacked on to the end of the database which contained information about which log files were generated during the backup, and therefore would be required.)

 

-martin

Nov 30, 2012 at 9:03 AM

We use the following API for that:

  • JetBackupInstance
  • JetRestoreInstance

Should we be using JetBeginExternalBackupInstance? What is the difference?

Dec 6, 2012 at 2:38 AM

Using those APIs should work just fine. JetBeginExternalBackupInstance() allows finer-grained abilities to do backups. In other words, you need to call more APIs and do more work. :)

That specific error implies that you're not actually calling JetRestoreInstance at the right time, but that you're trying to attach the database prior.

There is the test code (TestBackupRestore() in DatabaseFileTestHelper.cs) that shows one way to do it.

-martin