SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Replication tracer token dupes query


Replication tracer token dupes query

Author
Message
sqlqueue
sqlqueue
SSC-Enthusiastic
SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)SSC-Enthusiastic (174 reputation)

Group: General Forum Members
Points: 174 Visits: 105
experts , can you help me out to remove duplicates from the below query , i am inserting tracer token every minute and have 2 subscribers ,below query runs fine and gives correct result but as soon as i un-comment the commented columns to bring the required result it gives duplicates...

use distribution
SELECT
--MM.Publisher AS [Publisher Server],
--MI.subscriber AS [Subscriber Server],
--MM.publisher_db AS [Publisher DB],
DATEDIFF(ss, TT.publisher_commit,TH.subscriber_commit) AS [Publisher to Subscriber Latency in Minutes]
--,DATEDIFF(mi, TH.subscriber_commit, (GETDATE())) AS [Realized Subscriber Latency in Minutes]
FROM
MSTracer_tokens TT(NOLOCK)
JOIN MSTracer_history TH(NOLOCK)
ON TT.tracer_id = TH.parent_tracer_id
--JOIN MSreplication_monitordata MM(NOLOCK)
--ON TT.publication_id=MM.publication_id
--AND mm.agent_type = 3
--JOIN MSsubscriber_info MI
--ON MM.publisher=MI.publisher
JOIN (SELECT MAX(tracer_id)s ,publication_id FROM MSTracer_tokens (NOLOCK)
JOIN MSTracer_history(NOLOCK)
ON tracer_id=parent_tracer_id
WHERE
subscriber_commit IS NOT NULL
GROUP BY
publication_id)xyz
ON TT.tracer_id = xyz.s
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search