High Availability - Job error

  • Hi,

    I am trying to create a job that runs against my High Availability listener server.

    It is a fairly simple SQL statement in the job - execute tsql.

    When I try and run the job I get the error:

    Executed as user: NT SERVICE\SQLAgent$SQL2014A. The target database ('BB_Prod') is in an availability group and is currently accessible for connections when the application intent is set to read only. For more information about application intent, see SQL Server Books Online. [SQLSTATE 42000] (Error 978). The step failed.

    I thought there was a way to run a select statement as a job against the listener? The tsql step is only a select.

    Is there a way to pass in the application intent = readonly as part of my SQL statement?

  • I don't think you can add the App Intent to the connection from the Agent job. However, if you change the Readable Secondary option to "Yes" rather than "Read-intent only" in the AG properties, it should work fine.

    -----
    JL

  • krypto69 (8/18/2015)


    Hi,

    I am trying to create a job that runs against my High Availability listener server.

    It is a fairly simple SQL statement in the job - execute tsql.

    When I try and run the job I get the error:

    Executed as user: NT SERVICE\SQLAgent$SQL2014A. The target database ('BB_Prod') is in an availability group and is currently accessible for connections when the application intent is set to read only. For more information about application intent, see SQL Server Books Online. [SQLSTATE 42000] (Error 978). The step failed.

    I thought there was a way to run a select statement as a job against the listener? The tsql step is only a select.

    Is there a way to pass in the application intent = readonly as part of my SQL statement?

    Have you setup the read only routing within the AlwaysOn group?

    What is the secondary role state for the secondary databases?

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

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

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