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