1<!--$Id: logfile.so,v 11.11 2008/02/28 23:11:44 mjc Exp $--> 2<!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> 3<!--See the file LICENSE for redistribution information.--> 4<html> 5<head> 6<title>Berkeley DB Reference Guide: Log file removal</title> 7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> 8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> 9</head> 10<body bgcolor=white> 11<a name="2"><!--meow--></a> 12<table width="100%"><tr valign=top> 13<td><b><dl><dt>Berkeley DB Reference Guide:<dd>Berkeley DB Transactional Data Store Applications</dl></b></td> 14<td align=right><a href="../transapp/archival.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../transapp/recovery.html"><img src="../../images/next.gif" alt="Next"></a> 15</td></tr></table> 16<p align=center><b>Log file removal</b></p> 17<p>The fourth component of the infrastructure, log file removal, concerns 18the ongoing disk consumption of the database log files. Depending on 19the rate at which the application writes to the databases and the 20available disk space, the number of log files may increase quickly 21enough so that disk space will be a resource problem. For this reason, 22you will periodically want to remove log files in order to conserve disk 23space. This procedure is distinct from database and log file archival 24for catastrophic recovery, and you cannot remove the current log files 25simply because you have created a database snapshot or copied log files 26to archival media.</p> 27<p>Log files may be removed at any time, as long as:</p> 28<p><ul type=disc> 29<li>the log file is not involved in an active transaction. 30<li>a checkpoint has been written subsequent to the log file's 31creation. 32<li>the log file is not the only log file in the environment. 33</ul> 34<p>If you are preparing for catastrophic failure, you will want to copy 35the log files to archival media before you remove them as described in 36<a href="archival.html">Database and log file archival</a>.</p> 37<p>If you are not preparing for catastrophic failure, any one of the 38following methods can be used to remove log files:</p> 39<ol> 40<p><li>Run the standalone <a href="../../utility/db_archive.html">db_archive</a> utility with the <b>-d</b> 41option, to remove any log files that are no longer needed at the time 42the command is executed. 43<p><li>Call the <a href="../../api_c/log_archive.html">DB_ENV->log_archive</a> method from the application, with the 44<a href="../../api_c/log_archive.html#DB_ARCH_REMOVE">DB_ARCH_REMOVE</a> flag, to remove any log files that are no longer 45needed at the time the call is made. 46<p><li>Call the <a href="../../api_c/env_log_set_config.html">DB_ENV->log_set_config</a> method from the application, with the 47<a href="../../api_c/env_log_set_config.html#DB_LOG_AUTO_REMOVE">DB_LOG_AUTO_REMOVE</a> flag, to remove any log files that are no 48longer needed on an ongoing basis. With this configuration, Berkeley DB will 49automatically remove log files, and the application will not have an 50opportunity to copy the log files to backup media. 51</ol> 52<table width="100%"><tr><td><br></td><td align=right><a href="../transapp/archival.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../transapp/recovery.html"><img src="../../images/next.gif" alt="Next"></a> 53</td></tr></table> 54<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 55</body> 56</html> 57