Chapter 5. Backing up and Restoring Berkeley DB, Java Edition Applications
Prev |  | Next

## Chapter 5. Backing up and Restoring Berkeley DB, Java Edition Applications

Fundamentally, you backup your databases by copying JE log files off to a safe storage location. To restore your database from a backup, you copy those files to an appropriate directory on disk and restart your JE application.

Beyond these simple activities, there are some differing backup strategies that you may want to consider. These topics are described in this chapter.

Before continuing, before you review the information on log files and background threads in the Getting Started with Berkeley DB, Java Edition. Those topics contain important information that is basic to the following discussion on backups and restores.

## Normal Recovery

Remember that internally JE databases are organized in a BTree, and that in order to operate JE requires the complete BTree be available to it.

When database records are created, modified, or deleted, the modifications are represented in the BTree's leaf nodes. Beyond leaf node changes, database record modifications can also cause changes to other BTree nodes and structures.

Now, if your writes are transaction-protected, then every time a transaction is committed the leaf nodes (and only the leaf nodes) modified by that transaction are written to the JE log files on disk. Also, remember that the durability of the write (whether a flush or fsync is performed) depends on the type of commit that is requested. See Non-Durable Transactions for more information.

Normal recovery, then, is the process of recreating the entire BTree from the information available in the leaf nodes. You do not have to do anything special to cause normal recovery to be run; this occurs every time a JE environment is opened.

Prev | Up | Next
Read/Modify/Write | Home | Checkpoints