How to use DocumentDatabase.StartBackup () in combination with RavenDB EmbeddableDocumentStore?

I read the Backup and Restore document on the RavenDB website and tried it in my code.

In the doc document we have:

Initiate backup

When working in native mode, all you need is a call to the DocumentDatabase.StartBackup () method.

The above line of code just does not compile with an 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 check:

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

The code compiles, but when the application 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 on how to make a full backup of the built-in document storage on the Internet? Is this even possible without using the RavenDB server?

Is my only option doing a manual backup of the database folder?

+4
source share
1 answer

Leniel, you need to use the StartBackup method for the actual instance that you are using. If you are using an EmbeddableDocumentStore, you need to do:

  embeddableDocumentStore.DocumentDatabase.StartBackup(...); 
+4
source

Source: https://habr.com/ru/post/1394960/


All Articles