Configuring the Back Up Database Full Task The Define Back Up Database Full Task screen, shown in Figure 12.1, is more complex than most of the Maintenance Plan Wizard screens we have
Trang 1For the typical database, using one of the above strategies will allow you to perform full backups nightly If your database is so large that neither of these two options will work, then you probably shouldn't be using the Maintenance Plan Wizard to perform your backups Backing up large databases (100 GB or more), often requires more sophisticated backup strategies, which are best handled using third-party tools, T-SQL or PowerShell scripts
If your databases are large, and if scripting and third-party tools are not an option, then you may need to consider running full backups less frequently, and performing differential backups (covered in the next chapter) on the days in between
Configuring the Back Up Database
(Full) Task
The Define Back Up Database (Full) Task screen, shown in Figure 12.1, is more complex than
most of the Maintenance Plan Wizard screens we have seen up to this point
The first thing I want to point out is that the Backup type drop-down, at the very top of
the screen, contains the value Full, and is grayed out That's because we are on the Back Up Database (Full) task, and the Wizard is smart enough to complete the option for us
Database and Backup Component Selection
The next option is the Database(s) drop-down box that we've seen many times before, and
which you use to select the databases that you want to subject to full backups In previous chapters, we've often seen Object and Selection options presented here, allowing us to
narrow the scope of a given task to defined objects within the database
In essence, the Backup component options, below the Database(s) box (both of which
are currently grayed out) offer a comparable service for backups When these options are not grayed out (more on this shortly) you can either select Database to back up the whole
database, which you will almost always want to do, or you can select Files and filegroups to
back up only specific files or filegroups within that database
Trang 2Figure 12.1: This is the most complex screen of the Maintenance Plan Wizard we have
seen so far.
Trang 3Let's take a look at this in a little more detail In order to be consistent with the previous tasks, we would normally want select All user databases However, in order to demonstrate
the next feature of this task, let's instead select a single database, AdventureWorks, as shown
in Figure 12.2, and click on OK.
Figure 12.2: The two options under "Backup component" will only be available if you
select a single database
Now, under Backup component, you'll see that Database is available and selected, but Files and filegroups is grayed out, as shown in Figure 12.3 This means that the whole database
will be backed up If we had not selected a single database, then both Database and Files and filegroups would still be grayed out This is because these two options only work if a single
database has been selected
Figure 12.3: You have two choices, either to perform a full backup or, if a database has
multiple files or file groups, to back up only a portion of the database.
Trang 4The Files and filegroups option only becomes available if a single database is selected and is
composed of multiple files or filegroups, which AdventureWorks is not However, if it were,
you'd be able to select that option, and so choose to only perform a full backup of specific files or filegroups, selected using the browse button This option is sometimes useful for large databases but I would say that, if your databases have multiple files or filegroups, then you should probably not be being using the Maintenance Plan Wizard for this task Sure, it will do
it for you, but if you are at that level of database complexity, you should really be using T-SQL
or PowerShell scripts to perform this task
Now, let's get back to the practical use of the Maintenance Plan Wizard Go back and choose our usual option of All user databases, as shown in Figure 12.4 At this point, both of the Backup component options are grayed out, so we'll automatically be performing full backups
of the whole of each of the user databases
Figure 12.4: When you choose two or more databases to back up, the two "Backup
component" options will not be available.
The next available option on the screen is Backup set will expire It is not selected by default,
and the two options below it are grayed out, as shown in Figure 12.5
Figure 12.5: Assuming you create backups sets, you can choose when they expire.
Trang 5This option determines when a backup set can be overwritten, and it is designed for people who back up their databases directly to tape Virtually nobody backs up a SQL Server database directly to tape any more, so you will not need to select this option
The next option is Back up to, where you can choose between backing up to disk, or to a
directly attached tape drive, as shown in Figure 12.6
Figure 12.6: You will always choose Disk.
As discussed, the only real option is to back up to disk, so leave this option set to Disk.
Don't back up directly to tape
SQL Server supports the option to directly back up a database to a direct attached tape drive (the tape drive is physically attached to the SQL Server), but this option is virtually never used Why? Backing up to a tape drive directly from a single server is expensive (you need a tape drive for every server), difficult to administer, unreliable, and slow Today, virtually all databases are backed up to disk first, then either stored on a SAN, NAS, in centralized tape library or, in some cases, Internet backup services.
Backup File Storage
In some ways, the next section of the screen, shown in Figure 12.7, forms the heart of the backup task, since it allows us to define how and where the backup files are stored
Let's look at each option in turn
Backup databases across one or more files
If you choose this option, you can either back up to a backup device, which is a pre-created
file that can hold one or more backups, or create striped backups, which allow you to
perform a backup of a database on two or more physical files at the same time
Backup devices are a holdover from previous versions of SQL Server and are no longer used much by DBAs They are hard to work with and don't offer many advantages over standard backup files, which we will discuss in the next section