Home >> MSSQL >> MSSQL Server 日常维护计划

MSSQL Server 日常维护计划

  1. 删除 Job 失败

    USE [msdb]
    declare @job_name varchar(100)
    set @job_name = N’test.Subplan_1′

    –删除在计划里面的日志

    delete sysmaintplan_log
    FROM sysmaintplan_subplans AS subplans INNER JOIN
    sysjobs_view AS syjobs ON subplans.job_id = syjobs.job_id INNER JOIN
    sysmaintplan_log ON subplans.subplan_id = sysmaintplan_log.subplan_id
    WHERE (syjobs.name = @job_name)

    –删除子计划

    delete sysmaintplan_subplans
    FROM sysmaintplan_subplans AS subplans INNER JOIN
    sysjobs_view AS syjobs ON subplans.job_id = syjobs.job_id
    WHERE (syjobs.name = @job_name)

    执行清理动作后,即可重新删除计划。


(原文链接 http://ddbiz.com/?p=1411)

留言/有话要说

Copyright © 2012 Dimensions Data Business. All rights reserved.
server process 28.394 seconds.
WP-Backgrounds Lite by InoPlugs Web Design and Juwelier Schönmann 1010 Wien