Showing posts with label status. Show all posts
Showing posts with label status. Show all posts

Friday, March 23, 2012

Merge Replication Subscriber Status

Hi.

I have setup an SQL Server 2005 Merge Replication.

Now I need to display the status of the replication programatically from the subscriber side, I have checked the documentation which mentions MergeSubscription & MergeSubscriberMonitor but I couldn't know how to use them!!

Any Help ?

Thanks

You can use "replication monitor"

on prompt execute: sqlmonitor.exe, then add your publishers.

http://technet.microsoft.com/en-us/library/ms152520.aspx

|||

In order to display the status on the subscriber, you need to use the RMO components. Of course, I'm assuming that you are using a pull subscription configured such that the merge agent is running on the subscriber so that the data you need is already there. Alternatively, you could use something like the following, which I use to provide a macro level look at each susbscriber's last synch date. This table is added to the publication and replicated to all subscribers, so it can easily be pulled and displayed within an application. The proc is executed as a job on the publisher and assumes that the distributor is on the same machine as the publisher, you'll have to adjust if publisher and distributor are on separate machines.

CREATE TABLE dbo.ReplicationTimestamp(

SubscriberName varchar(50) NOT NULL,

LastReplicationDate datetime NULL,

LastEditDate datetime NOT NULL CONSTRAINT df_replicationtimestamp_editdate DEFAULT (getdate()),

LastEditUser varchar(30) NOT NULL CONSTRAINT df_replicationtimestamp_edituser DEFAULT (suser_sname()),

rowguid uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT df_replicationtimestamp_rowguid DEFAULT (newid()),

CONSTRAINT PK_ReplicationTimestamp PRIMARY KEY CLUSTERED (SubscriberName))

GO

CREATE PROCEDURE dbo.asp_UT_PopulateReplicationTimestamp

AS

UPDATE y

SET y.LastReplicationDate = z.LastSynch,

y.LastEditDate = getdate(),

y.LastEditUser = 'sa'

FROM ReplicationTimeStamp y inner join

(SELECT a.subscriber_name, MAX(b.time) lastsynch

FROM distribution.dbo.msmerge_agents a INNER JOIN distribution.dbo.msmerge_history b ON a.id = b.agent_id

WHERE (comments LIKE 'no data needed%'

OR comments LIKE 'upload%'

OR comments LIKE 'download%')

AND b.error_id = 0

GROUP BY a.subscriber_name, a.id, b.agent_id) z ON y.SubscriberName = replace(z.subscriber_name,'\SQLEXPRESS','')

Merge Replication Status

I'm using sp_replmonitorhelpmergesession to determine the status of
multiple push subscriptions.
When I set the Merge Agent to Slow Link, I get a status of 4 and the
message "No Data needed to be Merged" when there are no changes.
I'd like to get it to return the Status 4 when it's idle, but I want
to increase the polling interval from 60 to 180.
So I copy the Agent Profile "Slow Link" and alter the polling interval
and validation intervals only.
When I copy the slow Link Profile and use the copy, I get a Status of
3 and the message "Waiting xxx second(s) before polling for further
changes."
Where/how are these controlled?
pollinginterval
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Brian Bunin" <BBunin@.SBCGlobal.net> wrote in message
news:1176335136.270222.63650@.n59g2000hsh.googlegro ups.com...
> I'm using sp_replmonitorhelpmergesession to determine the status of
> multiple push subscriptions.
>
> When I set the Merge Agent to Slow Link, I get a status of 4 and the
> message "No Data needed to be Merged" when there are no changes.
> I'd like to get it to return the Status 4 when it's idle, but I want
> to increase the polling interval from 60 to 180.
> So I copy the Agent Profile "Slow Link" and alter the polling interval
> and validation intervals only.
> When I copy the slow Link Profile and use the copy, I get a Status of
> 3 and the message "Waiting xxx second(s) before polling for further
> changes."
> Where/how are these controlled?
>
|||On Apr 12, 8:48 am, "Hilary Cotter" <hilary.cot...@.gmail.com> wrote:
> pollinginterval
> --
> Hilary Cotter
>
Yes, but why does changing that alter the behavior of the Status and
messages?

Merge Replication Status

Hoping someone can help.
What merge system table/s will give me the current status of my merge agent
i.e. the Replication Monitor window in Enterprise Manager displays a status
of 'suceeded' etc etc - where can I source this field from within the
Replication System tables?
Any help appreciated.
this script will get you details of the last history for
the merge agent called 'DH1791628-Northwind-
NorthwindStaff-DH1791628-3'.
It will have basic error info if an error occurs.
If you want the detailed error info, you'll need to join
to the MSrepl_errors table: MSmerge_history.error_id =
MSrepl_errors.id. This table typically has several rows
so you might want to use a cursor to add the text
together.
HTH,
Paul Ibison (SQL Server MVP)
[vbcol=seagreen]
declare @.agent_id int
select @.agent_id = id from msmerge_agents where name
= 'DH1791628-Northwind-NorthwindStaff-DH1791628-3'
select top 1 case
when rh.runstatus = 1 then 'Start'
when rh.runstatus = 2 then 'Succeed'
when rh.runstatus = 3 then 'In progress'
when rh.runstatus = 4 then 'Idle'
when rh.runstatus = 5 then 'Retry'
when rh.runstatus = 6 then 'Fail'
end as RunStatus,
'start_time' = convert(nvarchar(12), start_time, 112) +
substring(convert(nvarchar(24), start_time, 121), 11, 13),
comments
from MSmerge_history rh
order by timestamp desc