summaryrefslogtreecommitdiff
path: root/db/docs/utility/db_archive.html
blob: f1fd08bdc9ea35cdaef14f5a1cf2407b38b48068 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!--$Id: db_archive.so,v 10.28 2002/11/13 21:49:24 bostic Exp $-->
<!--Copyright 1997-2003 by Sleepycat Software, Inc.-->
<!--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,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
</head>
<body bgcolor=white>
<a name="2"><!--meow--></a>
<table width="100%"><tr valign=top>
<td>
<h3>db_archive</h3>
</td>
</td></tr></table>
<hr size=1 noshade>
<tt>
<h3><pre>db_archive [<b>-adlsVv</b>] [<b>-h home</b>] [<b>-P password</b>]</pre></h3>
<h3>Description</h3>
<a name="3"><!--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>
<p><dl compact>
<p><dt><b>-a</b><dd>Write all pathnames as absolute pathnames, instead of relative to the
database home directories.
<p><dt><b>-d</b><dd>Remove log files that are no longer needed; no filenames are written.
Automatic log file removal is likely to make catastrophic recovery
impossible.
<p><dt><b>-h</b><dd>Specify a home directory for the database environment; by
default, the current working directory is used.
<p><dt><b>-l</b><dd>Write out the pathnames of all the database log files, whether or not
they are involved in active transactions.
<p><dt><b>-P</b><dd>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.
<p><dt><b>-s</b><dd>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>
<p><dt><b>-V</b><dd>Write the library version number to the standard output, and exit.
<p><dt><b>-v</b><dd>Run in verbose mode, listing the checkpoints in the log files as they
are reviewed.
</dl>
<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>
<h3>Environment Variables</h3>
<p><dl compact>
<p><dt>DB_HOME<dd>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>.
</dl>
</tt>
<p><font size=1><a href="../sleepycat/legal.html">Copyright (c) 1996-2003</a> <a href="http://www.sleepycat.com">Sleepycat Software, Inc.</a> - All rights reserved.</font>
</body>
</html>