<!--$Id: db_close.so,v 11.15 2002/08/18 21:17:23 bostic Exp $--> <!--$Id: m4.tcl,v 11.28 2004/12/16 19:13:05 bostic Exp $--> <!--Copyright (c) 1997,2007 Oracle. All rights reserved.--> <!--See the file LICENSE for redistribution information.--> <html> <head> <title>Berkeley DB: db close</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> <table width="100%"><tr valign=top> <td> <h3><i>db</i> <b>close</b></h3> </td> <td align=right> <a href="../../db46-devel-4.6.21/api_tcl/api_tcl.html"><img src="../../db46-devel-4.6.21/images/api.gif" alt="API"></a> <a href="../../db46-devel-4.6.21/ref/toc.html"><img src="../../db46-devel-4.6.21/images/ref.gif" alt="Ref"></a></td> </tr></table> <hr size=1 noshade> <tt> <h3><pre>db close [-nosync] </pre></h3> <h3>Description(db close)</h3> <p>The <i>db</i> <b>close</b> command flushes any cached database information to disk, closes any open cursors, frees any allocated resources, and closes any underlying files. Because key/data pairs are cached in memory, failing to sync the file with the <i>db</i> <b>close</b> or <i>db</i> <b>sync</b> command may result in inconsistent or lost information.</p> <p>The options are as follows:</p> <dl compact> <dt>-nosync<dd>Do not flush cached information to disk. <p>The -nosync flag is a dangerous option. It should only be set if the application is doing logging (with transactions) so that the database is recoverable after a system or application crash, or if the database is always generated from scratch after any system or application crash.</p> <p>It is important to understand that flushing cached information to disk only minimizes the window of opportunity for corrupted data. Although unlikely, it is possible for database corruption to happen if a system or application crash occurs while writing data to the database. To ensure that database corruption never occurs, applications must either use transactions and logging with automatic recovery, use logging and application-specific recovery, or edit a copy of the database; and after all applications using the database have successfully called <i>db</i> <b>close</b>, atomically replace the original database with the updated copy.</p> </dl> <p>After <i>db</i> <b>close</b> has been called, regardless of its return, the DB handle may not be accessed again.</p> <p>The <i>db</i> <b>close</b> command returns 0 on success, and in the case of error, a Tcl error is thrown.</p> </tt> <table width="100%"><tr><td><br></td><td align=right> <a href="../../db46-devel-4.6.21/api_tcl/api_tcl.html"><img src="../../db46-devel-4.6.21/images/api.gif" alt="API"></a><a href="../../db46-devel-4.6.21/ref/toc.html"><img src="../../db46-devel-4.6.21/images/ref.gif" alt="Ref"></a> </td></tr></table> <p><font size=1>Copyright (c) 1996,2007 Oracle. All rights reserved.</font> </body> </html>