868 lines
42 KiB
HTML
868 lines
42 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<!-- NewPage -->
|
|
<html lang="en">
|
|
<head>
|
|
<!-- Generated by javadoc (1.8.0_151) on Tue Oct 31 17:36:46 EDT 2017 -->
|
|
<title>DbBackup (Oracle - Berkeley DB Java Edition API)</title>
|
|
<meta name="date" content="2017-10-31">
|
|
<link rel="stylesheet" type="text/css" href="../../../../style.css" title="Style">
|
|
<script type="text/javascript" src="../../../../script.js"></script>
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript"><!--
|
|
try {
|
|
if (location.href.indexOf('is-external=true') == -1) {
|
|
parent.document.title="DbBackup (Oracle - Berkeley DB Java Edition API)";
|
|
}
|
|
}
|
|
catch(err) {
|
|
}
|
|
//-->
|
|
var methods = {"i0":10,"i1":10,"i2":10,"i3":42,"i4":10,"i5":10,"i6":10};
|
|
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"],32:["t6","Deprecated Methods"]};
|
|
var altColor = "altColor";
|
|
var rowColor = "rowColor";
|
|
var tableTab = "tableTab";
|
|
var activeTableTab = "activeTableTab";
|
|
</script>
|
|
<noscript>
|
|
<div>JavaScript is disabled on your browser.</div>
|
|
</noscript>
|
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
|
<div class="topNav"><a name="navbar.top">
|
|
<!-- -->
|
|
</a>
|
|
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
|
|
<a name="navbar.top.firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../../../overview-summary.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="class-use/DbBackup.html">Use</a></li>
|
|
<li><a href="package-tree.html">Tree</a></li>
|
|
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
|
|
<li><a href="../../../../index-all.html">Index</a></li>
|
|
<li><a href="../../../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
<div class="aboutLanguage"><b>Berkeley DB Java Edition</b><br><font size=\"-1\"> version 7.5.11</font>
|
|
</div>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList">
|
|
<li><a href="../../../../com/sleepycat/je/util/ConsoleHandler.html" title="class in com.sleepycat.je.util"><span class="typeNameLink">Prev Class</span></a></li>
|
|
<li><a href="../../../../com/sleepycat/je/util/DbCacheSize.html" title="class in com.sleepycat.je.util"><span class="typeNameLink">Next Class</span></a></li>
|
|
</ul>
|
|
<ul class="navList">
|
|
<li><a href="../../../../index.html?com/sleepycat/je/util/DbBackup.html" target="_top">Frames</a></li>
|
|
<li><a href="DbBackup.html" target="_top">No Frames</a></li>
|
|
</ul>
|
|
<ul class="navList" id="allclasses_navbar_top">
|
|
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
|
|
</ul>
|
|
<div>
|
|
<script type="text/javascript"><!--
|
|
allClassesLink = document.getElementById("allclasses_navbar_top");
|
|
if(window==top) {
|
|
allClassesLink.style.display = "block";
|
|
}
|
|
else {
|
|
allClassesLink.style.display = "none";
|
|
}
|
|
//-->
|
|
</script>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li>Nested | </li>
|
|
<li>Field | </li>
|
|
<li><a href="#constructor.summary">Constr</a> | </li>
|
|
<li><a href="#method.summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li>Field | </li>
|
|
<li><a href="#constructor.detail">Constr</a> | </li>
|
|
<li><a href="#method.detail">Method</a></li>
|
|
</ul>
|
|
</div>
|
|
<a name="skip.navbar.top">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
|
<!-- ======== START OF CLASS DATA ======== -->
|
|
<div class="header">
|
|
<div class="subTitle">com.sleepycat.je.util</div>
|
|
<h2 title="Class DbBackup" class="title">Class DbBackup</h2>
|
|
</div>
|
|
<div class="contentContainer">
|
|
<ul class="inheritance">
|
|
<li>java.lang.Object</li>
|
|
<li>
|
|
<ul class="inheritance">
|
|
<li>com.sleepycat.je.util.DbBackup</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<div class="description">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<hr>
|
|
<br>
|
|
<pre>public class <span class="typeNameLabel">DbBackup</span>
|
|
extends java.lang.Object</pre>
|
|
<div class="block">DbBackup is a helper class for stopping and restarting JE background
|
|
activity in an open environment in order to simplify backup operations. It
|
|
also lets the application create a backup which can support restoring the
|
|
environment to a specific point in time.
|
|
<p>
|
|
<b>Backing up without DbBackup</b>
|
|
<p>
|
|
Because JE has an append only log file architecture, it is always possible
|
|
to do a hot backup without the use of DbBackup by copying all log files
|
|
(.jdb files) to your archival location. As long as the log files are copied
|
|
in alphabetical order, (numerical in effect) <i>and</i> all log files are
|
|
copied, the environment can be successfully backed up without any need to
|
|
stop database operations or background activity. This means that your
|
|
backup operation must do a loop to check for the creation of new log files
|
|
before deciding that the backup is finished. For example:
|
|
<pre>
|
|
time files in activity
|
|
environment
|
|
|
|
t0 000000001.jdb Backup starts copying file 1
|
|
000000003.jdb
|
|
000000004.jdb
|
|
|
|
t1 000000001.jdb JE log cleaner migrates portion of file 3 to newly
|
|
000000004.jdb created file 5 and deletes file 3. Backup finishes
|
|
000000005.jdb file 1, starts copying file 4. Backup MUST include
|
|
file 5 for a consistent backup!
|
|
|
|
t2 000000001.jdb Backup finishes copying file 4, starts and
|
|
000000004.jdb finishes file 5, has caught up. Backup ends.
|
|
000000005.jdb
|
|
</pre>
|
|
<p>
|
|
In the example above, the backup operation must be sure to copy file 5,
|
|
which came into existence after the backup had started. If the backup
|
|
stopped operations at file 4, the backup set would include only file 1 and
|
|
4, omitting file 3, which would be an inconsistent set.
|
|
<p>
|
|
Also note that log file 5 may not have filled up before it was copied to
|
|
archival storage. On the next backup, there might be a newer, larger version
|
|
of file 5, and that newer version should replace the older file 5 in archive
|
|
storage.
|
|
<p>
|
|
Using the approach above, as opposed to using DbBackup, will copy all files
|
|
including <a href="../../../../com/sleepycat/je/EnvironmentStats.html#getReservedLogSize--"><code>reserved files</code></a> as well
|
|
as <a href="../../../../com/sleepycat/je/EnvironmentStats.html#getActiveLogSize--"><code>active files</code></a>. A large number of
|
|
reserved files may be present in an HA Environment, and they are essentially
|
|
wasted space in a backup. Using DbBackup is strongly recommended for this
|
|
reason, as well as to reduce the complexity of file copying.
|
|
<p>
|
|
<b>Backing up with DbBackup</b>
|
|
<p>
|
|
DbBackup helps simplify application backup by defining the set of <a href="../../../../com/sleepycat/je/EnvironmentStats.html#getActiveLogSize--"><code>active files</code></a> that must be copied for each
|
|
backup operation. If the environment directory has read/write protection,
|
|
the application must pass DbBackup an open, read/write environment handle.
|
|
<p>
|
|
When entering backup mode, JE determines the set of active files needed for
|
|
a consistent backup, and freezes all changes to those files. The application
|
|
can copy that defined set of files and finish operation without checking for
|
|
the ongoing creation of new files. Also, there will be no need to check for
|
|
a newer version of the last file on the next backup.
|
|
<p>
|
|
In the example above, if DbBackup was used at t0, the application would only
|
|
have to copy files 1, 3 and 4 to back up. On a subsequent backup, the
|
|
application could start its copying at file 5. There would be no need to
|
|
check for a newer version of file 4.
|
|
<p>
|
|
When it is important to minimize the time that it takes to recover using a
|
|
backup, a checkpoint should be performed immediately before calling <a href="../../../../com/sleepycat/je/util/DbBackup.html#startBackup--"><code>startBackup()</code></a>. This will reduce recovery time when opening the environment
|
|
with the restored log files. A checkpoint is performed explicitly by
|
|
calling <a href="../../../../com/sleepycat/je/Environment.html#checkpoint-com.sleepycat.je.CheckpointConfig-"><code>Environment.checkpoint(com.sleepycat.je.CheckpointConfig)</code></a> using a config object for which
|
|
<a href="../../../../com/sleepycat/je/CheckpointConfig.html#setForce-boolean-"><code>setForce(true)</code></a> has been called.
|
|
<p>
|
|
<b>Performing simple/full backups</b>
|
|
<p>
|
|
The following examples shows how to perform a full backup. A checkpoint is
|
|
performed to minimize recovery time.
|
|
<pre class="code">
|
|
void myBackup(Environment env, File destDir) {
|
|
DbBackup backupHelper = new DbBackup(env);
|
|
|
|
// Optional: Do a checkpoint to reduce recovery time after a restore.
|
|
env.checkpoint(new CheckpointConfig().setForce(true));
|
|
|
|
// Start backup, find out what needs to be copied.
|
|
backupHelper.startBackup();
|
|
try {
|
|
// Copy the necessary files to archival storage.
|
|
String[] filesToCopy = backupHelper.getLogFilesInBackupSet();
|
|
myCopyFiles(env, backupHelper, filesToCopy, destDir);
|
|
} finally {
|
|
// Remember to exit backup mode, or the JE cleaner cannot delete
|
|
// log files and disk usage will grow without bounds.
|
|
backupHelper.endBackup();
|
|
}
|
|
}
|
|
|
|
void myCopyFiles(
|
|
Environment env,
|
|
DbBackup backupHelper,
|
|
String[] filesToCopy,
|
|
File destDir) {
|
|
|
|
for (String fileName : filesToCopy) {
|
|
// Copy fileName to destDir.
|
|
// See <a href="../../../../com/sleepycat/je/util/LogVerificationReadableByteChannel.html" title="class in com.sleepycat.je.util"><code>LogVerificationReadableByteChannel</code></a> and
|
|
// <a href="../../../../com/sleepycat/je/util/LogVerificationInputStream.html" title="class in com.sleepycat.je.util"><code>LogVerificationInputStream</code></a>.
|
|
....
|
|
|
|
// Remove protection to allow file to be deleted in order to reclaim
|
|
// disk space.
|
|
backupHelper.removeFileProtection(fileName);
|
|
}
|
|
}
|
|
</pre>
|
|
When copying files to the backup directory, it is critical that each file is
|
|
verified before or during the copy. If a file is copied that is corrupt
|
|
(due to an earlier disk failure that went unnoticed, for example), the
|
|
backup will be invalid and provide a false sense of security.
|
|
<p>
|
|
The <a href="../../../../com/sleepycat/je/util/LogVerificationInputStream.html" title="class in com.sleepycat.je.util"><code>example here</code></a> shows how to implement
|
|
the <code>myCopyFiles</code> method using <a href="../../../../com/sleepycat/je/util/LogVerificationInputStream.html" title="class in com.sleepycat.je.util"><code>LogVerificationInputStream</code></a>. A <a href="../../../../com/sleepycat/je/util/LogVerificationReadableByteChannel.html" title="class in com.sleepycat.je.util"><code>LogVerificationReadableByteChannel</code></a>
|
|
could also be used for higher performance copying. A filter input stream is
|
|
used to verify the file efficiently as it is being read. If you choose to
|
|
use a script for copying files, the <a href="../../../../com/sleepycat/je/util/DbVerifyLog.html" title="class in com.sleepycat.je.util"><code>DbVerifyLog</code></a> command line tool
|
|
can be used instead.
|
|
<p>
|
|
Assuming that the full backup copied files into an empty directory, to
|
|
restore you can simply copy these files back into another empty directory.
|
|
<p>
|
|
Always start with an empty directory as the destination for a full backup or
|
|
a restore, to ensure that no unused files are present. Unused files --
|
|
perhaps the residual of an earlier environment or an earlier backup -- will
|
|
take up space, and they will never be deleted by the JE log cleaner. Also
|
|
note that such files will not be used by JE for calculating utilization and
|
|
will not appear in the <a href="../../../../com/sleepycat/je/util/DbSpace.html" title="class in com.sleepycat.je.util"><code>DbSpace</code></a> output.
|
|
<p>
|
|
<b>Performing incremental backups</b>
|
|
<p>
|
|
Incremental backups are used to reduce the number of files copied during
|
|
each backup. Compared to a full backup, there are two additional pieces of
|
|
information needed for an incremental backup: the number of the last file in
|
|
the previous backup, and a list of the active files in the environment
|
|
directory at the time of the current backup, i.e., the current snapshot.
|
|
Their purpose is explained below.
|
|
<p>
|
|
The number of the last file in the previous backup is used to avoid copying
|
|
files that are already present in the backup set. This file number must be
|
|
obtained before beginning the backup, either by checking the backup archive,
|
|
or getting this value from a stored location. For example, the last file
|
|
number could be written to a special file in the backup set at the time of a
|
|
backup, and then read from the special file before starting the next backup.
|
|
<p>
|
|
The list of files in the current snapshot, which should be obtained by
|
|
calling <a href="../../../../com/sleepycat/je/util/DbBackup.html#getLogFilesInSnapshot--"><code>getLogFilesInSnapshot()</code></a> (after calling <a href="../../../../com/sleepycat/je/util/DbBackup.html#startBackup--"><code>startBackup()</code></a>),
|
|
is used to avoid unused files after a restore, and may also be used to
|
|
reduce the size of the backup set. How to use this list is described below.
|
|
<p>
|
|
Some applications need the ability to restore to the point in time of any of
|
|
the incremental backups that were made in the past, and other applications
|
|
only need to restore to the point in time of the most recent backup.
|
|
Accordingly, the list of current files (that is made at the time of the
|
|
backup), should be used in one of two ways.
|
|
<ol>
|
|
<li>If you only need to restore to the point in time of the most recent
|
|
backup, then the list should be used to delete unused files from the
|
|
backup set. After copying all files during the backup, any file that is
|
|
<em>not</em> present in the list may then be deleted from the backup set.
|
|
This both reduces the size of the backup set, and ensures that unused
|
|
files will not be present in the backup set and therefore will not be
|
|
restored.</li>
|
|
<li>If you need to keep all log files from each backup so you can restore
|
|
to more than one point in time, then the list for each backup should be
|
|
saved with the backup file set so it can be used during a restore. During
|
|
the restore, only the files in the list should be copied, starting with an
|
|
empty destination directory. This ensures that unused files will not be
|
|
restored.</li>
|
|
</ol>
|
|
<p>
|
|
The following two examples shows how to perform an incremental backup. In
|
|
the first example, the list of current files is used to delete files from
|
|
the backup set that are no longer needed.
|
|
<pre class="code">
|
|
void myBackup(Environment env, File destDir) {
|
|
|
|
// Get the file number of the last file in the previous backup.
|
|
long lastFileInPrevBackup = ...
|
|
|
|
DbBackup backupHelper = new DbBackup(env, lastFileInPrevBackup);
|
|
|
|
// Optional: Do a checkpoint to reduce recovery time after a restore.
|
|
env.checkpoint(new CheckpointConfig().setForce(true));
|
|
|
|
// Start backup, find out what needs to be copied.
|
|
backupHelper.startBackup();
|
|
try {
|
|
// Copy the necessary files to archival storage.
|
|
String[] filesToCopy = backupHelper.getLogFilesInBackupSet();
|
|
myCopyFiles(env, backupHelper, filesToCopy, destDir);
|
|
|
|
// Delete files that are no longer needed.
|
|
// WARNING: This should only be done after copying all new files.
|
|
String[] filesInSnapshot = backupHelper.getLogFilesInSnapshot();
|
|
myDeleteUnusedFiles(destDir, filesInSnapshot);
|
|
|
|
// Update knowledge of last file saved in the backup set.
|
|
lastFileInPrevBackup = backupHelper.getLastFileInBackupSet();
|
|
// Save lastFileInPrevBackup persistently here ...
|
|
} finally {
|
|
// Remember to exit backup mode, or the JE cleaner cannot delete
|
|
// log files and disk usage will grow without bounds.
|
|
backupHelper.endBackup();
|
|
}
|
|
}
|
|
|
|
void myDeleteUnusedFiles(File destDir, String[] filesInSnapshot) {
|
|
// For each file in destDir that is NOT in filesInSnapshot, it should
|
|
// be deleted from destDir to save disk space in the backup set, and to
|
|
// ensure that unused files will not be restored.
|
|
}
|
|
|
|
See myCopyFiles further above.
|
|
</pre>
|
|
<p>
|
|
When performing backups as shown in the first example above, to restore you
|
|
can simply copy all files from the backup set into an empty directory.
|
|
<p>
|
|
In the second example below, the list of current files is saved with the
|
|
backup set so it can be used during a restore. The backup set will
|
|
effectively hold multiple backups that can be used to restore to different
|
|
points in time.
|
|
<pre class="code">
|
|
void myBackup(Environment env, File destDir) {
|
|
|
|
// Get the file number of the last file in the previous backup.
|
|
long lastFileInPrevBackup = ...
|
|
|
|
DbBackup backupHelper = new DbBackup(env, lastFileInPrevBackup);
|
|
|
|
// Optional: Do a checkpoint to reduce recovery time after a restore.
|
|
env.checkpoint(new CheckpointConfig().setForce(true));
|
|
|
|
// Start backup, find out what needs to be copied.
|
|
backupHelper.startBackup();
|
|
try {
|
|
// Copy the necessary files to archival storage.
|
|
String[] filesToCopy = backupHelper.getLogFilesInBackupSet();
|
|
myCopyFiles(env, backupHelper, filesToCopy, destDir);
|
|
|
|
// Save current list of files with backup data set.
|
|
String[] filesInSnapshot = backupHelper.getLogFilesInSnapshot();
|
|
// Save filesInSnapshot persistently here ...
|
|
|
|
// Update knowledge of last file saved in the backup set.
|
|
lastFileInPrevBackup = backupHelper.getLastFileInBackupSet();
|
|
// Save lastFileInPrevBackup persistently here ...
|
|
} finally {
|
|
// Remember to exit backup mode, or the JE cleaner cannot delete
|
|
// log files and disk usage will grow without bounds.
|
|
backupHelper.endBackup();
|
|
}
|
|
}
|
|
|
|
See myCopyFiles further above.
|
|
</pre>
|
|
<p>
|
|
When performing backups as shown in the second example above, to restore you
|
|
must choose one of the file lists that was saved. You may choose the list
|
|
written by the most recent backup, or a list written by an earlier backup.
|
|
To restore, the files in the list should be copied into an empty destination
|
|
directory.
|
|
<p>
|
|
<b><a href="restore">Restoring from a backup</a></b>
|
|
<p>
|
|
As described in the sections above, the restore procedure is to copy the
|
|
files from a backup set into an empty directory. Depending on the type of
|
|
backup that was performed (see above), either all files from the backup set
|
|
are copied, or only the files on a list that was created during the backup.
|
|
<p>
|
|
There is one additional consideration when performing a restore, under the
|
|
following condition:
|
|
<ul>
|
|
<li>Incremental backups are used, AND
|
|
<ul>
|
|
<li>the backup was created using DbBackup with JE 6.2 or earlier,
|
|
OR</li>
|
|
<li>the backup was created in a read-only JE environment.</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<p>
|
|
If the above condition holds, after copying the files an additional step is
|
|
needed. To enable the creation of future incremental backups using the
|
|
restored files, the <a href="../../../../com/sleepycat/je/EnvironmentConfig.html#ENV_RECOVERY_FORCE_NEW_FILE"><code>EnvironmentConfig.ENV_RECOVERY_FORCE_NEW_FILE</code></a> parameter
|
|
should be set to true when opening the JE Environment for the first time
|
|
after the restore. When this parameter is set to true, the last .jdb file
|
|
restored will not be modified when opening the Environment, and the next
|
|
.jdb file will be created and will become the end-of-log file.
|
|
<p>
|
|
WARNING: When the above special condition is true and this property is
|
|
<em>not</em> set to true when opening the environment for the first time
|
|
after a restore, then the backup set that was restored may not be used as
|
|
the basis for future incremental backups. If a future incremental backup
|
|
were performed based on this backup set, it would be incomplete and data
|
|
would be lost if that incremental backup were restored.
|
|
<p>
|
|
When JE 6.3 or later is used to create the backup, and the backup is created
|
|
in a read-write environment (the usual case), this extra step is
|
|
unnecessary. In this case, <a href="../../../../com/sleepycat/je/util/DbBackup.html#startBackup--"><code>startBackup()</code></a> will have added an
|
|
"immutable file" marker to the last file in the backup and this will prevent
|
|
that file from being modified, just as if the
|
|
<code>ENV_RECOVERY_FORCE_NEW_FILE</code> parameter were set to true.</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="summary">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="constructor.summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Constructor Summary</h3>
|
|
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
|
|
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
|
|
<tr>
|
|
<th class="colOne" scope="col">Constructor and Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/util/DbBackup.html#DbBackup-com.sleepycat.je.Environment-">DbBackup</a></span>(<a href="../../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je">Environment</a> env)</code>
|
|
<div class="block">Creates a DbBackup helper for a full backup.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/util/DbBackup.html#DbBackup-com.sleepycat.je.Environment-long-">DbBackup</a></span>(<a href="../../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je">Environment</a> env,
|
|
long lastFileInPrevBackup)</code>
|
|
<div class="block">Creates a DbBackup helper for an incremental backup.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</li>
|
|
</ul>
|
|
<!-- ========== METHOD SUMMARY =========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="method.summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Method Summary</h3>
|
|
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
|
|
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span><span id="t6" class="tableTab"><span><a href="javascript:show(32);">Deprecated Methods</a></span><span class="tabEnd"> </span></span></caption>
|
|
<tr>
|
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
|
<th class="colLast" scope="col">Method and Description</th>
|
|
</tr>
|
|
<tr id="i0" class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/util/DbBackup.html#endBackup--">endBackup</a></span>()</code>
|
|
<div class="block">End backup mode, thereby re-enabling normal deletion of log files by the
|
|
JE log cleaner.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i1" class="rowColor">
|
|
<td class="colFirst"><code>long</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/util/DbBackup.html#getLastFileInBackupSet--">getLastFileInBackupSet</a></span>()</code>
|
|
<div class="block">Can only be called in backup mode, after startBackup() has been called.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i2" class="altColor">
|
|
<td class="colFirst"><code>java.lang.String[]</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/util/DbBackup.html#getLogFilesInBackupSet--">getLogFilesInBackupSet</a></span>()</code>
|
|
<div class="block">Get the minimum list of files that must be copied for this backup.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i3" class="rowColor">
|
|
<td class="colFirst"><code>java.lang.String[]</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/util/DbBackup.html#getLogFilesInBackupSet-long-">getLogFilesInBackupSet</a></span>(long lastFileInPrevBackup)</code>
|
|
<div class="block"><span class="deprecatedLabel">Deprecated.</span>
|
|
<div class="block"><span class="deprecationComment">replaced by <a href="../../../../com/sleepycat/je/util/DbBackup.html#getLogFilesInBackupSet--"><code>getLogFilesInBackupSet()</code></a>; pass
|
|
lastFileInPrevBackup to the <a href="../../../../com/sleepycat/je/util/DbBackup.html#DbBackup-com.sleepycat.je.Environment-long-"><code>DbBackup(Environment,long)</code></a>
|
|
constructor.</span></div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i4" class="altColor">
|
|
<td class="colFirst"><code>java.lang.String[]</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/util/DbBackup.html#getLogFilesInSnapshot--">getLogFilesInSnapshot</a></span>()</code>
|
|
<div class="block">Get the list of all active files that are needed for the environment at
|
|
the point of time when backup mode started, i.e., the current snapshot.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i5" class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/util/DbBackup.html#removeFileProtection-java.lang.String-">removeFileProtection</a></span>(java.lang.String fileName)</code>
|
|
<div class="block">Removes protection for a file in the backup set.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i6" class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/util/DbBackup.html#startBackup--">startBackup</a></span>()</code>
|
|
<div class="block">Start backup mode in order to determine the definitive backup set needed
|
|
at this point in time.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Methods inherited from class java.lang.Object</h3>
|
|
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="details">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- ========= CONSTRUCTOR DETAIL ======== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="constructor.detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Constructor Detail</h3>
|
|
<a name="DbBackup-com.sleepycat.je.Environment-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>DbBackup</h4>
|
|
<pre>public DbBackup(<a href="../../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je">Environment</a> env)
|
|
throws <a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block">Creates a DbBackup helper for a full backup.
|
|
|
|
<p>This is equivalent to using <a href="../../../../com/sleepycat/je/util/DbBackup.html#DbBackup-com.sleepycat.je.Environment-long-"><code>DbBackup(Environment,long)</code></a> and
|
|
passing <code>-1</code> for the <code>lastFileInPrevBackup</code> parameter.</p></div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>env</code> - with an open, valid environment handle. If the environment
|
|
directory has read/write permissions, the environment handle must be
|
|
configured for read/write.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code>java.lang.IllegalArgumentException</code> - if the environment directory has
|
|
read/write permissions, but the environment handle is not configured for
|
|
read/write.</dd>
|
|
<dd><code><a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="DbBackup-com.sleepycat.je.Environment-long-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>DbBackup</h4>
|
|
<pre>public DbBackup(<a href="../../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je">Environment</a> env,
|
|
long lastFileInPrevBackup)</pre>
|
|
<div class="block">Creates a DbBackup helper for an incremental backup.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>env</code> - with an open, valid environment handle. If the environment
|
|
directory has read/write permissions, the environment handle must be
|
|
configured for read/write.</dd>
|
|
<dd><code>lastFileInPrevBackup</code> - the last file in the previous backup set
|
|
when performing an incremental backup, or <code>-1</code> to perform a full
|
|
backup. The first file in this backup set will be the file following
|
|
<code>lastFileInPrevBackup</code>.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
|
|
environment-wide failure occurs.</dd>
|
|
<dd><code>java.lang.IllegalArgumentException</code> - if the environment directory has
|
|
read/write permissions, but the environment handle is not configured for
|
|
read/write.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<!-- ============ METHOD DETAIL ========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="method.detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Method Detail</h3>
|
|
<a name="startBackup--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>startBackup</h4>
|
|
<pre>public void startBackup()
|
|
throws <a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
|
|
<div class="block">Start backup mode in order to determine the definitive backup set needed
|
|
at this point in time.
|
|
|
|
<p>This method determines the last file in the backup set, which is the
|
|
last log file in the environment at this point in time. Following this
|
|
method call, all new data will be written to other, new log files. In
|
|
other words, the last file in the backup set will not be modified after
|
|
this method returns.</p>
|
|
|
|
<p><em>WARNING:</em> After calling this method, deletion of log files in
|
|
the backup set by the JE log cleaner will be disabled until <a href="../../../../com/sleepycat/je/util/DbBackup.html#endBackup--"><code>endBackup()</code></a> is called. To prevent unbounded growth of disk usage, be
|
|
sure to call <a href="../../../../com/sleepycat/je/util/DbBackup.html#endBackup--"><code>endBackup()</code></a> to re-enable log file deletion.
|
|
Additionally, the Environment can't be closed until endBackup() is
|
|
called.
|
|
</p></div>
|
|
<dl>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../../com/sleepycat/je/rep/LogOverwriteException.html" title="class in com.sleepycat.je.rep">LogOverwriteException</a></code> - if a replication
|
|
operation is overwriting log files. The backup can not proceed because
|
|
files may be invalid. The backup may be attempted at a later time.</dd>
|
|
<dd><code><a href="../../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
|
|
environment-wide failure occurs.</dd>
|
|
<dd><code>java.lang.IllegalStateException</code> - if a backup is already in progress</dd>
|
|
<dd><code><a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="endBackup--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>endBackup</h4>
|
|
<pre>public void endBackup()</pre>
|
|
<div class="block">End backup mode, thereby re-enabling normal deletion of log files by the
|
|
JE log cleaner.</div>
|
|
<dl>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../../com/sleepycat/je/rep/LogOverwriteException.html" title="class in com.sleepycat.je.rep">LogOverwriteException</a></code> - if a replication
|
|
operation has overwritten log files. Any copied files should be
|
|
considered invalid and discarded. The backup may be attempted at a
|
|
later time.</dd>
|
|
<dd><code><a href="../../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected,
|
|
internal or environment-wide failure occurs.</dd>
|
|
<dd><code>java.lang.IllegalStateException</code> - if a backup has not been started.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getLastFileInBackupSet--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getLastFileInBackupSet</h4>
|
|
<pre>public long getLastFileInBackupSet()</pre>
|
|
<div class="block">Can only be called in backup mode, after startBackup() has been called.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the file number of the last file in the current backup set.
|
|
Save this value to reduce the number of files that must be copied at
|
|
the next backup session.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code>java.lang.IllegalStateException</code> - if a backup has not been started.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getLogFilesInBackupSet--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getLogFilesInBackupSet</h4>
|
|
<pre>public java.lang.String[] getLogFilesInBackupSet()</pre>
|
|
<div class="block">Get the minimum list of files that must be copied for this backup. When
|
|
performing an incremental backup, this consists of the set of active
|
|
files that are greater than the last file copied in the previous backup
|
|
session. When performing a full backup, this consists of the set of all
|
|
active files. Can only be called in backup mode, after startBackup() has
|
|
been called.
|
|
|
|
<p>The file numbers returned are in the range from the constructor
|
|
parameter <code>lastFileInPrevBackup + 1</code> to the last log file at the
|
|
time that <a href="../../../../com/sleepycat/je/util/DbBackup.html#startBackup--"><code>startBackup()</code></a> was called.</p></div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the names of all files to be copied, sorted in alphabetical
|
|
order. The return values are generally simple file names, not full
|
|
paths. However, if multiple data directories are being used (i.e. the
|
|
<a href="../EnvironmentConfig.html#LOG_N_DATA_DIRECTORIES">
|
|
je.log.nDataDirectories</a> parameter is non-0), then the file names are
|
|
prepended with the associated "dataNNN/" prefix, where "dataNNN/" is
|
|
the data directory name within the environment home directory and "/"
|
|
is the relevant file separator for the platform.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
|
|
environment-wide failure occurs.</dd>
|
|
<dd><code>java.lang.IllegalStateException</code> - if a backup has not been started.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getLogFilesInBackupSet-long-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getLogFilesInBackupSet</h4>
|
|
<pre>@Deprecated
|
|
public java.lang.String[] getLogFilesInBackupSet(long lastFileInPrevBackup)</pre>
|
|
<div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">replaced by <a href="../../../../com/sleepycat/je/util/DbBackup.html#getLogFilesInBackupSet--"><code>getLogFilesInBackupSet()</code></a>; pass
|
|
lastFileInPrevBackup to the <a href="../../../../com/sleepycat/je/util/DbBackup.html#DbBackup-com.sleepycat.je.Environment-long-"><code>DbBackup(Environment,long)</code></a>
|
|
constructor.</span></div>
|
|
<div class="block">Get the minimum list of files that must be copied for this backup. This
|
|
consists of the set of active files that are greater than the last file
|
|
copied in the previous backup session. Can only be called in backup
|
|
mode, after startBackup() has been called.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>lastFileInPrevBackup</code> - file number of last file copied in the last
|
|
backup session, obtained from getLastFileInBackupSet().</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the names of all the files to be copied that come after
|
|
lastFileInPrevBackup.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
|
|
environment-wide failure occurs.</dd>
|
|
<dd><code>java.lang.IllegalStateException</code> - if a backup has not been started.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getLogFilesInSnapshot--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getLogFilesInSnapshot</h4>
|
|
<pre>public java.lang.String[] getLogFilesInSnapshot()</pre>
|
|
<div class="block">Get the list of all active files that are needed for the environment at
|
|
the point of time when backup mode started, i.e., the current snapshot.
|
|
Can only be called in backup mode, after startBackup() has been called.
|
|
|
|
<p>When performing an incremental backup, this method is called to
|
|
determine the files that would needed for a restore. As described in
|
|
the examples at the top of this class, this list can be used to avoid
|
|
unused files after a restore, and may also be used to reduce the size of
|
|
the backup set.</p>
|
|
|
|
<p>When performing a full backup this method is normally not needed,
|
|
since in that case it returns the same set of files that is returned by
|
|
<a href="../../../../com/sleepycat/je/util/DbBackup.html#getLogFilesInBackupSet--"><code>getLogFilesInBackupSet()</code></a>.</p></div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the names of all files in the snapshot, sorted in alphabetical
|
|
order. The return values are generally simple file names, not full
|
|
paths. However, if multiple data directories are being used (i.e. the
|
|
<a href="../EnvironmentConfig.html#LOG_N_DATA_DIRECTORIES">
|
|
je.log.nDataDirectories</a> parameter is non-0), then the file names are
|
|
prepended with the associated "dataNNN/" prefix, where "dataNNN/" is
|
|
the data directory name within the environment home directory and "/"
|
|
is the relevant file separator for the platform.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
|
|
environment-wide failure occurs.</dd>
|
|
<dd><code>java.lang.IllegalStateException</code> - if a backup has not been started.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="removeFileProtection-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>removeFileProtection</h4>
|
|
<pre>public void removeFileProtection(java.lang.String fileName)</pre>
|
|
<div class="block">Removes protection for a file in the backup set. This method should be
|
|
called after copying a file, so that it may be deleted to avoid
|
|
exceeding disk usage limits.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>fileName</code> - a file name that has already been copied, in the format
|
|
returned by <a href="../../../../com/sleepycat/je/util/DbBackup.html#getLogFilesInBackupSet--"><code>getLogFilesInBackupSet()</code></a> .</dd>
|
|
<dt><span class="simpleTagLabel">Since:</span></dt>
|
|
<dd>7.5</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<!-- ========= END OF CLASS DATA ========= -->
|
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
|
<div class="bottomNav"><a name="navbar.bottom">
|
|
<!-- -->
|
|
</a>
|
|
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
|
|
<a name="navbar.bottom.firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../../../overview-summary.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="class-use/DbBackup.html">Use</a></li>
|
|
<li><a href="package-tree.html">Tree</a></li>
|
|
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
|
|
<li><a href="../../../../index-all.html">Index</a></li>
|
|
<li><a href="../../../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
<div class="aboutLanguage"><b>Berkeley DB Java Edition</b><br><font size=\"-1\"> version 7.5.11</font>
|
|
</div>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList">
|
|
<li><a href="../../../../com/sleepycat/je/util/ConsoleHandler.html" title="class in com.sleepycat.je.util"><span class="typeNameLink">Prev Class</span></a></li>
|
|
<li><a href="../../../../com/sleepycat/je/util/DbCacheSize.html" title="class in com.sleepycat.je.util"><span class="typeNameLink">Next Class</span></a></li>
|
|
</ul>
|
|
<ul class="navList">
|
|
<li><a href="../../../../index.html?com/sleepycat/je/util/DbBackup.html" target="_top">Frames</a></li>
|
|
<li><a href="DbBackup.html" target="_top">No Frames</a></li>
|
|
</ul>
|
|
<ul class="navList" id="allclasses_navbar_bottom">
|
|
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
|
|
</ul>
|
|
<div>
|
|
<script type="text/javascript"><!--
|
|
allClassesLink = document.getElementById("allclasses_navbar_bottom");
|
|
if(window==top) {
|
|
allClassesLink.style.display = "block";
|
|
}
|
|
else {
|
|
allClassesLink.style.display = "none";
|
|
}
|
|
//-->
|
|
</script>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li>Nested | </li>
|
|
<li>Field | </li>
|
|
<li><a href="#constructor.summary">Constr</a> | </li>
|
|
<li><a href="#method.summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li>Field | </li>
|
|
<li><a href="#constructor.detail">Constr</a> | </li>
|
|
<li><a href="#method.detail">Method</a></li>
|
|
</ul>
|
|
</div>
|
|
<a name="skip.navbar.bottom">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
|
<p class="legalCopy"><small><font size=1>Copyright (c) 2002, 2017 Oracle and/or its affiliates. All rights reserved.</font> </small></p>
|
|
</body>
|
|
</html>
|