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