Solved

sp_start_job - manual vs scheduled

Posted on 2010-09-16
9
711 Views
Last Modified: 2012-06-21
when you start a job manually, sometimes it works, but fails when scheduled- what could be the reasons for that? how does it look for permissions differently?

thanks
0
Comment
Question by:anushahanna
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 3

Expert Comment

by:Willy Van den Houten
ID: 33692049
What do you see as a reason on the sheduled taks for not starting ?

Or do you see an Hexadecimal error code ?
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 33692165
Any error messages when it is failing..

Are you sure the the job is started from the same login
0
 
LVL 39

Assisted Solution

by:BrandonGalderisi
BrandonGalderisi earned 150 total points
ID: 33692479
A job starting via sp_start_job or via a schedule has no difference.  It is not permissions related because sp_start_job calls the SQL Agent service to start the job.  It would be no different than if the schedule were telling it to run at that time.  You have something else going on.
0
 
LVL 69

Expert Comment

by:ScottPletcher
ID: 33693100
I'm fairly sure the job is run under different authority if you start it vs. scheduler starting it.

Specifically, if you schedule a job, and the job owner has sysadmin authority, I think the job runs under the SQL Server Agent account, *not* as the actual job owner.

If you start the job yourself, it runs as the job starter.  I think :-) .
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 33693365
I'll have to test that one out myself SP!
0
 
LVL 6

Author Comment

by:anushahanna
ID: 33694220
i believe what Scott says is what i saw.. but i am not able to reproduce it right now.. will fail if run manually, and pass if  maybe it is a data issue that i faced..

SCott, I just tested what you said..

*if you schedule a job, and the job owner has sysadmin authority, I think the job runs under the SQL Server Agent account, *not* as the actual job owner.

this is right

*If you start the job yourself, it runs as the job starter.

what i found is, it still ran under the job owner and not job starter.
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 33695201
>> what i found is, it still ran under the job owner and not job starter.

Which is how I believed it would work.
0
 
LVL 69

Accepted Solution

by:
ScottPletcher earned 350 total points
ID: 33696798
>> what i found is, it still ran under the job owner and not job starter. <<

Yes, sorry, for sp_start_job that is probably right.

If you right-click on the job and start it, it should run as the person starting it.


Either way, that is still different from the way a scheduled job starts, if the job owner has sysadmin authority.
0
 
LVL 6

Author Comment

by:anushahanna
ID: 33762853
Thanks.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL 2008 SSIS import 11 49
Nested cursor  in SQL 9 94
Does SharePoint 2016 using SQL 2016 function correctly with Workflow Manager? 2 15
SQL Select Statement 2 20
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

929 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now