您的位置:首页 > 其它

DBA常用脚本

2008-01-09 00:55 232 查看
很高兴在新年伊始,有机会能参加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

会定时更新脚本,大家有空来看的时候帮顶一下,谢谢拉本文出自 “鸟蛋屋” 博客,请务必保留此出处http://kerryyu.blog.51cto.com/176058/58502
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: