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