从SharePoint_Config.dbo.TimerJobHistory删除历史记录的计时器作业不起作用

时间:2014-11-25 19:47:11

标签: sharepoint-2010

数据库SharePoint_Config越来越大,现在它已经达到16 GB。我在Power Shell中运行了这个命令SPTimerJob job-delete-job-history,它给了我这个输出:

Name                 Schedule             Last Run
----                 --------             --------
job-delete-job-hi... weekly at sun 05:... 20.11.2011 05:00:00

我现在想要运行这个工作,我尝试了这个命令,但没有任何反应。没有输出,没有错误。

Get-SPTimerJob job-delete-job-history | Start-SPTimerJob

我需要帮助来清除表SharePoint_Config.dbo.TimerJobHistory

中的数据

1 个答案:

答案 0 :(得分:0)

由于CA [删除作业历史记录]计时器作业未按周执行,因此SP Config DB [TimerJobHistory]表可能会膨胀;您可以检查上次在CA中运行的作业定义,[删除作业历史记录]。如果超过一周没有执行[删除作业历史记录]计时器作业,则需要考虑手动执行计时器作业。

如果[删除作业历史记录]计时器作业尚未运行一段时间,则需要小心,因为执行作业将尝试从[TimerJobHistory]表中清除旧数据,这将导致SP Config DB TLog文件随着交易被清除而增长。

这是我用来从[TimerJobHistory]表中逐步清除旧数据的方法,同时还在执行[删除作业历史记录]计时器作业之间监视和收缩SP Config DB TLog文件。

# Execute [Delete Job History] Timer Job
# Job Title: Delete Job History
# Job Description: Deletes old entries from the timer job history.
# Recurring Schedule: Weekly, Sunday @ 05:00

$job = Get-SPTimerJob | Where-Object {$_.name -eq "job-delete-job-history"}
# If this Timer Job has not been executed on a regular basis (weekly), then the 
# dbo.TimerJobHistory table will have a larger then normal amount of stored rows 
# which need to be purged. In which case, execution of this Timer Job will cause 
# the SP Config DB Transaction Log file to grow as this TimerJob is active.
# In this case, set the DaysToKeepHistory Property to a high value and execute 
# the Timer Job repeatedly gradually decreasing the DaysToKeepHistory Property 
# value until you reach the 7 days default value.
#$job.DaysToKeepHistory = 365 # The default value is 7
#$job.Update()
$job.RunNow()
相关问题