Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Program to Determine If Merge Agent is Active

Author  Topic 

jbates99
Constraint Violating Yak Guru

396 Posts

Posted - 2003-07-19 : 23:29:08
Hi SQL Server admins,

I'm a developer, not an admin. I want to write a VB or ASP app that will display lots of various info about my servers.

My question for this forum is.. how can I determine if replication (the merge agent) is running on my server? (Right now, I open Enterprise Manager and look for the red X in the Replication folder.)

Is there a table or ? that my program can read to determine whether replication is active or has failed?
... and maybe T-SQL is a better method than VB?

Thanks for your suggestions. John


Stoad
Freaky Yak Linguist

1983 Posts

Posted - 2003-07-21 : 07:36:32
Maybe just check out whether or not replmerg.exe is in
the list of currently running processes on the host machine??

- Vit
Go to Top of Page

Stoad
Freaky Yak Linguist

1983 Posts

Posted - 2003-07-28 : 06:21:30
Sorry for my previous silly reply. This new one seems much better:

Dim s As New SQLDMO.SQLServer, d As SQLDMO.Distributor
Dim st As Long, ts As String
s.Connect "(Distributor)", "sa", ""
Set d = s.Replication.Distributor

MsgBox d.DistributorAvailable

Call d.GetAgentsStatus(SQLDMOReplAgent_Merge, st, ts)

MsgBox st ' get current status

'SQLDMOTask_Pending = 0
'SQLDMOTask_Starting = 1
'SQLDMOTask_Succeeded = 2
'SQLDMOTask_Running = 3
'SQLDMOTask_Idle = 4
'SQLDMOTask_Retry = 5
'SQLDMOTask_Failed = 6

s.Disconnect
Set d = Nothing
Set s = Nothing

- Vit
Go to Top of Page
   

- Advertisement -