Debian Codegraph @

docs/gsg_txn/JAVA/logfileremoval.html

raw
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <title>Removing Log Files</title>
7 <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9 <link rel="start" href="index.html" title="Getting Started with Berkeley DB Transaction Processing" />
10 <link rel="up" href="filemanagement.html" title="Chapter 5. Managing DB Files" />
11 <link rel="prev" href="hotfailover.html" title="Using Hot Failovers" />
12 <link rel="next" href="logconfig.html" title="Configuring the Logging Subsystem" />
13 </head>
14 <body>
15 <div xmlns="" class="navheader">
16 <div class="libver">
17 <p>Library Version 11.2.5.3</p>
18 </div>
19 <table width="100%" summary="Navigation header">
20 <tr>
21 <th colspan="3" align="center">Removing Log Files</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="hotfailover.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 5. Managing DB Files</th>
26 <td width="20%" align="right"> <a accesskey="n" href="logconfig.html">Next</a></td>
27 </tr>
28 </table>
29 <hr />
30 </div>
31 <div class="sect1" lang="en" xml:lang="en">
32 <div class="titlepage">
33 <div>
34 <div>
35 <h2 class="title" style="clear: both"><a id="logfileremoval"></a>Removing Log Files</h2>
36 </div>
37 </div>
38 </div>
39 <p>
40 By default DB does not delete log files for you. For this reason,
41 DB's log files will eventually grow to consume an
42 unnecessarily large amount of disk space. To guard against
43 this, you should periodically take administrative action to
44 remove log files that are no longer in use by your application.
45 </p>
46 <p>
47 You can remove a log file if all of the following are true:
48 </p>
49 <div class="itemizedlist">
50 <ul type="disc">
51 <li>
52 <p>
53 the log file is not involved in an active transaction.
54 </p>
55 </li>
56 <li>
57 <p>
58 a checkpoint has been performed
59 <span class="emphasis"><em>after</em></span> the log file was
60 created.
61 </p>
62 </li>
63 <li>
64 <p>
65 the log file is not the only log file in the
66 environment.
67 </p>
68 </li>
69 <li>
70 <p>
71 the log file that you want to remove has already been
72 included in an offline or hot backup.
73 Failure to observe this last condition can cause your
74 backups to be unusable.
75 </p>
76 </li>
77 </ul>
78 </div>
79 <p>
80 DB provides several mechanisms to remove log files that
81 meet all but the last criteria (DB has no way to know which
82 log files have already been included in a backup). The
83 following mechanisms make it easy to remove unneeded log files,
84 but can result in an unusable backup if the log files are not first
85 saved to your archive location. All of the following
86 mechanisms automatically delete unneeded log files for you:
87 </p>
88 <div class="itemizedlist">
89 <ul type="disc">
90 <li>
91 <p>
92 Run the <span class="command"><strong>db_archive</strong></span> command line
93 utility with the <code class="literal">-d</code> option.
94 </p>
95 </li>
96 <li>
97 <p>
98 From within your application, call the
99
100 <span>
101 <code class="methodname">Environment.removeOldLogFiles()</code>
102 method.
103 </span>
104 </p>
105 </li>
106 <li>
107 <p>
108
109 <span>
110 Specify <code class="literal">true</code> to the
111 <code class="methodname">EnvironmentConfig.setLogAutoRemove()</code>
112 method. Note that setting this property affects
113 all environment handles opened against the
114 environment; not just the handle used to set
115 the property.
116 </span>
117 </p>
118 <p>
119 Note that unlike the other log removal mechanisms
120 identified here, this method actually causes log files
121 to be removed on an on-going basis as they become
122 unnecessary. This is extremely desirable behavior if
123 what you want is to use the absolute minimum amount of
124 disk space possible for your application. This
125 mechanism <span class="emphasis"><em>will</em></span> leave you with
126 the log files that are required to run normal recovery.
127 However, it is highly likely that this mechanism will
128 prevent you from running catastrophic recovery.
129 </p>
130 <p>
131 Do NOT use this mechanism if you want to be able to
132 perform catastrophic recovery, or if you want to be
133 able to maintain a hot backup.
134 </p>
135 </li>
136 </ul>
137 </div>
138 <p>
139 In order to safely remove log files and still be able to
140 perform catastrophic recovery, use the
141 <span class="command"><strong>db_archive</strong></span> command line utility as follows:
142 </p>
143 <div class="orderedlist">
144 <ol type="1">
145 <li>
146 <p>
147 Run either a normal or hot backup as described in
148 <a class="xref" href="backuprestore.html" title="Backup Procedures">Backup Procedures</a>. Make
149 sure that all of this data is safely stored to your
150 backup media before continuing.
151 </p>
152 </li>
153 <li>
154 <p>
155 If you have not already done so, perform a checkpoint.
156 See <a class="xref" href="filemanagement.html#checkpoints" title="Checkpoints">Checkpoints</a>
157 for more information.
158 </p>
159 </li>
160 <li>
161 <p>
162 If you are maintaining a hot backup, perform the hot
163 backup procedure as described in
164 <a class="xref" href="hotfailover.html" title="Using Hot Failovers">Using Hot Failovers</a>.
165 </p>
166 </li>
167 <li>
168 <p>
169 Run the <span class="command"><strong>db_archive</strong></span> command line
170 utility with the <code class="literal">-d</code> option against
171 your production environment.
172 </p>
173 </li>
174 <li>
175 <p>
176 Run the <span class="command"><strong>db_archive</strong></span> command line
177 utility with the <code class="literal">-d</code> option against
178 your failover environment, if you are maintaining one.
179 </p>
180 </li>
181 </ol>
182 </div>
183 </div>
184 <div class="navfooter">
185 <hr />
186 <table width="100%" summary="Navigation footer">
187 <tr>
188 <td width="40%" align="left"><a accesskey="p" href="hotfailover.html">Prev</a> </td>
189 <td width="20%" align="center">
190 <a accesskey="u" href="filemanagement.html">Up</a>
191 </td>
192 <td width="40%" align="right"> <a accesskey="n" href="logconfig.html">Next</a></td>
193 </tr>
194 <tr>
195 <td width="40%" align="left" valign="top">Using Hot Failovers </td>
196 <td width="20%" align="center">
197 <a accesskey="h" href="index.html">Home</a>
198 </td>
199 <td width="40%" align="right" valign="top"> Configuring the Logging Subsystem</td>
200 </tr>
201 </table>
202 </div>
203 </body>
204 </html>