ManagingHighAvailability•Chapter6 197
Although there is no performance benefit when using this RAID level, the data
is fully protected since if either hard drive fails the data is still available by
the use of the hard drive that has not failed. This is one of the most expensive
RAID options available to you because you are paying for two hard drives
and only getting the space and speed of one hard drive. When the failed hard
drive is replaced all the data is copied from the working hard drive to the new
hard drive.
RAID 5 is the most common RAID level in use. It provides the best of both
RAID 0 and RAID 1, but at a lower cost per gigabyte. A RAID 5 array requires
at least three hard drives. RAID 5 writes data to all the disks except for one. The last
disk is used to store parity information for the data on the other disks in the array.
This allows the system to continue to function in the event of a disk failure. It also
allows the system to re-create the missing information once the failed hard drive is
replaced. Because this parity data must be calculated for each write operation the
writes to a RAID 5 array will be slower than some of the other RAID levels that
are available.
RAID 6 is a new RAID level that is really starting to show itself in the
database world. A RAID 6 array requires at least four hard drives. RAID 6 is
very similar to RAID 5, except that it uses two separate parity drives. This allows
the RAID array to survive two different disk failures without running the risk of
losing any data on the array. Like the RAID 5, array a RAID 6 array will be
slower than some of the other RAID levels that are available because of this parity
calculation.
RAID 10 is the highest performing, highest redundancy, most expensive RAID
solution that is available to you. A RAID 10 array requires at least four hard drives.
A RAID 10 array is in essence two RAID 0 arrays for performance that are then
mirrored together for redundancy. Because of the mirroring that is being done this
is the most expensive RAID level available per gigabyte. Because of this cost many
people will prefer to use RAID 5 or RAID 6.
Ex a m Wa r n i n g
Microsoft has started putting RAID questions on the exams. A basic
understanding of the RAID levels is key to passing those questions.
When dealing with the storage for many of the high-availability solutions,
we will be looking at a high-end storage solutions such as a SAN. Some of these
198 Chapter6•ManagingHighAvailability
solutions require these high-end storage solutions. When using these high-end
solutions keep in mind that your hard drives could be sharing the physical
spindles on the SAN with other systems in your environment. When you are
troubleshooting systems using these SAN solutions, make sure that you know
what else is using the hard drives, even if it not a SQL Server. If you have a file
server on the same spindles as a SQL Server, that can be fine, unless the file
server is defragging the hard drive, in which case the disks will perform poorly
without no indication on the SQL Server as to the problem.
When selecting the hardware for your backup server, you can usually cut a few
corners to save a couple of bucks. The goal of your backup server is to run the
system. It doesn’t have to run it at the same speed as your production environment
does, it just needs to keep it running while the primary or active system is being
repaired or rebooted. As an example, if your system runs fine on two processors but
runs great on eight, get a two-processor server for the backup machine. This will
help keep the costs of the backup server a bit more reasonable.
The licensing costs are different for each technique that we will be discussing;
therefore the license ramifications will be covered in each section throughout this
chapter.
SQL High-Availability Options
There are many different high-availability options that are available to you as a
production database administrator. Each of these various options has its strong
points and its weak points, and in addition to knowing how to use each method, it
is very important that you know when each method should be used.
Log Shipping
SQL log shipping is a tried-and-true method of keeping your SQL Server online.
Microsoft has supported log shipping within SQL Server since at least SQL Server
2000. By using standard T/SQL backup and restore commands you could have set up
log shipping back in the SQL 7 and prior days.
Log shipping (also known as transaction log shipping) is the process by which
you take a full backup of your database and restore it to the destination machine.
You then back up the transaction log every few minutes (usually between 5 and
15 minutes) and then copy the log backup to the remote machine. After the file has
been copied you then restore the transaction log to the remote machine or
machines, rolling forward any transactions that are in the transaction log. This gets
you an exact duplicate of the primary database.
ManagingHighAvailability•Chapter6 199
Log shipping does not require special hardware, nor does it require that the
backup server be configured like the production server. However it does make it
much easier when the two servers are using like hardware, and most specifically
when the hard drives are laid out exactly the same.
SQL Server 2008 includes log shipping in all the Editions of SQL Server that
you have to pay for—in other words, Web, Workgroup, Standard, and Enterprise
Editions. This is a big change from SQL Server 2000 when log shipping was an
Enterprise-only feature.
TE s T Da y Tip
Unless a question specifically mentions the Edition of SQL Server that
you are using, licensing or features that are missing between editions
are not going to be the answer. Unless stated otherwise you can usually
assume that you have the Enterprise Edition of all products involved in
the question.
To begin log shipping, connect to the server you wish to be the source of the
log shipping in the Object Explorer. Right-click the database to bring up the
context menu and select Tasks, then Ship Transactions Logs as shown in
Figure 6.1. You can also get to this Transaction Log Shipping menu by selecting
Properties from the first context menu.
200 Chapter6•ManagingHighAvailability
On the screen that appears, check the check box at the top of the window that
says Enable this as a primary database in a log shipping configuration. This
will enable the Backup Settings button. Click this button and specify the two
paths listed, as well as file deletion settings. These folders must exist before you can
click OK on the main settings page. Keep in mind that SQL will delete these log
files even if they have not been restored to the backup server so don’t set them too
short. The backup job name will be the name of the SQL Agent job with which
the backups are taken. In the example shown in Figure 6.2 the backups will be
made to the C drive of the SQL1 server, which is the primary server. The backups
will be kept for 72 hours with an alarm raised if no backup is taken within an hour.
You can enable backup compression on the transaction log backups; however this
usually is not needed unless your backup server is across a WAN.
TE s T Da y Tip
The exams are designed to make sure that you know the official way to
perform tasks, which is not always the quickest or easiest way. This is a
key distinction that you should be aware of when you are taking the
exams.
Figure 6.1 Database Context Menu
ManagingHighAvailability•Chapter6 201
After you complete the backup settings, you can tell the database server to
which Instances you want to ship the logs. Single-click the Add button in the
middle of the window, then click Connect on the new window. On the first of
three tabs on this window you can tell SQL Server if you want SQL to handle the
full backup automatically, use an existing full backup, or whether you have manu-
ally restored the full backup. On the second tab you give SQL Server the folder on
the backup server to which you wish to have it copy the files. You also give it the
name of the SQL Agent job that will copy the files from the primary system to
the backup system. On the third tab you tell SQL Server which state to leave the
database in—No Recovery or Standby. You can also tell it how long to wait before
restoring a log file, and when to raise an alert if no log has been restored. You also
name the restore job that the SQL Server Agent will run. After clicking OK you
are taken back to the Log Shipping page of the database properties as shown in
Figure 6.3.
Figure 6.2 Transaction Log Backup Settings