Using Db Maint
Overview
Db Maint is designed to be easy to use, yet powerful. To work efficiently with
Db Maint, we recommend that you spend a few minutes to learn about basic
terminology before diving into the product.
Job
A job defines certain actions to be performed against one or several databases
(see Database groups). These actions can include:
- Consistency checks (DBCC's)
- Backup
- Reorganization/Defragmentation
- Update Statistics
- And almost anything else, with the support of executing TSQL commands
You can also define that the job should terminate if an error is encountered.
See Jobs for more information.
Task
A task defines what job(s) to run and scheduling for each operation (database
backup, log backup reorganization etc) for the included job(s). A task can
include several jobs.
You have the option to send Email depending on the outcome of the job
(Success, Warning and Fail). And you can also customize the recipient(s) depending on
the outcome (Success, Warning and Fail)
The task is basically a superset of a task/job specified in SQL Enterprise
Manager. Task information is stored in the same table as SQL Enterprise Manager
tasks/jobs, but also in additional Db Maint system tables. You should therefore
not remove a task created with Db Maint from within SQL Enterprise Manager.
See Tasks for more information.
Scheduling
The scheduling is designed to work with SQLExecutive/SQLServerAgent (generally
called SQLServerAgent below), which is a service that (amongst other) can
start execution of an EXE file (CmdExec).
This means that the SQLServerAgent service must be started on your SQL Server
in order for your tasks to be executed.
However, you can also use a 3:rd party scheduler as long as you start
execution of DbM.exe at the schedule as specified in the SQLServerAgent job. In order
to avoid the task also being executed by SQLServerAgent, you can either disable
the task or stop the SQLServerAgent service. To use a 3:rd party scheduler,
look up the task definition (command line) in SQL Enterprise Manager, and use that
command line in the 3:rd party scheduler.
See More about scheduling for more information.
Database Groups
Database Groups lets you create a named group of several databases for which
you want to define similar maintenance routines.
When you create a job, instead of specifying one database, you can specify a
database group. All tasks relating to this group will perform its operations
against all databases in the group.
Similarly, you can, for a Job, specify <all> databases, which quite simply
mean that all databases will be included. This also includes databases that do not
yet exist at the time when the job is created.
Note that msdb is always processed as the last database per Job. This is in
order to include all other databases backup history in the msdb backup.