[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

sp_start_job - manual vs scheduled

Posted on 2010-09-16
9
Medium Priority
?
722 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 600 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 70

Expert Comment

by:Scott Pletcher
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
 
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 70

Accepted Solution

by:
Scott Pletcher earned 1400 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

872 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