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>Using Hot Failovers</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="Getting Started with Berkeley DB Transaction Processing" /> 10 <link rel="up" href="filemanagement.html" title="Chapter 5. Managing DB Files" /> 11 <link rel="prev" href="architectrecovery.html" title="Designing Your Application for Recovery" /> 12 <link rel="next" href="logfileremoval.html" title="Removing Log Files" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">Using Hot Failovers</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="architectrecovery.html">Prev</a> </td> 22 <th width="60%" align="center">Chapter 5. Managing DB Files</th> 23 <td width="20%" align="right"> <a accesskey="n" href="logfileremoval.html">Next</a></td> 24 </tr> 25 </table> 26 <hr /> 27 </div> 28 <div class="sect1" lang="en" xml:lang="en"> 29 <div class="titlepage"> 30 <div> 31 <div> 32 <h2 class="title" style="clear: both"><a id="hotfailover"></a>Using Hot Failovers</h2> 33 </div> 34 </div> 35 </div> 36 <p> 37 You can maintain a backup that can be used for failover purposes. 38 Hot failovers differ from the backup and restore 39 procedures described previously in this chapter in that data 40 used for traditional backups is typically copied to offline storage. 41 Recovery time for a traditional backup is determined by: 42 </p> 43 <div class="itemizedlist"> 44 <ul type="disc"> 45 <li> 46 <p> 47 How quickly you can retrieve that storage media. 48 Typically storage media for critical backups is moved 49 to a safe facility in a remote location, so this step can 50 take a relatively long time. 51 </p> 52 </li> 53 <li> 54 <p> 55 How fast you can read the backup from the storage media 56 to a local disk drive. If you have very large backups, 57 or if your storage media is very slow, this can be a 58 lengthy process. 59 </p> 60 </li> 61 <li> 62 <p> 63 How long it takes you to run catastrophic recovery 64 against the newly restored backup. As described earlier 65 in this chapter, this process can be lengthy because 66 every log file must be examined during the recovery 67 process. 68 </p> 69 </li> 70 </ul> 71 </div> 72 <p> 73 When you use a hot failover, the backup is maintained 74 at a location that is reasonably fast to access. Usually, this 75 is a second disk drive local to the machine. 76 In this situation, recovery time is very quick 77 because you only have to reopen your 78 environment and database, using the failover environment 79 for the environment open. 80 </p> 81 <p> 82 Hot failovers obviously do not protect you from truly 83 catastrophic disasters (such as a fire in your machine room) 84 because the backup is still local to the machine. However, 85 you can guard against more mundane problems (such as a broken 86 disk drive) by keeping the backup on a 87 second drive that is managed by an alternate disk controller. 88 </p> 89 <p> 90 To maintain a hot failover: 91 </p> 92 <div class="orderedlist"> 93 <ol type="1"> 94 <li> 95 <p> 96 Copy all the active database files to the failover 97 directory. Use the <span class="command"><strong>db_archive</strong></span> 98 command line utility with the 99 <code class="literal">-s</code> option to identify all the active 100 database files. 101 </p> 102 </li> 103 <li> 104 <p> 105 Identify all the inactive log files in your production 106 environment and <span class="emphasis"><em>move</em></span> these to the failover 107 directory. Use the <span class="command"><strong>db_archive</strong></span> 108 command with no command line options to obtain a list 109 of these log files. 110 </p> 111 </li> 112 <li> 113 <p> 114 Identify the active log files in your production 115 environment, and <span class="emphasis"><em>copy</em></span> these to the 116 failover directory. Use the 117 <span class="command"><strong>db_archive</strong></span> command with the 118 <code class="literal">-l</code> option to obtain a list of these 119 log files. 120 </p> 121 </li> 122 <li> 123 <p> 124 Run catastrophic recovery against the failover 125 directory. Use the <span class="command"><strong>db_recover</strong></span> 126 command with the <code class="literal">-c</code> option to do 127 this. 128 </p> 129 </li> 130 <li> 131 <p> 132 Optionally copy the backup to an archival location. 133 </p> 134 </li> 135 </ol> 136 </div> 137 <p> 138 Once you have performed this procedure, you can maintain an 139 active hot backup by repeating steps 2 - 5 as often 140 as is required by your application. 141 </p> 142 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 143 <h3 class="title">Note</h3> 144 <p> 145 If you perform step 1, steps 2-5 must follow in order to 146 ensure consistency of your hot backup. 147 </p> 148 </div> 149 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> 150 <h3 class="title">Note</h3> 151 <p> 152 Rather than use the previous procedure, you can use the <span class="command"><strong>db_hotbackup</strong></span> command line utility 153 to do the same thing. This utility will (optionally) run a checkpoint and then copy all necessary files to a target 154 directory for you. 155 </p> 156 </div> 157 <p> 158 To actually perform a failover, simply: 159 </p> 160 <div class="orderedlist"> 161 <ol type="1"> 162 <li> 163 <p> 164 Shut down all processes which are running against the original environment. 165 </p> 166 </li> 167 <li> 168 <p> 169 If you have an archival copy of the backup environment, you can optionally try copying the remaining 170 log files from the original environment and running catastrophic recovery against that backup 171 environment. Do this <span class="emphasis"><em>only</em></span> if you have a an archival copy of the backup 172 environment. 173 </p> 174 <p> 175 This step can allow you to recover data created or modified in the original environment, but which 176 did not have a chance to be reflected in the hot backup environment. 177 </p> 178 </li> 179 <li> 180 <p> 181 Reopen your environment and databases as normal, but use 182 the backup environment instead of the production 183 environment. 184 </p> 185 </li> 186 </ol> 187 </div> 188 </div> 189 <div class="navfooter"> 190 <hr /> 191 <table width="100%" summary="Navigation footer"> 192 <tr> 193 <td width="40%" align="left"><a accesskey="p" href="architectrecovery.html">Prev</a> </td> 194 <td width="20%" align="center"> 195 <a accesskey="u" href="filemanagement.html">Up</a> 196 </td> 197 <td width="40%" align="right"> <a accesskey="n" href="logfileremoval.html">Next</a></td> 198 </tr> 199 <tr> 200 <td width="40%" align="left" valign="top">Designing Your Application for Recovery </td> 201 <td width="20%" align="center"> 202 <a accesskey="h" href="index.html">Home</a> 203 </td> 204 <td width="40%" align="right" valign="top"> Removing Log Files</td> 205 </tr> 206 </table> 207 </div> 208 </body> 209</html> 210