sp_MSadd_logreader_history Availability groups

  • Hello,

    This last weekend was patch night.  During the patching, we failed over an AG.

    Then we started receiving this error.

    Replication-Replication Transaction-Log Reader Subsystem: agent Server-MyDatabase-6 failed. The target database, 'MyDatabase', is participating in an availability group and is currently not accessible for queries. Either data movement is suspended or the availability replica is not enabled for read access.

    The job that failed is using this code:

     

    sp_MSadd_logreader_history @perfmon_increment = 0, @agent_id = 5, @runstatus = 1,

    @comments = N'Starting agent.'

     

    Is there a better way to handle this job for availability groups rather than have the jobs on both replicas?  We stopped one job and started job on the other server after a failover.

    Can this be pointed to the listener?

     

    Thanks.

    Things will work out.  Get back up, change some parameters and recode.

  • Hi,

    just add 1 step in your job, where you can check, if your node is currently the active node.

    If so, just execute step nr.2, otherwise, quit the job.

    Good luck,

    Kind regards,

    Andreas

  • That is a good idea.  I can do that.  Thanks.

    Things will work out.  Get back up, change some parameters and recode.

  • I prefer wrapping the code in a check for primary - instead of adding a step.  When you add a step and fail - you also have to set that step so it quits with a success message on the step failure.  The end result is the job doesn't fail but it also doesn't show up as successful - it shows up with a warning in the job history.

    You should also setup a master/target agent where you create and manage jobs for the cluster.  It makes it much easier to manage your jobs so that they are pushed to every node in the AG cluster and any changes to the job can be pushed to each target automatically.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

Viewing 4 posts - 1 through 3 (of 3 total)

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