Maintenance plan, that is, in SQL Server we can set a time rule, such as regular to back up data, like a timer, and timer similar concept, I understand, such as you want to execute an SQL statement, in a table, some data is temporary data, To clean up these temporary data every day, we can build a maintenance plan to do it.
First open SQL Server Management Studio, find the management directory, there is a maintenance plan:
Then right-create a new maintenance plan:
After the creation is complete:
Click the similar Calendar button to pop up the specific execution time rule:
We can set the time rules for execution, which can be set on a daily or weekly basis, depending on the situation. After the setting is complete, we can select the View-Toolbox in the menu bar and set the Toolbox out.
For example, we need to execute a SQL statement, and then we choose to execute the T-SQL statement task directly into the view of the scheduled task, with the following effect:
We can right-edit and write the SQL statement we want to execute:
Edit the SQL statement you want to execute, ctrl+s save, so build good one scheduled execution of the SQL statement task schedule. In addition, we can create a new job and pull the job into the maintenance plan after the new job is completed.
SQL Server Agent-Jobs
New job:
Steps:
New command:
You can select a database
Write the SQL statement you want to execute, click OK, and the job is created. Then you can pull a job into the maintenance plan:
Pull into Design view:
Modify Job Task-click Edit-Select the job that we just added:
Then click Finish to:
This creates a job task for the maintenance plan.
The use of maintenance plans and jobs for SQL essays