question

dmurphy avatar image
dmurphy asked

Return failure on TSQL Maintenance Plan Task

I have an Always On instance with 3 AGs. I want to create a maintenance plan task that runs a tsql task to check if AG is primary and if so returns success and I run updstats task and if not, then returns failure and I will check the next AG and repeat the process for the next AG. I do not want it to fail the job, just the task. My goal is set them up on both servers and the maintenance job will only fail if there is an error and not because the database is read only.
always-onmaintenance-plansscript-task
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Wilfred van Dijk avatar image
Wilfred van Dijk answered
Download the solution from [Ola Hallengren][1] [1]: http://ola.hallengren.com
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.