| 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>Chapter 2. Upgrading from previous versions of Berkeley DB</title> |
| 7 | <link rel="stylesheet" href="gettingStarted.css" type="text/css" /> |
| 8 | <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> |
| 9 | <link rel="start" href="index.html" title="Berkeley DB Upgrade Guide" /> |
| 10 | <link rel="up" href="index.html" title="Berkeley DB Upgrade Guide" /> |
| 11 | <link rel="prev" href="introduction.html" title="Chapter 1. Introduction" /> |
| 12 | <link rel="next" href="upgrade_4_7_toc.html" title="Chapter 3. Upgrading Berkeley DB 4.6 applications to Berkeley DB 4.7" /> |
| 13 | </head> |
| 14 | <body> |
| 15 | <div xmlns="" class="navheader"> |
| 16 | <div class="libver"> |
| 17 | <p>Library Version 11.2.5.3</p> |
| 18 | </div> |
| 19 | <table width="100%" summary="Navigation header"> |
| 20 | <tr> |
| 21 | <th colspan="3" align="center">Chapter 2. |
| 22 | Upgrading from previous versions of Berkeley DB |
| 23 | </th> |
| 24 | </tr> |
| 25 | <tr> |
| 26 | <td width="20%" align="left"><a accesskey="p" href="introduction.html">Prev</a> </td> |
| 27 | <th width="60%" align="center"> </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="upgrade_4_7_toc.html">Next</a></td> |
| 29 | </tr> |
| 30 | </table> |
| 31 | <hr /> |
| 32 | </div> |
| 33 | <div class="chapter" lang="en" xml:lang="en"> |
| 34 | <div class="titlepage"> |
| 35 | <div> |
| 36 | <div> |
| 37 | <h2 class="title"><a id="upgrade_process"></a>Chapter 2. |
| 38 | Upgrading from previous versions of Berkeley DB |
| 39 | </h2> |
| 40 | </div> |
| 41 | </div> |
| 42 | </div> |
| 43 | <p> |
| 44 | The following information describes the general process of upgrading Berkeley DB installations. |
| 45 | There are four areas to be considered when upgrading Berkeley DB applications and database |
| 46 | environments: the application API, the database environment's region files, the underlying |
| 47 | database formats, and, in the case of transactional database environments, the log files. The |
| 48 | upgrade procedures required depend on whether or not the release is a major or minor release (in |
| 49 | which either the major or minor number of the version changed), or a patch release (in which |
| 50 | only the patch number in the version changed). Berkeley DB major and minor releases may |
| 51 | optionally include changes in all four areas, that is, the application API, region files, |
| 52 | database formats, and log files may not be backward-compatible with previous releases. |
| 53 | </p> |
| 54 | <p> |
| 55 | Each Berkeley DB major or minor release described in this book has a chapter indicating how to |
| 56 | upgrade to the new release. The chapter describes any API changes made in the release. |
| 57 | Application maintainers should review the API changes and update their applications as necessary |
| 58 | before recompiling with the new release. In addition, each chapter includes a section specifying |
| 59 | whether the log file format or database formats changed in non-backward-compatible ways as part |
| 60 | of the release. Because there are several underlying Berkeley DB database formats, and they do |
| 61 | not all necessarily change in the same release, changes to a database format in a release may |
| 62 | not affect any particular application. Further, database and log file formats may have changed |
| 63 | but be entirely backward-compatible, in which case no upgrade will be necessary. |
| 64 | </p> |
| 65 | <p> |
| 66 | A Berkeley DB patch release will never modify the API, regions, log files, or database formats |
| 67 | in incompatible ways, and so applications need only be relinked (or, in the case of a shared |
| 68 | library, pointed at the new version of the shared library) to upgrade to a new release. Note |
| 69 | that internal Berkeley DB interfaces may change at any time and in any release (including patch |
| 70 | releases) without warning. This means the library must be entirely recompiled and reinstalled |
| 71 | when upgrading to new releases of the library because there is no guarantee that modules from |
| 72 | one version of the library will interact correctly with modules from another release. We |
| 73 | recommend using the same compiler release when building patch releases as was used to build the |
| 74 | original release; in the default configuration, the Berkeley DB library shares data structures |
| 75 | from underlying shared memory between threads of control, and should the compiler re-order |
| 76 | fields or otherwise change those data structures between the two builds, errors may result. |
| 77 | </p> |
| 78 | <p> |
| 79 | If the release is a patch release, do the following: |
| 80 | </p> |
| 81 | <div class="orderedlist"> |
| 82 | <ol type="1"> |
| 83 | <li> |
| 84 | <p> |
| 85 | Shut down the old version of the application. |
| 86 | </p> |
| 87 | </li> |
| 88 | <li> |
| 89 | <p> |
| 90 | Install the new version of the application by relinking or installing a new version of the |
| 91 | Berkeley DB shared library. |
| 92 | </p> |
| 93 | </li> |
| 94 | <li> |
| 95 | <p> |
| 96 | Restart the application. |
| 97 | </p> |
| 98 | </li> |
| 99 | </ol> |
| 100 | </div> |
| 101 | <p> |
| 102 | Otherwise, if the application <span class="bold"><strong>does not</strong></span> have a Berkeley DB |
| 103 | transactional environment, the application may be installed in the field using the following |
| 104 | steps: |
| 105 | </p> |
| 106 | <div class="orderedlist"> |
| 107 | <ol type="1"> |
| 108 | <li> |
| 109 | <p> |
| 110 | Shut down the old version of the application. |
| 111 | </p> |
| 112 | </li> |
| 113 | <li> |
| 114 | <p> |
| 115 | Remove any Berkeley DB environment using the <a href="../api_reference/C/envremove.html" class="olink">DB_ENV->remove()</a> method or an appropriate system |
| 116 | utility. |
| 117 | </p> |
| 118 | </li> |
| 119 | <li> |
| 120 | <p> |
| 121 | Recompile and install the new version of the application. |
| 122 | </p> |
| 123 | </li> |
| 124 | <li> |
| 125 | <p> |
| 126 | If necessary, upgrade the application's databases. See |
| 127 | <a href="../programmer_reference/am_upgrade.html" class="olink">Database upgrade</a> |
| 128 | for more information. |
| 129 | </p> |
| 130 | </li> |
| 131 | <li> |
| 132 | <p> |
| 133 | Restart the application. |
| 134 | </p> |
| 135 | </li> |
| 136 | </ol> |
| 137 | </div> |
| 138 | <p> |
| 139 | Otherwise, if the application has a Berkeley DB transactional environment, but neither the log |
| 140 | file nor database formats need upgrading, the application may be installed in the field using |
| 141 | the following steps: |
| 142 | </p> |
| 143 | <div class="orderedlist"> |
| 144 | <ol type="1"> |
| 145 | <li> |
| 146 | <p> |
| 147 | Shut down the old version of the application. |
| 148 | </p> |
| 149 | </li> |
| 150 | <li> |
| 151 | <p> |
| 152 | Run recovery on the database environment using the <a href="../api_reference/C/envopen.html" class="olink">DB_ENV->open()</a> method or the <a href="../api_reference/C/db_recover.html" class="olink">db_recover utility</a>. |
| 153 | </p> |
| 154 | </li> |
| 155 | <li> |
| 156 | <p> |
| 157 | Remove any Berkeley DB environment using the <a href="../api_reference/C/envremove.html" class="olink">DB_ENV->remove()</a> method or an appropriate system |
| 158 | utility. |
| 159 | </p> |
| 160 | </li> |
| 161 | <li> |
| 162 | <p> |
| 163 | Recompile and install the new version of the application. |
| 164 | </p> |
| 165 | </li> |
| 166 | <li> |
| 167 | <p> |
| 168 | Restart the application. |
| 169 | </p> |
| 170 | </li> |
| 171 | </ol> |
| 172 | </div> |
| 173 | <p> |
| 174 | If the application has a Berkeley DB transactional environment, and the log files need upgrading |
| 175 | but the databases do not, the application may be installed in the field using the following |
| 176 | steps: |
| 177 | </p> |
| 178 | <div class="orderedlist"> |
| 179 | <ol type="1"> |
| 180 | <li> |
| 181 | <p> |
| 182 | Shut down the old version of the application. |
| 183 | </p> |
| 184 | </li> |
| 185 | <li> |
| 186 | <p> |
| 187 | Still using the old version of Berkeley DB, run recovery on the database environment using |
| 188 | the <a href="../api_reference/C/envopen.html" class="olink">DB_ENV->open()</a> method, or the <a href="../api_reference/C/db_recover.html" class="olink">db_recover utility</a>. |
| 189 | </p> |
| 190 | </li> |
| 191 | <li> |
| 192 | <p> |
| 193 | If you used the <a href="../api_reference/C/envopen.html" class="olink">DB_ENV->open()</a> method to run recovery, make sure that the Berkeley DB environment |
| 194 | is removed using the <a href="../api_reference/C/envremove.html" class="olink">DB_ENV->remove()</a> method or an appropriate system utility. |
| 195 | </p> |
| 196 | </li> |
| 197 | <li> |
| 198 | <p> |
| 199 | Archive the database environment for catastrophic recovery using |
| 200 | the <code class="literal">db_archive</code> utility as described in the |
| 201 | <a href="../programmer_reference/transapp_archival.html" class="olink">Database and log file archival</a> section in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>. |
| 202 | </p> |
| 203 | </li> |
| 204 | <li> |
| 205 | <p> |
| 206 | Recompile and install the new version of the application. |
| 207 | </p> |
| 208 | </li> |
| 209 | <li> |
| 210 | <p> |
| 211 | Force a checkpoint using the <a href="../api_reference/C/txncheckpoint.html" class="olink">DB_ENV->txn_checkpoint()</a> method or the <a href="../api_reference/C/db_checkpoint.html" class="olink">db_checkpoint utility</a>. If you use the |
| 212 | <a href="../api_reference/C/db_checkpoint.html" class="olink">db_checkpoint utility</a>, make sure to use the new version of the utility; that is, the version that |
| 213 | came with the release of Berkeley DB to which you are upgrading. |
| 214 | </p> |
| 215 | <p> |
| 216 | Note that forcing a checkpoint might result in warning messages |
| 217 | about log files that are being skipped. This is normal, and can be |
| 218 | safely ignored. |
| 219 | </p> |
| 220 | </li> |
| 221 | <li> |
| 222 | <p> |
| 223 | Remove unnecessary log files from the environment using the <code class="literal">-d</code> option on |
| 224 | the <a href="../api_reference/C/db_archive.html" class="olink">db_archive utility</a>, or from an application which calls the <a href="../api_reference/C/logarchive.html" class="olink">DB_ENV->log_archive()</a> method with the |
| 225 | <a href="../api_reference/C/logarchive.html#archive_DB_ARCH_REMOVE" class="olink">DB_ARCH_REMOVE</a> flag. |
| 226 | </p> |
| 227 | <p> |
| 228 | Note that removing log files in this way might result in warning messages |
| 229 | about log files that are being skipped. This is normal, and can be |
| 230 | safely ignored. |
| 231 | </p> |
| 232 | <p> |
| 233 | Note that if you are upgrading a replicated application, then you should |
| 234 | <span class="emphasis"><em>not</em></span> perform this step until all of the replication sites have been |
| 235 | upgraded to the current release level. If you run this site before all your sites are |
| 236 | upgraded, then errors can occur in your replication activities because important version |
| 237 | information might be lost. |
| 238 | </p> |
| 239 | </li> |
| 240 | <li> |
| 241 | <p> |
| 242 | Restart the application. |
| 243 | </p> |
| 244 | </li> |
| 245 | </ol> |
| 246 | </div> |
| 247 | <p> |
| 248 | Otherwise, if the application has a Berkeley DB transactional environment and the databases need |
| 249 | upgrading, the application may be installed in the field using the following steps: |
| 250 | </p> |
| 251 | <div class="orderedlist"> |
| 252 | <ol type="1"> |
| 253 | <li> |
| 254 | <p> |
| 255 | Shut down the old version of the application. |
| 256 | </p> |
| 257 | </li> |
| 258 | <li> |
| 259 | <p> |
| 260 | Still using the old version of Berkeley DB, run recovery on the database environment using |
| 261 | the <a href="../api_reference/C/envopen.html" class="olink">DB_ENV->open()</a> method, or the <a href="../api_reference/C/db_recover.html" class="olink">db_recover utility</a>. |
| 262 | </p> |
| 263 | </li> |
| 264 | <li> |
| 265 | <p> |
| 266 | If you used the <a href="../api_reference/C/envopen.html" class="olink">DB_ENV->open()</a> method to run recovery, make sure that the Berkeley DB environment |
| 267 | is removed using the <a href="../api_reference/C/envremove.html" class="olink">DB_ENV->remove()</a> method or an appropriate system utility. |
| 268 | </p> |
| 269 | </li> |
| 270 | <li> |
| 271 | <p> |
| 272 | Archive the database environment for catastrophic recovery using |
| 273 | the <code class="literal">db_archive</code> utility as described in the |
| 274 | <a href="../programmer_reference/transapp_archival.html" class="olink">Database and log file archival</a> section in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>. |
| 275 | </p> |
| 276 | </li> |
| 277 | <li> |
| 278 | <p> |
| 279 | Recompile and install the new version of the application. |
| 280 | </p> |
| 281 | </li> |
| 282 | <li> |
| 283 | <p> |
| 284 | Upgrade the application's databases. See |
| 285 | <a href="../programmer_reference/am_upgrade.html" class="olink">Database upgrade</a> |
| 286 | for more information. |
| 287 | </p> |
| 288 | </li> |
| 289 | <li> |
| 290 | <p> |
| 291 | Archive the database for catastrophic recovery again (using different media than before, of |
| 292 | course). Note: This archival is not strictly necessary. However, if you have to perform |
| 293 | catastrophic recovery after restarting the application, that recovery must be done based on |
| 294 | the last archive you have made. If you make this second archive, you can use it as the |
| 295 | basis of that catastrophic recovery. If you do not make this second archive, you have to |
| 296 | use the archive you made in step 4 as the basis of your recovery, and you have to do a full |
| 297 | upgrade on it before you can apply log files created after the upgrade to it. |
| 298 | </p> |
| 299 | </li> |
| 300 | <li> |
| 301 | <p> |
| 302 | Force a checkpoint using the <a href="../api_reference/C/txncheckpoint.html" class="olink">DB_ENV->txn_checkpoint()</a> method or the <a href="../api_reference/C/db_checkpoint.html" class="olink">db_checkpoint utility</a>. If you use the |
| 303 | <a href="../api_reference/C/db_checkpoint.html" class="olink">db_checkpoint utility</a>, make sure to use the new version of the utility; that is, the version that |
| 304 | came with the release of Berkeley DB to which you are upgrading. |
| 305 | </p> |
| 306 | <p> |
| 307 | Note that forcing a checkpoint might result in warning messages |
| 308 | about log files that are being skipped. This is normal, and can be |
| 309 | safely ignored. |
| 310 | </p> |
| 311 | </li> |
| 312 | <li> |
| 313 | <p> |
| 314 | Remove unnecessary log files from the environment using the <code class="literal">-d</code> option on |
| 315 | the <a href="../api_reference/C/db_archive.html" class="olink">db_archive utility</a>, or from an application which calls the <a href="../api_reference/C/logarchive.html" class="olink">DB_ENV->log_archive()</a> method with the |
| 316 | <a href="../api_reference/C/logarchive.html#archive_DB_ARCH_REMOVE" class="olink">DB_ARCH_REMOVE</a> flag. |
| 317 | </p> |
| 318 | <p> |
| 319 | Note that removing log files in this way might result in warning messages |
| 320 | about log files that are being skipped. This is normal, and can be |
| 321 | safely ignored. |
| 322 | </p> |
| 323 | <p> |
| 324 | Note that if you are upgrading a replicated application, then you should |
| 325 | <span class="emphasis"><em>not</em></span> perform this step until all of the replication sites have been |
| 326 | upgraded to the current release level. If you run this site before all your sites are |
| 327 | upgraded, then errors can occur in your replication activities because important version |
| 328 | information might be lost. |
| 329 | </p> |
| 330 | </li> |
| 331 | <li> |
| 332 | <p> |
| 333 | Restart the application. |
| 334 | </p> |
| 335 | </li> |
| 336 | </ol> |
| 337 | </div> |
| 338 | <p> |
| 339 | Finally, Berkeley DB supports the live upgrade of a replication group, by allowing mixed version |
| 340 | operation (replication sites running at the newer software version can inter-operate with older |
| 341 | version sites). All client sites must be upgraded first; the master site must be upgraded last. |
| 342 | In other words, at all times the master must be running the lowest version of Berkeley DB. To |
| 343 | upgrade a replication group, you must: |
| 344 | </p> |
| 345 | <div class="orderedlist"> |
| 346 | <ol type="1"> |
| 347 | <li> |
| 348 | <p> |
| 349 | Bring all clients up to date with the master (that is, all clients must be brought up to the |
| 350 | most current log record as measured by the master's log sequence number (LSN)). |
| 351 | </p> |
| 352 | </li> |
| 353 | <li> |
| 354 | <p> |
| 355 | Perform the upgrade procedures described previously on each of the individual database |
| 356 | environments that are part of the replication group. Each individual client may be upgraded |
| 357 | and restarted to join the replication group. |
| 358 | </p> |
| 359 | </li> |
| 360 | <li> |
| 361 | <p> |
| 362 | Shut down the master site and upgrade that site last. |
| 363 | </p> |
| 364 | </li> |
| 365 | </ol> |
| 366 | </div> |
| 367 | <p> |
| 368 | During live replication upgrade, while sites are running at different versions, adding new |
| 369 | (empty) clients to the replication group is not allowed. Those empty client environments must |
| 370 | be added after the entire group is upgraded. |
| 371 | </p> |
| 372 | <p> |
| 373 | Also, all removal of log files must be suspended throughout this entire procedure, so that there |
| 374 | is no chance of a client needing internal initialization. |
| 375 | </p> |
| 376 | <p> |
| 377 | Alternatively, it may be simpler to discard the contents of all of the client database |
| 378 | environments, upgrade the master database environment, and then re-add all of the clients to the |
| 379 | replication group using the standard replication procedures for new sites. |
| 380 | </p> |
| 381 | </div> |
| 382 | <div class="navfooter"> |
| 383 | <hr /> |
| 384 | <table width="100%" summary="Navigation footer"> |
| 385 | <tr> |
| 386 | <td width="40%" align="left"><a accesskey="p" href="introduction.html">Prev</a> </td> |
| 387 | <td width="20%" align="center"> </td> |
| 388 | <td width="40%" align="right"> <a accesskey="n" href="upgrade_4_7_toc.html">Next</a></td> |
| 389 | </tr> |
| 390 | <tr> |
| 391 | <td width="40%" align="left" valign="top">Chapter 1. Introduction </td> |
| 392 | <td width="20%" align="center"> |
| 393 | <a accesskey="h" href="index.html">Home</a> |
| 394 | </td> |
| 395 | <td width="40%" align="right" valign="top"> Chapter 3. Upgrading Berkeley DB 4.6 applications to Berkeley DB 4.7</td> |
| 396 | </tr> |
| 397 | </table> |
| 398 | </div> |
| 399 | </body> |
| 400 | </html> |