I read the Backup and Restore doc at RavenDB website and tried it in my code.

In the doc we have:

Initiating a backup

When running in embedded mode, all you need is to call the method DocumentDatabase.StartBackup().

The above line of code just won't compile with error:

An object reference is required for the non-static field, method, or property
'Raven.Database.DocumentDatabase.StartBackup(string, bool)'

So I tried this just to test:

new DocumentDatabase(_documentStore.Configuration).
                                               StartBackup(@"~\App_Data\Backup", true);

The code compiles but when the app starts I get this error:

Could not open transactional storage: C:\Project\trunk\MyApp\App_Data\Database\Data

Can someone please share some working code about how can one do a full backup of an online embedded document store? Is it even possible without using RavenDB server?

My only option is doing a manual backup of the database folder?

有帮助吗?

解决方案

Leniel, You need to use the StartBackup method on the actual instance that you are running. If you are using the EmbeddableDocumentStore, you need to do:

 embeddableDocumentStore.DocumentDatabase.StartBackup(...);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top