查詢 SQL Job 執行的狀況

exec sp_configure ‘show advanced options’,1
reconfigure

exec sp_configure ‘Ad Hoc Distributed Queries’,1

reconfigure

go

SELECT * INTO #job

FROM OPENROWSET(‘sqloledb’, ‘server=(local);trusted_connection=yes’

, ‘set fmtonly off exec msdb.dbo.sp_help_job’)

SELECT * FROM #job where current_execution_status <> 4

drop table #job

 

sp_help_job 的回傳內容如線上說明,可以透過 where 條件查詢所需的 Job 資訊

http://msdn.microsoft.com/zh-tw/library/ms186722.aspx

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s

%d 位部落客按了讚: