查看阻塞、存储过程、作业

(一)阻塞

select a .cmd, a.*,b .text from master ..sysprocesses a
outer apply sys. dm_exec_sql_text(a .sql_handle) b
where a .spid = 93

(二)存储过程
  select distinct object_name (id) from syscomments where id in
 (select object_id from sys .objects where type ='P' ) and text like'%TableName%'

(三)作业
   select a.job_id ,a. name,b .step_name, b.*,b .last_run_date, b.last_run_time ,
c. next_run_date,c.next_run_time ,b. step_id,b.command ,b. database_name
from    msdb .dbo. sysjobs a
   join msdb.dbo .sysjobsteps b on a. job_id =   b. job_id
   join msdb.dbo .sysjobschedules c on a. job_id  =   c. job_id 
where a .enabled = 1 and charindex( 'P_Engin_MonitorNumStatistics',b. command) >0

posted @ 2015-12-30 13:18  kasauce  阅读(219)  评论(0)    收藏  举报