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