注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 科普系列之-使用Windows的..
 帮助

DBA常用脚本


2008-01-09 00:55:41
 标签:脚本 DBA 精华   [推送到技术圈]

版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://kerryyu.blog.51cto.com/176058/58502
很高兴在新年伊始,有机会能参加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





    文章评论
 
2008-01-09 09:46:58
一定要支持一下

 

发表评论

昵   称:
验证码:  点击图片可刷新验证码  博客过2级,无需填写验证码
内   容: