Pages

Tuesday, January 15, 2013

Replication health and error

The script below is used to check the replication error.

 use distribution;  
 go  

 select   
    case   
       when COUNT(*)>0 then 'there are error for replication during the last half hour'  
       else 'no error found'  
    end  
 from msrepl_errors   
 where [time] > DATEADD(MINUTE, -30, GETDATE())  
 go  

 declare @errorCount int  
 select @errorCount = COUNT(*) from MSrepl_errors  
 if @errorCount <> 0   
    begin  
       select top 2000 * from MSrepl_errors order by time desc  
    end  
 else  
    select 'NO ERROR'  

No comments: