<!--$Id: logfile.so,v 11.9 2002/11/13 21:49:24 bostic Exp $--> <!--Copyright (c) 1997,2007 Oracle. All rights reserved.--> <!--See the file LICENSE for redistribution information.--> <html> <head> <title>Berkeley DB Reference Guide: Log file removal</title> <meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> <meta name="keywords" content="embedded,database,programmatic,toolkit,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><dl><dt>Berkeley DB Reference Guide:<dd>Berkeley DB Transactional Data Store Applications</dl></h3></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> </td></tr></table> <p> <h3 align=center>Log file removal</h3> <p>The fourth component of the infrastructure, log file removal, concerns the ongoing disk consumption of the database log files. Depending on the rate at which the application writes to the databases and the available disk space, the number of log files may increase quickly enough so that disk space will be a resource problem. For this reason, you will periodically want to remove log files in order to conserve disk space. This procedure is distinct from database and log file archival for catastrophic recovery, and you cannot remove the current log files simply because you have created a database snapshot or copied log files to archival media.</p> <p>Log files may be removed at any time, as long as:</p> <p><ul type=disc> <li>the log file is not involved in an active transaction. <li>a checkpoint has been written subsequent to the log file's creation. <li>the log file is not the only log file in the environment. </ul> <p>If you are preparing for catastrophic failure, you will want to copy the log files to archival media before you remove them as described in <a href="archival.html">Database and log file archival</a>.</p> <p>If you are not preparing for catastrophic failure, any one of the following methods can be used to remove log files:</p> <ol> <p><li>Run the standalone <a href="../../utility/db_archive.html">db_archive</a> utility with the <b>-d</b> option, to remove any log files that are no longer needed at the time the command is executed. <p><li>Call the <a href="../../api_c/log_archive.html">DB_ENV->log_archive</a> method from the application, with the <a href="../../api_c/log_archive.html#DB_ARCH_REMOVE">DB_ARCH_REMOVE</a> flag, to remove any log files that are no longer needed at the time the call is made. <p><li>Call the <a href="../../api_c/env_set_flags.html">DB_ENV->set_flags</a> method from the application, with the <a href="../../api_c/env_set_flags.html#DB_LOG_AUTOREMOVE">DB_LOG_AUTOREMOVE</a> flag, to remove any log files that are no longer needed on an ongoing basis. With this configuration, Berkeley DB will automatically remove log files, and the application will not have an opportunity to copy the log files to backup media. </ol> <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> </td></tr></table> <p><font size=1>Copyright (c) 1996,2007 Oracle. All rights reserved.</font> </body> </html>