Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SQL Server Jobs

Posted on 2009-05-20
1
Medium Priority
?
221 Views
Last Modified: 2012-05-07
Hi All,

I have two jobs job1 one server1 and job2 on server2. Both are running fine but I want to setup one job so that once the job1 on server1 is done, job2 on server2 is the next step and if everything failes I send an email saying one of the step has failed.

Thanks in advance for your help.

Cheers.
0
Comment
Question by:matrix_aash
1 Comment
 
LVL 8

Accepted Solution

by:
tpi007 earned 2000 total points
ID: 24430001
You can do following:
  • Database Mail set up on both servers
  • Add linked server on server1 to server2
  • Add last step on server1 job as following
    • EXEC [server2].msdb.dbo.sp_start_job N'YourJobName'
    • Should have notification for email attched to job for 'When Job Completes' for info on server1 job
  • Add notification email to job on server2 as for 'When Job Completes'
    • Will provide info on server2 job  
I always have mail alerts set for when job completes so that you do not assume everything is good if your email system fails.
 

--Assumes your linked server name is server2
-- Replace 'YourJobName'  with valid job name
EXEC [server2].msdb.dbo.sp_start_job N'YourJobName' 

Open in new window

0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question