top of page

Agent job

SQL Server updates statistics automatically by default, but you can disable the automatic update and instead rely on a maintenance plan to update statistics when you need greater control over the timing of the update.

When you create a maintenance plan, SQL Server creates a SQL Server Agent job that you can schedule to run at a convenient time.

The maintenance task should be scheduled at a time that interferes least with regular database operations. On the Maintenance Plan designer, click the Subplan Schedule button to open the New Job Schedule dialog box. Here you can specify whether the maintenance plan is a recurring schedule, whether it runs only when SQL Server starts or when the CPU is idle, or one time only.

If you choose the Recurring option, you specify a frequency, and a start and optional end date. If you instead choose the One Time option, you specify the date and time to execute the maintenance plan.

When you save the schedule, a SQL Server Agent job is created and the job executes as a SQL Server Integration Services (SSIS) package.

You can also execute a maintenance plan without waiting for the scheduled SQL ServerAgent job. To do this, expand the Management node, expand the Maintenance Plan node,right click the maintenance plan, and then select Execute. When you use this method, theSSIS package is launched and you can observe the execution status in the Execute Maintenance Plan dialog box.

 

Example 1:

Answer 1:

Example 2:

Answer 2:

bottom of page