How To Check Replication Status In SQL SERVER 2000 And RUN IF Stopped

  • How To Check Transactional Replication Status In SQL SERVER 2000 And RUN IF Stopped Using A Code In VB

  • Jay

    It doesn't use VB, but here's how I'd do it:

    (1) Find the job under SQL Server Agent that starts your replication agent.

    (2) Create a new job that does exactly the same.

    (3) Click on the Schedule tab on click on New Alert.

    (4) Choose SQL Server:Replication Agents as your object

    (5) Choose LogReader or Distribution (as appropriate) as your instance

    (6) Verify that Alert if counter says "falls below" and enter the number of LogReader or Distribution (as appropriate) agents you have running

    Beware, though, this will attempt to restart replication even if you have stopped it deliberately.  Make sure you disable the job first in such circumstances.

    John

  • John Thanks

    But Still I Would Like To Do It From VB.

  • hi,

    in this table, MSpublications,  you can get information abaout your replication.

    In the book online alredy information about this.

     

    TIA

    Abel.

  • One can write a simple SQL to get the status using the following tables from distribution database and call it in VB

    MSMERGE_HISTORY & msmerge_agents .

    The column runstatus will give you the status of the replication.

    We have used this internally part of our replication monitoring process and this works fine

    rangark.

  • Can you share this simple SQL you are using for monitoring?

    Also, is there an easy way to script re-starting the merge agents when they die? I have a merge agent that dies and dies and dies.

    thanks

  • --Here is the basic query

    select publisher_db,max(time),a.agent_id

    from distribution..msmerge_history a, distribution..msmerge_agents b

    where a.agent_id=b.id

    group by publisher_db,a.agent_id

    --For the above  agentid from the basic query, obtain the CURRENT_STATUS

    --from distribution..msmerge_history table .

     

    rangark.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply