The use of maintenance plans and jobs for SQL essays

Source: Internet
Author: User
Tags management studio sql server management sql server management studio

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.