db_archive.html   [plain text]


<!--$Id: db_archive.so,v 10.30 2006/10/05 01:06:08 bostic Exp $-->
<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB: db_archive</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
</head>
<body bgcolor=white>
<table width="100%"><tr valign=top>
<td>
<b>db_archive</b>
</td>
</tr></table>
<hr size=1 noshade>
<tt>
<b><pre>db_archive [<b>-adlsVv</b>] [<b>-h home</b>] [<b>-P password</b>]</pre></b>
<b>Description</b>
<a name="2"><!--meow--></a>
<p>The db_archive utility writes the pathnames of log files that
are no longer in use (for example, no longer involved in active
transactions), to the standard output, one pathname per line.  These
log files should be written to backup media to provide for recovery in
the case of catastrophic failure (which also requires a snapshot of the
database files), but they may then be deleted from the system to reclaim
disk space.</p>
<p>The options are as follows:</p>
<br>
<b>-a</b><ul compact><li>Write all pathnames as absolute pathnames, instead of relative to the
database home directories.</ul>
<b>-d</b><ul compact><li>Remove log files that are no longer needed; no filenames are written.
Automatic log file removal is likely to make catastrophic recovery
impossible.</ul>
<b>-h</b><ul compact><li>Specify a home directory for the database environment; by
default, the current working directory is used.</ul>
<b>-l</b><ul compact><li>Write out the pathnames of all the database log files, whether or not
they are involved in active transactions.</ul>
<b>-P</b><ul compact><li>Specify an environment password.  Although Berkeley DB utilities overwrite
password strings as soon as possible, be aware there may be a window of
vulnerability on systems where unprivileged users can see command-line
arguments or where utilities are not able to overwrite the memory
containing the command-line arguments.</ul>
<b>-s</b><ul compact><li>Write the pathnames of all the database files that need to be archived
in order to recover the database from catastrophic failure.  If any of
the database files have not been accessed during the lifetime of the
current log files, db_archive will not include them in this
output.
<p>It is possible that some of the files to which the log refers have since
been deleted from the system.  In this case, db_archive will
ignore them.  When <a href="../utility/db_recover.html">db_recover</a> is run, any files to which the
log refers that are not present during recovery are assumed to have been
deleted and will not be recovered.</p></ul>
<b>-V</b><ul compact><li>Write the library version number to the standard output, and exit.</ul>
<b>-v</b><ul compact><li>Run in verbose mode.</ul>
<br>
<p>Log cursor handles (returned by the <a href="../api_c/log_cursor.html">DB_ENV-&gt;log_cursor</a> method) may have open
file descriptors for log files in the database environment.  Also, the
Berkeley DB interfaces to the database environment logging subsystem (for
example, <a href="../api_c/log_put.html">DB_ENV-&gt;log_put</a> and <a href="../api_c/txn_abort.html">DB_TXN-&gt;abort</a>) may allocate log cursors
and have open file descriptors for log files as well.  On operating
systems where filesystem related system calls (for example, rename and
unlink on Windows/NT) can fail if a process has an open file descriptor
for the affected file, attempting to move or remove the log files listed
by db_archive may fail.  All Berkeley DB internal use of log cursors
operates on active log files only and furthermore, is short-lived in
nature.  So, an application seeing such a failure should be restructured
to close any open log cursors it may have, and otherwise to retry the
operation until it succeeds.  (Although the latter is not likely to be
necessary; it is hard to imagine a reason to move or rename a log file
in which transactions are being logged or aborted.)</p>
<p>The db_archive utility uses a Berkeley DB environment (as described for the
<b>-h</b> option, the environment variable <b>DB_HOME</b>, or
because the utility was run in a directory containing a Berkeley DB
environment).  In order to avoid environment corruption when using a
Berkeley DB environment, db_archive should always be given the chance to
detach from the environment and exit gracefully.  To cause db_archive
to release all environment resources and exit cleanly, send it an
interrupt signal (SIGINT).</p>
<p>The <a href="../api_c/log_archive.html">DB_ENV-&gt;log_archive</a> method is the underlying method used by the db_archive utility.
See the db_archive utility source code for an example of using <a href="../api_c/log_archive.html">DB_ENV-&gt;log_archive</a>
in a IEEE/ANSI Std 1003.1 (POSIX) environment.</p>
<p>The db_archive utility exits 0 on success, and &gt;0 if an error occurs.</p>
<br><b>Environment Variables</b>
<br>
<b>DB_HOME</b><ul compact><li>If the <b>-h</b> option is not specified and the environment variable
DB_HOME is set, it is used as the path of the database home, as described
in <a href="../api_c/env_open.html">DB_ENV-&gt;open</a>.</ul>
<br>
</tt>
<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
</body>
</html>