Sql-server – SQL Job Archival Process Clarifications

availability-groupssql serversql server 2014

I have an archival job in my SQL Server which is part of AOAG. I can see the same job in all replicas which are part of AOAG and it's scheduled at the same time.

It is running at the same time on all servers for around 30 seconds successfully.

Can anyone let me know the logic behind the same job same schedule in all replicas successfully running.

It is connecting through AOAG listener to servers and the first step will be copying a file to another location and running the archival job, on job success the source location will be deleted. This is what I can see in job properties–>steps.

I need to create a new customized archival job.

  • What will be the problem if I create the job with 5 minutes difference in each replica?

  • Will there be any problem if I schedule this job at same time in each replica?

Please advise.

Best Answer

They are meant to do a check on each node to see whether it's the primary or not before continuing to run the rest of the logic but they didn't bother.

It sounds like someone set it up under the belief that it will never interfere with each other concurrently (maybe because it has file locks or something else).

No biggie. If you're redesigning it I would add the primary replica check anyway. The question about 30s to 5m is impossible to say though. It's not going to break the AG but what it does to the software is another question.