info@techdevops.com | 437-991-3573 | Data Engineering Services
TechDevOps.com
Resources Tools
Experts in Microsoft SQL Server on Windows, Linux, Containers | Clusters, Always On, FCI | Migrations, Cloud, Performance



View Microsoft SQL Server Replication Errors
by BF (Principal Consultant; Architecture; Engineering)
2015-08-12







Query:

SELECT
t1.time,
t3.publisher_db,
t3.publication,
t3.name as 'Distribution Agent',
t3.subscriber_db,
t1.error_text
FROM
MSrepl_errors t1
INNER JOIN MSdistribution_history t2 ON t1.id = t2.error_id
INNER JOIN MSdistribution_agents t3 ON t3.id = t2.agent_id
ORDER BY
t1.time DESC



UPDATED:

Select * from Distribution.dbo.MSrepl_errors where [Time] > dateadd(hh,-24,getdate()) order by [time] asc

Select * from Distribution.dbo.MSdistribution_history where [Time] > dateadd(hh,-24,getdate())
and error_id <> 0 order by [Time] asc

SELECT publisher.name,MSda.publication,MSda.publisher_db,subscriber.name,MSda.subscriber_db,MSre.error_code,MSre.error_text
FROM MSdistribution_history MSdh
INNER JOIN MSdistribution_agents MSda ON MSdh.agent_id = MSda.id
INNER JOIN MSrepl_errors MSre ON MSdh.error_id = MSre.id
INNER JOIN master.sys.servers publisher ON MSda.publisher_id = publisher.server_id
INNER JOIN master.sys.servers subscriber ON MSda.subscriber_id = subscriber.server_id
WHERE MSdh.error_id <> 0
and MSre.Time > dateadd(hh,-24,getdate())
order by MSre.Time asc



Resources:


Replication Tables

Replication Views

Troubleshooting (Replication)

Troubleshooting Tools (Replication)

Replication Stored Procedures (Troubleshooting)

Errors and Events Reference (Replication)