Databases Reference
In-Depth Information
@freq_type = 4,
@active_start_date = 20020812,
@active_start_time = 10000,
@freq_interval = 1,
@freq_subday_type = 4,
@freq_subday_interval = 10,
@freq_relative_interval = 0,
@freq_recurrence_factor = 0,
@active_end_date = 99991231,
@active_end_time = 235959
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
-- Add the Target Servers
EXECUTE @ReturnCode = msdb.dbo.sp_add_jobserver
@job_id = @JobID,
@server_name = N'(local)'
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
In this example, you would monitor all usage of sp_add_jobserver,
sp_add_jobstep, sp_add_jobschedule, and sp_add_job.
The other option is to watch and audit the jobs scheduled within the
database. As in the previous section, you can do this manually using the
database tools. Figure 9.11 shows a user-defined job in the DB2 Task Cen-
ter (within the Control Center) and one within the SQL Server Enterprise
Manager. This task, however, becomes tedious, and you would do better to
automate it by periodically listing all active jobs scheduled within the data-
base and comparing this list with your baseline to see whether any changes
have been made.
Finally, remember that in some environments the scheduler will be the
operating system rather than the database. This is especially true in data-
bases where the authentication model is based on the operating system. For
example, scheduling of jobs that need to run within DB2 on UNIX and
Figure 9.11
Reviewing
scheduled jobs
using the DB2
Control Center and
the SQL Server
Enterprise
Manager.
Search WWH ::




Custom Search