Search code examples
database-restoreextensible-storage-engine

Restore full external ESENT backup


I've wrote the code that creates full backups of my ESENT database, using JetBeginExternalBackup API.

Following the MSDN guidelines, I backed up every file returned by JetGetAttachInfo and JetGetLogInfo.

I've made the backup, erased old database, and copied the backup data to the database folder. The DB engine was unable to start, the JetInit error code is "JET_errMissingLogFile".

I've checked the backup, it only contains the database file, and "<inst>XXXXX.log" log files. It lacks the current log file (I'm using circular logging, BTW).

Is there any way to restore such backup?

I don't want to use JetExternalRestore API because it's too complex: I don't need to restore to another location, I don't understand why there're 3 input folders not 2, and I don't know the values to supply in genLow and genHigh arguments.

I do need external backups: the ESENT database is used by ASP.NET on a remote server, and I'm backing it up over the Internet.

Or, maybe there's a way to retrieve the name of the current log file, and I should just add it to the backup?

Thanks in advance!

P.S. I've got no permissions to span processes on my web server, so using eseutil.exe is not an option.


Solution

  • Unpack all backed up files to a single folder.

    Take the name of your main database file. Replace extension to .pat. Create zero-length file with that name, e.g. database.pat.

    After this simple step, call JetRestoreInstance API, it will restore the backup from that folder.