Not Working: Restoring RavenDB from backup

1.1k views Asked by At

I am using the latest ver of RavenDB 2.750.

I have turned off the server before initiating the operation using the following cmd:

.\Raven.Server.exe -src "C:\From" -dest "C:\Target" -restore

However I do not see any new database added to the list of databases in the dashboard. I have scaled down the backup/restore operation to only the simplest database, the only way I could then get it to work is if I were to create a new db, edit the settings to repoint that db to the restored database directory.

While that might work for the test db, that's not gonna work with production data that has multiple bundles including encryption - short of copy and pasting that settings from production to the lower environment which would be a terrible hack.

==================================================

When working with a fresh copy of raven 2750, there was actually a Restore Database menu from the Tasks tab, but upon error that item is gone. The item is gone for good even after the offending database is removed and errors are cleared!!!

Missing Restore Database Item

The error in Raven Studio

Server Error:

----------------------------------------- Could not open database named: ProductionServiceBus

at Raven.Studio.Infrastructure.InvocationExtensions.Catch(Task parent, Func2 func) at Raven.Studio.Infrastructure.InvocationExtensions.Catch(Task parent, Action1 action) at Raven.Studio.Infrastructure.InvocationExtensions.Catch(Task parent)
at Raven.Studio.Infrastructure.Model.TimerTicked() at Raven.Studio.Infrastructure.PageView.b__7(Model model) at Raven.Studio.Infrastructure.PageView.InvokeOnModel(Object ctx, Action`1 action) at Raven.Studio.Infrastructure.PageView.InvokeTimerTicked(Object ctx)
at Raven.Studio.Infrastructure.PageView.DispatcherTimerOnTick(Object sender, EventArgs eventArgs) at MS.Internal.CoreInvokeHandler.InvokeEventHandler(UInt32 typeIndex, Delegate handlerDelegate, Object sender, Object args) at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)

Client side exception: System.Net.WebException: The remote server returned an error: NotFound. at System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.Func2.Invoke(T arg) at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task`1 promise)

 "restoreStatus": [
    "Copying D:\\RavenBackup\\ProductionPVServiceBus2\\IndexDefinitions\\Raven%2fDocumentsByEntityName.index",
    "Copying D:\\RavenBackup\\ProductionPVServiceBus2\\IndexDefinitions\\RavenTimeoutPersistence%2fTimeoutData%2fBySagaId.index",
    "Copying D:\\RavenBackup\\ProductionPVServiceBus2\\IndexDefinitions\\RavenTimeoutPersistence%2fTimeoutDataSortedByTime.index",
    "Copying Index: Raven%2fDocumentsByEntityName",
    "Error: File \"_51_1.del\" is missing from index Raven%2fDocumentsByEntityName",
    "Error: File \"_51.cfs\" is missing from index Raven%2fDocumentsByEntityName",
    "Error: File \"_50_c.del\" is missing from index Raven%2fDocumentsByEntityName",
    "Error: File \"_50.fdt\" is missing from index Raven%2fDocumentsByEntityName",
    "Error: File \"_50.fdx\" is missing from index Raven%2fDocumentsByEntityName",
    "Error: File \"_50.tii\" is missing from index Raven%2fDocumentsByEntityName",
    "Error: File \"_50.tis\" is missing from index Raven%2fDocumentsByEntityName",
    "Error: File \"_50.prx\" is missing from index Raven%2fDocumentsByEntityName",
    "Error: File \"_50.frq\" is missing from index Raven%2fDocumentsByEntityName",
    "Error: File \"_50.fnm\" is missing from index Raven%2fDocumentsByEntityName",
    "Error: File \"segments_7q\" is missing from index Raven%2fDocumentsByEntityName",
    "Copying Index: RavenTimeoutPersistence%2fTimeoutData%2fBySagaId",
    "Error: File \"_2n_1.del\" is missing from index RavenTimeoutPersistence%2fTimeoutData%2fBySagaId",
    "Error: File \"_2n.cfs\" is missing from index RavenTimeoutPersistence%2fTimeoutData%2fBySagaId",
    "Error: File \"_2m_1.del\" is missing from index RavenTimeoutPersistence%2fTimeoutData%2fBySagaId",
    "Error: File \"_2m.cfs\" is missing from index RavenTimeoutPersistence%2fTimeoutData%2fBySagaId",
    "Error: File \"_2l_1.del\" is missing from index RavenTimeoutPersistence%2fTimeoutData%2fBySagaId",
    "Error: File \"_2l.cfs\" is missing from index RavenTimeoutPersistence%2fTimeoutData%2fBySagaId",
    "Error: File \"_2k_1.del\" is missing from index RavenTimeoutPersistence%2fTimeoutData%2fBySagaId",
    "Error: File \"_2k.cfs\" is missing from index RavenTimeoutPersistence%2fTimeoutData%2fBySagaId",
    "Error: File \"_2j_1.del\" is missing from index RavenTimeoutPersistence%2fTimeoutData%2fBySagaId",
    "Error: File \"_2j.cfs\" is missing from index RavenTimeoutPersistence%2fTimeoutData%2fBySagaId",
    "Error: File \"_2i_3.del\" is missing from index RavenTimeoutPersistence%2fTimeoutData%2fBySagaId",
    "Error: File \"_2i.fdt\" is missing from index RavenTimeoutPersistence%2fTimeoutData%2fBySagaId",
    "Error: File \"_2i.fdx\" is missing from index RavenTimeoutPersistence%2fTimeoutData%2fBySagaId",
    "Error: File \"_2i.tii\" is missing from index RavenTimeoutPersistence%2fTimeoutData%2fBySagaId",
    "Error: File \"_2i.tis\" is missing from index RavenTimeoutPersistence%2fTimeoutData%2fBySagaId",
    "Error: File \"_2i.prx\" is missing from index RavenTimeoutPersistence%2fTimeoutData%2fBySagaId",
    "Error: File \"_2i.frq\" is missing from index RavenTimeoutPersistence%2fTimeoutData%2fBySagaId",
    "Error: File \"_2i.fnm\" is missing from index RavenTimeoutPersistence%2fTimeoutData%2fBySagaId",
    "Error: File \"segments_54\" is missing from index RavenTimeoutPersistence%2fTimeoutData%2fBySagaId",
    "Copying Index: RavenTimeoutPersistence%2fTimeoutDataSortedByTime",
    "Error: File \"_2n_1.del\" is missing from index RavenTimeoutPersistence%2fTimeoutDataSortedByTime",
    "Error: File \"_2n.cfs\" is missing from index RavenTimeoutPersistence%2fTimeoutDataSortedByTime",
    "Error: File \"_2m_1.del\" is missing from index RavenTimeoutPersistence%2fTimeoutDataSortedByTime",
    "Error: File \"_2m.cfs\" is missing from index RavenTimeoutPersistence%2fTimeoutDataSortedByTime",
    "Error: File \"_2l_1.del\" is missing from index RavenTimeoutPersistence%2fTimeoutDataSortedByTime",
    "Error: File \"_2l.cfs\" is missing from index RavenTimeoutPersistence%2fTimeoutDataSortedByTime",
    "Error: File \"_2k_1.del\" is missing from index RavenTimeoutPersistence%2fTimeoutDataSortedByTime",
    "Error: File \"_2k.cfs\" is missing from index RavenTimeoutPersistence%2fTimeoutDataSortedByTime",
    "Error: File \"_2j_1.del\" is missing from index RavenTimeoutPersistence%2fTimeoutDataSortedByTime",
    "Error: File \"_2j.cfs\" is missing from index RavenTimeoutPersistence%2fTimeoutDataSortedByTime",
    "Error: File \"_2i_3.del\" is missing from index RavenTimeoutPersistence%2fTimeoutDataSortedByTime",
    "Error: File \"_2i.fdt\" is missing from index RavenTimeoutPersistence%2fTimeoutDataSortedByTime",
    "Error: File \"_2i.fdx\" is missing from index RavenTimeoutPersistence%2fTimeoutDataSortedByTime",
    "Error: File \"_2i.tii\" is missing from index RavenTimeoutPersistence%2fTimeoutDataSortedByTime",
    "Error: File \"_2i.tis\" is missing from index RavenTimeoutPersistence%2fTimeoutDataSortedByTime",
    "Error: File \"_2i.prx\" is missing from index RavenTimeoutPersistence%2fTimeoutDataSortedByTime",
    "Error: File \"_2i.frq\" is missing from index RavenTimeoutPersistence%2fTimeoutDataSortedByTime",
    "Error: File \"_2i.fnm\" is missing from index RavenTimeoutPersistence%2fTimeoutDataSortedByTime",
    "Error: File \"segments_54\" is missing from index RavenTimeoutPersistence%2fTimeoutDataSortedByTime",
    "Esent Restore: Restore Begin ",
    "Esent Restore: Restore RecoveryStep ",
    "Esent Restore: Restore RecoveryStep ",
    "Esent Restore: Restore Progress JET_SNPROG(25/100)",
    "Esent Restore: Restore Progress JET_SNPROG(26/100)",
    "Esent Restore: Restore RecoveryStep ",
    "Esent Restore: Restore Progress JET_SNPROG(50/100)",
    "Esent Restore: Restore RecoveryStep ",
    "Esent Restore: Restore Progress JET_SNPROG(75/100)",
    "Esent Restore: Restore RecoveryStep ",
    "Esent Restore: Restore RecoveryStep ",
    "Esent Restore: Restore RecoveryStep ",
    "Esent Restore: Restore Complete ",
    "The new database was created"
  ]

================================================

We might have narrowed it down to a problem with the encryption key

2

There are 2 answers

0
Alwyn On BEST ANSWER

There were multiple problems

1) In order to restore database from the studio, you must first be at "system" db. Then the option to restore will appear.

2) RavenDB prior to 2.5.2750 had an issue with the way it stores the encryption keys. ie. they remain encrypted. And since the keys are tied to the account of the online db and may be even machine - who knows, these backup can NOT be restored to any other machine except the one that generated the backup files! Which totally defeats the purpose of having a backup in the first place.

1
Ayende Rahien On

What you have done is an offline restore, if you want to do an online restore (which add it to the active databases), you can do that from the studio.