We had multiple databases and I was assigned task to see the replication error on those sql server instances.
It was very time consuming task to go to replication monitor and find replication error from each and every server.
Then I created following query which will give you the error details and the databases involved in replication activity.
use distribution
It was very time consuming task to go to replication monitor and find replication error from each and every server.
Then I created following query which will give you the error details and the databases involved in replication activity.
use distribution
select msrepl_errors.time,error_code, error_text,msrepl_errors.xact_seqno ,command_id,name , publisher_db,publication,subscriber_db from MSdistribution_history
join msrepl_errors on msrepl_errors.id=MSdistribution_history.error_id
join [MSdistribution_agents] on MSdistribution_history.agent_id = [MSdistribution_agents].id
where
msrepl_errors.time between
DATEADD(hh, -24, getdate())
and GETDATE()
join msrepl_errors on msrepl_errors.id=MSdistribution_history.error_id
join [MSdistribution_agents] on MSdistribution_history.agent_id = [MSdistribution_agents].id
where
msrepl_errors.time between
DATEADD(hh, -24, getdate())
and GETDATE()
This will give error in last 24 hours. You can increase of decrease the value of hours based on you requirement.
No comments:
Post a Comment