mirror of
https://github.com/berkeleydb/je.git
synced 2024-11-15 01:46:24 +00:00
171 lines
7.8 KiB
HTML
171 lines
7.8 KiB
HTML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||
<title>Chapter 5. Backing up and Restoring Berkeley DB, Java Edition Applications</title>
|
||
<link rel="stylesheet" href="gettingStarted.css" type="text/css" />
|
||
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
|
||
<link rel="start" href="index.html" title="Getting Started with Berkeley DB, Java Edition Transaction Processing" />
|
||
<link rel="up" href="index.html" title="Getting Started with Berkeley DB, Java Edition Transaction Processing" />
|
||
<link rel="prev" href="readmodifywrite.html" title="Read/Modify/Write" />
|
||
<link rel="next" href="chkpoint.html" title="Checkpoints" />
|
||
</head>
|
||
<body>
|
||
<div xmlns="" class="navheader">
|
||
<div class="libver">
|
||
<p>Library Version 12.2.7.5</p>
|
||
</div>
|
||
<table width="100%" summary="Navigation header">
|
||
<tr>
|
||
<th colspan="3" align="center">Chapter 5. Backing up and Restoring Berkeley DB, Java Edition Applications</th>
|
||
</tr>
|
||
<tr>
|
||
<td width="20%" align="left"><a accesskey="p" href="readmodifywrite.html">Prev</a> </td>
|
||
<th width="60%" align="center"> </th>
|
||
<td width="20%" align="right"> <a accesskey="n" href="chkpoint.html">Next</a></td>
|
||
</tr>
|
||
</table>
|
||
<hr />
|
||
</div>
|
||
<div class="chapter" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h2 class="title"><a id="jebackuprestore"></a>Chapter 5. Backing up and Restoring Berkeley DB, Java Edition Applications</h2>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="toc">
|
||
<p>
|
||
<b>Table of Contents</b>
|
||
</p>
|
||
<dl>
|
||
<dt>
|
||
<span class="sect1">
|
||
<a href="jebackuprestore.html#datamod">Normal Recovery</a>
|
||
</span>
|
||
</dt>
|
||
<dt>
|
||
<span class="sect1">
|
||
<a href="chkpoint.html">Checkpoints</a>
|
||
</span>
|
||
</dt>
|
||
<dt>
|
||
<span class="sect1">
|
||
<a href="backup.html">Performing Backups</a>
|
||
</span>
|
||
</dt>
|
||
<dd>
|
||
<dl>
|
||
<dt>
|
||
<span class="sect2">
|
||
<a href="backup.html#partialBackup">Performing a Hot Backup</a>
|
||
</span>
|
||
</dt>
|
||
<dt>
|
||
<span class="sect2">
|
||
<a href="backup.html#completeBackup">Performing an Offline Backup</a>
|
||
</span>
|
||
</dt>
|
||
<dt>
|
||
<span class="sect2">
|
||
<a href="backup.html#dbbackuphelper">Using the DbBackup Helper Class</a>
|
||
</span>
|
||
</dt>
|
||
</dl>
|
||
</dd>
|
||
<dt>
|
||
<span class="sect1">
|
||
<a href="jecatastrophicrecovery.html">Performing Catastrophic Recovery</a>
|
||
</span>
|
||
</dt>
|
||
<dt>
|
||
<span class="sect1">
|
||
<a href="jehotfailover.html">Hot Failover</a>
|
||
</span>
|
||
</dt>
|
||
</dl>
|
||
</div>
|
||
<p>
|
||
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.
|
||
</p>
|
||
<p>
|
||
Note that if you are using subdirectories to store your JE log
|
||
files, then your backup and restore process must maintain the
|
||
relationship between each log file and the subdirectory in which
|
||
JE intially placed it. That is, if JE placed log file
|
||
number 17 in the subdirectory named <code class="literal">data003</code>,
|
||
then when you perform a recovery log file number 17 must be placed
|
||
inside subdirectory <code class="literal">data003</code>.
|
||
</p>
|
||
<p>
|
||
Beyond these simple activities, there are some differing backup strategies that you may want to consider. These
|
||
topics are described in this chapter.
|
||
</p>
|
||
<p>
|
||
Before continuing, before you review the information on log files and background threads in the
|
||
<em class="citetitle">Getting Started with Berkeley DB, Java Edition</em> guide. Those topics contain important
|
||
information that is basic to the following discussion on backups and restores.
|
||
</p>
|
||
<div class="sect1" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h2 class="title" style="clear: both"><a id="datamod"></a>Normal Recovery</h2>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
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.
|
||
</p>
|
||
<p>
|
||
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.
|
||
</p>
|
||
<p>
|
||
Now, if your writes are transaction-protected, then every time a transaction is committed the leaf nodes
|
||
(and <span class="emphasis"><em>only</em></span> 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 <a class="xref" href="nodurabletxn.html" title="Non-Durable Transactions">Non-Durable Transactions</a> for more information.
|
||
</p>
|
||
<p>
|
||
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.
|
||
</p>
|
||
<p>
|
||
You can know if normal recovery must be run by catching <a class="ulink" href="../java/com/sleepycat/je/EnvironmentFailureException.html" target="_top">EnvironmentFailureException</a>.
|
||
This exception indicates that a failure has occurred that impacts the
|
||
Environment as a whole. Upon seeing this exception, you should run
|
||
<a class="ulink" href="../java/com/sleepycat/je/Environment.html#isValid--" target="_top">Environment.isValid()</a>. If it returns <code class="literal">true</code>,
|
||
then you can continue operating without any further action. However, if it
|
||
returns <code class="literal">false</code>, then you must close and reopen all
|
||
<a class="ulink" href="../java/com/sleepycat/je/Environment.html" target="_top">Environment</a> handles so that normal recovery can be run.
|
||
</p>
|
||
</div>
|
||
</div>
|
||
<div class="navfooter">
|
||
<hr />
|
||
<table width="100%" summary="Navigation footer">
|
||
<tr>
|
||
<td width="40%" align="left"><a accesskey="p" href="readmodifywrite.html">Prev</a> </td>
|
||
<td width="20%" align="center"> </td>
|
||
<td width="40%" align="right"> <a accesskey="n" href="chkpoint.html">Next</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td width="40%" align="left" valign="top">Read/Modify/Write </td>
|
||
<td width="20%" align="center">
|
||
<a accesskey="h" href="index.html">Home</a>
|
||
</td>
|
||
<td width="40%" align="right" valign="top"> Checkpoints</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</body>
|
||
</html>
|