Search code examples
sql-server-2012sql-agent-jobsql-agent

SQL Agent Job dependency between two Servers


I've two SQL Agent jobs in two different Servers (D01->preload & s01->dwload).

My requirement is to run dwload job in s01 only after preload job in D01 is successfully completed.

preload job runs at 1:00AM and finishes at 7:00AM.

As of now, I've scheduled dwload to run at 8:00AM to avoid conflicts and disable it manually if preload fails for some reason.

My question: How do I create dependency between dwload and preload as they belong to different servers.

enter image description here


Solution

  • You could create a linked server in one of the instances. Here are a couple of links on how to set that up.

    How to Create a Linked Server

    StackOverflow Answer

    Calling Linked Server In Query

    Once you have the linked server set up, you could create one job for both of them. Preload would be step 1 of the job and dwload would be step 2.