Share via


Job failed. The target database ('XXX') is in an availability group and is currently accessible for connections when the application intent is set to read only.

Question

Thursday, June 25, 2020 4:15 AM

Hi,

One of my job is failed and error is

Executed as user: yyy. The target database ('xxx') 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 know when connecting through SSMS can use application intent = read only, but How to set application intent = read only to the sql server agent jobs?

Naresh

All replies (4)

Thursday, June 25, 2020 5:54 AM âś…Answered

meaning you should not run this job against a secondary database. Either recreate the job on primary replica or add logic to determine the current status of the database.


Thursday, June 25, 2020 5:33 AM

How to set application intent = read only to the sql server agent jobs?

You can not, jobs run on that SQL Server instance related to the agent.

Olaf Helper

[ Blog] [ Xing] [ MVP]


Thursday, June 25, 2020 5:35 AM

means there is no solution for this?

Naresh


Thursday, June 25, 2020 6:49 AM

Solution:Failover it as Primary.