104 lines
5.0 KiB
HTML
104 lines
5.0 KiB
HTML
<!--$Id: db_upgrade.html 63573 2008-05-23 21:43:21Z trent.nelson $-->
|
|
<!--Copyright (c) 1997,2008 Oracle. All rights reserved.-->
|
|
<!--See the file LICENSE for redistribution information.-->
|
|
<html>
|
|
<head>
|
|
<title>Berkeley DB: DB->upgrade</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>
|
|
<b>DB->upgrade</b>
|
|
</td>
|
|
<td align=right>
|
|
<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a>
|
|
<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
|
|
</tr></table>
|
|
<hr size=1 noshade>
|
|
<tt>
|
|
<b><pre>
|
|
#include <db.h>
|
|
<p>
|
|
int
|
|
DB->upgrade(DB *db, const char *file, u_int32_t flags);
|
|
</pre></b>
|
|
<hr size=1 noshade>
|
|
<b>Description: DB->upgrade</b>
|
|
<p>The DB->upgrade method upgrades all of the databases included in the
|
|
file <b>file</b>, if necessary. If no upgrade is necessary,
|
|
DB->upgrade always returns success.</p>
|
|
<p><b>Database upgrades are done in place and are destructive. For example,
|
|
if pages need to be allocated and no disk space is available, the
|
|
database may be left corrupted. Backups should be made before databases
|
|
are upgraded. See <a href="../ref/am/upgrade.html">Upgrading databases</a>
|
|
for more information.</b></p>
|
|
<p>Unlike all other database operations, DB->upgrade may only be done
|
|
on a system with the same byte-order as the database.</p>
|
|
<p>The DB->upgrade method
|
|
returns a non-zero error value on failure
|
|
and 0 on success.
|
|
</p>
|
|
<p>The DB->upgrade method is the underlying method used by the <a href="../utility/db_upgrade.html">db_upgrade</a> utility.
|
|
See the <a href="../utility/db_upgrade.html">db_upgrade</a> utility source code for an example of using DB->upgrade
|
|
in a IEEE/ANSI Std 1003.1 (POSIX) environment.</p>
|
|
<b>Parameters</b> <br>
|
|
<b>file</b><ul compact><li>The <b>file</b> parameter is the physical file containing the databases
|
|
to be upgraded.</ul>
|
|
<b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to 0 or
|
|
the following value:
|
|
<br>
|
|
<b><a name="DB_DUPSORT">DB_DUPSORT</a></b><ul compact><li><b>This flag is only meaningful when upgrading databases from
|
|
releases before the Berkeley DB 3.1 release.</b>
|
|
<p>As part of the upgrade from the Berkeley DB 3.0 release to the 3.1 release,
|
|
the on-disk format of duplicate data items changed. To correctly
|
|
upgrade the format requires applications to specify whether duplicate
|
|
data items in the database are sorted or not. Specifying the
|
|
DB_DUPSORT flag informs DB->upgrade that the duplicates
|
|
are sorted; otherwise they are assumed to be unsorted. Incorrectly
|
|
specifying the value of this flag may lead to database corruption.</p>
|
|
<p>Further, because the DB->upgrade method upgrades a physical file
|
|
(including all the databases it contains), it is not possible to use
|
|
DB->upgrade to upgrade files in which some of the databases it
|
|
includes have sorted duplicate data items, and some of the databases it
|
|
includes have unsorted duplicate data items. If the file does not have
|
|
more than a single database, if the databases do not support duplicate
|
|
data items, or if all of the databases that support duplicate data items
|
|
support the same style of duplicates (either sorted or unsorted),
|
|
DB->upgrade will work correctly as long as the
|
|
DB_DUPSORT flag is correctly specified. Otherwise, the file
|
|
cannot be upgraded using DB->upgrade; it must be upgraded
|
|
manually by dumping and reloading the databases.</p></ul>
|
|
<br></ul>
|
|
<br>
|
|
<br><b>Environment Variables</b>
|
|
<p>If the database was opened within a database environment, the
|
|
environment variable <b>DB_HOME</b> may be used as the path of the
|
|
database environment home.</p>
|
|
<p>DB->upgrade is affected by any database directory specified using
|
|
the <a href="../api_c/env_set_data_dir.html">DB_ENV->set_data_dir</a> method, or by setting the "set_data_dir" string
|
|
in the environment's <a href="../ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.</p>
|
|
<br><b>Errors</b>
|
|
<p>The DB->upgrade method
|
|
may fail and return one of the following non-zero errors:</p>
|
|
<br>
|
|
<b><a name="DB_OLD_VERSION">DB_OLD_VERSION</a></b><ul compact><li>The database cannot be upgraded by this version of the Berkeley DB software.</ul>
|
|
<br>
|
|
<br>
|
|
<b>EINVAL</b><ul compact><li>If the database is not in the same byte-order as the system; or if an
|
|
invalid flag value or parameter was specified.</ul>
|
|
<br>
|
|
<hr size=1 noshade>
|
|
<br><b>Class</b>
|
|
<a href="../api_c/db_class.html">DB</a>
|
|
<br><b>See Also</b>
|
|
<a href="../api_c/db_list.html">Databases and Related Methods</a>
|
|
</tt>
|
|
<table width="100%"><tr><td><br></td><td align=right>
|
|
<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
|
|
</td></tr></table>
|
|
<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font>
|
|
</body>
|
|
</html>
|