天天看點

DBA常用腳本

很高興在新年伊始,有機會能參加IT評選活動,先為自己拉拉票~投我的,沒錯的~

就象自己常說的那句:在SQL中隻有想不到的,沒有做不到的.别扔磚頭啊~哪個扔的

下面就放出一些自己寫的常用的腳本,希望給大家的工作帶來幫助.

有問題的話可以聯系我~順便給大家拜個早年:祝2008年大家能身體健康,合家安泰~

謝謝大家的鼓勵.

在SQL2000中禁用的作業大家盡量不要啟用了~因為下面腳本enable設定為1了~

-----------檢查作業的腳本------

------------kerryyu-----------------

create procedure day_job_check

as

select distinct a.name as '作業 名稱',

       case                 --會員等級  對應  tbl_infotype 和 tbl_subinfotype

          when b.last_run_outcome = 0 then '失敗'   

          when b.last_run_outcome = 2 then '取消'   

       else

          '其他'

       end as '作業 次運作 結果',

       a.description as '對作業 描述',

       b.last_outcome_message as '消息', b.last_run_date

as ' 次運作作業 日期', FLOOR(b.last_run_time / 3/600) as '小時',

       FLOOR((b.last_run_time - FLOOR(b.last_run_time / 3600) * 3600) / 60) as '分鐘', (b.last_run_duration/60) as '作業運作 持續時間--分鐘'

from msdb.dbo.sysjobs a, msdb.dbo.sysjobservers b  where   b.job_id = a.job_id and a.enabled = 1

and floor(b.last_run_time/60)>600

會定時更新腳本,大家有空來看的時候幫頂一下,謝謝拉

上一篇: DBA的職責
下一篇: 運維DBA