The actual process of performing a backup presents as many options as the underlying concepts present.
Backup Destination
A backup may copy the data to one of two possible destinations:
- Disk subsystem: You can perform a backup either to a local
disk (preferably not the same disk subsystem as the database files) or
to another server's disk drive by using the Universal Naming Convention
(UNC). The SQL Server service account must have write privileges to the
remote drive/share to save the backup file.
Best Practice
You should back up the databases to a
local disk (not the same disk where databases are stored) and then copy
the backup files to tape or DVD (for small databases) using the
organization's preferred IT backup method. This method is the fastest
for SQL Server, and it enables the IT shop to continue using a familiar
single-tape backup-software technique.
- Tape: SQL Server can back up directly to most tape-backup devices.
Note
Several companies offer a third-party
backup for SQL Server. Although you may find third-party backup useful,
it is a good idea to become familiar with SQL Server's built-in
recovery methods before making the decision to use it.
A disk- or tape-backup file is not limited to a
single backup event. The file may contain multiple backups and multiple
types of backups.
Backup Rotation
If the backup file is copied to tape, then media retention or rotation, and the off-site media-storage location, become important.
A common technique is to rotate a set of five
tapes for the weekly backups and another set of six tapes for the
remaining daily backups. The weekly tapes would be labeled Sunday1,
Sunday2, and so on, and the daily tapes would be labeled Monday,
Tuesday, Wednesday, Thursday, Friday, and Saturday.
Palindromes also represent a great method for rotating backup tapes. A palindrome is a word, phrase, or number that's the same backward or forward, such as “kayak” or “drab as a fool, aloof as a bard.”
Using four tapes labeled A through D, a backup rotation might be ABCDCBA ABCDCBA….
Alternatively, you can implement the palindrome
method so that each letter represents a larger interval, such as A for
daily, B for weekly, C for monthly, and D for quarterly.
Rotating backup tapes off site is an important
aspect of recovery planning. Ideally, a contract should support an
off-site recovery site complete with server and workstations.
Performing Backup with Management Studio
The first backup must be a full
database backup to begin the backup chain. You can perform a database
backup from Management Studio, selecting the database to be backed up.
From the database context menu, or from the database Summary Page,
select Tasks ? Back Up to open the Back Up Database form, as shown in Figure 1.
The backup source is configured in the General page:
- Database: The database to be backed up. By default this is the current database in Management Studio.
- Backup Type: The type of backup — Full, Differential, or
Transaction Log. If the database is set to the simple recovery model,
the transaction log will not be available. For full or differential
backups, the whole database or selected files and filegroups can be
backed up.
- Copy Only Backup: Enables you to copy only the backup. This
backs up all the data without breaking the existing backup chain.
Although this backup type was first introduced in SQL Server 2005,
Management Studio in SQL Server 2005 did not support it.
- Backup Component: The database component to be backed up —
Database or File and Filegroups. If the backup type selected is
Transaction Log, the backup component is grayed out. Database indicates
that the full database is backed up. File and Filegroups indicates that
the specified files and filegroups are backed up.
The rest of the Back Up Database form specifies the destination:
- Name: The required name of the backup.
- Description: Optional additional information about the backup.
- Backup Set Will Expire: SQL Server prevents another backup from overwriting this backup until the expiration date.
- Destination: Sets the destination tape file or disk file. If
the current destination is incorrect, delete it and add the correct
destination.
- Contents: Displays the backups already in the selected destinations.
Figure 2 shows the Options page of the Back Up Database form.
The Options page presents the following options:
- Append to the Existing Backup Set or Overwrite All Existing Backup Sets:
Determines whether the current backup will be added to the backup file
or whether the backup media should be initialized and a new series of
backups placed in them.
- Check Media Set Name and Backup Set Expiration: Verifies the name and expiration date for the backup.
- Verify Backup When Finished: This verifies that the backup
is complete and the file is readable. This option does not compare the
data in the backup with the data in the database, nor does it verify
the integrity of the backup.
- Perform Checksum Before Writing to Media: This verifies that
the data read from the database is consistent with any checksum or
torn-page detection on the database. It also calculates a checksum of
the entire backup and saves it in the backup. This can help ensure that
the database being backed up does not have any corruption due to the
disk subsystem.
- Continue on Error: Enables backup to continue even after it encounters one or more errors.
- Unload the Tape After Backup: Directs the tape to eject, which helps prevent other backups from overwriting the backup file.
- Rewind the Tape Before Unloading: This is enabled only if you unload the tape after backup is selected. This rewinds the tape before ejecting it.
- Truncate the Transaction Log: Backs up the transaction log
and truncates the inactive transactions to free log space. This is the
default option for the Transaction Log backup. This option is available
only when the Transaction Log is selected for Backup Type on the
General page.
- Back up the Tail of the Log, and Leave the Database in the Restoring State: Backs up the transaction log that has not yet been backed up. This option is equivalent to using NO_TRUNCATE or NORECOVERY in the BACKUP statement. This option is available only when the Transaction Log is selected for Backup Type on the General page.
- Set Backup Compression: Enables you to choose the default
server-level backup compression setting or ignore the server-level
default and compress the backup or do not compress the backup. At
installation, the default behavior is no backup compression. You can
change this default by setting the default server-level backup
compression setting in Management Studio by checking the Compress
Backup check box in the Database Settings tab of Server Properties.