Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with.
    
        
            
                
                    
                        
                            
                                | Author | 
                                
                                 Topic  | 
                             
                            
                                    | 
                                         santu4bth 
                                        Starting Member 
                                         
                                        
                                        5 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2011-04-16 : 12:49:21
                                            
  | 
                                             
                                            
                                            | Friends,I have to find out the long running queries in my servers and I need to send alerts through Email whnever there are slow queries running.Can anyone tell me step by step information how to perform ths task? Thanks,santosh v | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     tkizer 
                                    Almighty SQL Goddess 
                                     
                                    
                                    38200 Posts  | 
                                    
                                      
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     santu4bth 
                                    Starting Member 
                                     
                                    
                                    5 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2011-04-16 : 19:30:05
                                          
  | 
                                         
                                        
                                          | I want to find the queries running more than 1000ms.Can you provide a script to identify long running queries instead of using a profiler?I heard xp_sendmail can be used in script to send emails?  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     tkizer 
                                    Almighty SQL Goddess 
                                     
                                    
                                    38200 Posts  | 
                                    
                                      
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     dinakar 
                                    Master Smack Fu Yak Hacker 
                                     
                                    
                                    2507 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2011-04-18 : 15:53:14
                                          
  | 
                                         
                                        
                                          | Like Tara said its not exactly an easy task...Have server side traces set up.. have another job pick up those trace files from a shared path and load the data into another SQL instance, create a job on that instance running every few minutes or so and reading the data loaded from the trace files and send you/whoever an email if it finds queries taking longer than 1000ms.Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |