objectbox-java icon indicating copy to clipboard operation
objectbox-java copied to clipboard

Back up the local data.mdb file

Open cxincx opened this issue 1 year ago • 1 comments

We need to back up the /objectbox/objectbox/data.mdb file, and we need to ensure that the database is complete and that the current data is not being written. We don't currently find an API that can be used.

Our current solution is to start a transaction and copy the database file in the transaction to avoid other writes during the copying process. Will it cause other problems?

sBoxStore.runInTx(new Runnable() {
        @Override
        public void run() {                
               use FileUtils copy data.mdb to backup_data.mdb
        }
    });

cxincx avatar Oct 06 '24 11:10 cxincx

Might work, but no guarantees. The safe way is to entirely close the DB and do the backup then.

Our server versions have a "hot" backup ("enterprise") feature, which has several advantages.

greenrobot avatar Oct 06 '24 19:10 greenrobot