• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 725
  • Last Modified:

sp_start_job - manual vs scheduled

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
anushahanna
Asked:
anushahanna
  • 3
  • 2
  • 2
  • +2
2 Solutions
 
Willy Van den HoutenNetwork and Security AssistantCommented:
What do you see as a reason on the sheduled taks for not starting ?

Or do you see an Hexadecimal error code ?
0
 
Raja Jegan RSQL Server DBA & ArchitectCommented:
Any error messages when it is failing..

Are you sure the the job is started from the same login
0
 
BrandonGalderisiCommented:
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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Scott PletcherSenior DBACommented:
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
 
BrandonGalderisiCommented:
I'll have to test that one out myself SP!
0
 
anushahannaAuthor Commented:
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
 
BrandonGalderisiCommented:
>> what i found is, it still ran under the job owner and not job starter.

Which is how I believed it would work.
0
 
Scott PletcherSenior DBACommented:
>> 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
 
anushahannaAuthor Commented:
Thanks.
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now