2012年1月16日 星期一

select from sp_help_job

--查看job目前執行狀況
select 
 name
,last_run_date as lastdt
,last_run_time as lasttm
,case last_run_outcome
 when 0 then 'Failed.'
 when 1 then 'Succeeded.'
 when 3 then 'Canceled.'
 when 5 then 'Unknown'
 else 'others' end as lastOutcome
,case current_execution_status
 when 1 then 'Executing.'
 when 2 then 'Waiting for thread.'
 when 3 then 'Between retries.'
 when 4 then 'Idle.'
 when 5 then 'Suspended'
 when 7 then 'Performing completion actions.'
 else 'others.' end as currentStatus
from openrowset ('SQLNCLI', 'Database=msdb;Uid=sa;Pwd=xxxx;','set fmtonly off;exec sp_help_job')
where name like '%yourJobName%'




參考database journal 文章Detecting The State of a SQL Server Agent Job的欄位說明

沒有留言:

張貼留言

publish error allowDefinition='MachineToApplication'

一個老舊的aspx web form專案,調了一些功能建置成功,但進行部署時顯示以下錯誤。 在應用程式層級之外使用註冊為 allowDefinition='MachineToApplication' 的區段發生錯誤。錯誤的原因可能是虛擬目錄尚未在 IIS 中設定為...