Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 SQL Server Agent Job Failed

Author  Topic 

BobRoberts
Posting Yak Master

109 Posts

Posted - 2014-07-02 : 11:37:09
I imported a database backup job by inserting rows into sysjobs, sysjobsteps, and sysjobhistory. I got an index error inserting rows into sysjobschedules, so I manually entered the schedule information.

When I run the job, or the job runs as scheduled, the error is:
The job failed. The owner [] of job Hemasphere JobName does not have server access.

When I look at the properties of the job, the Owner box is blank. I've tried putting in everything in the dropdown list into the Owner box, including "sa" and administrative network logins, and they all give the same error.

When I look at the available roles for any SQL login, I don't see any roles pertaining to SQL Server Agent.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-07-02 : 12:35:07
You should not be inserting rows into system tables. Use the system stored procedures instead. And why not just script the original job and run that script on the other server?

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

BobRoberts
Posting Yak Master

109 Posts

Posted - 2014-07-02 : 12:49:05
The original server crashed, and Restore would not let me do a restore of the MSDB because it was of a slightly different version than the one that installed on the new server.


quote:
Originally posted by tkizer

You should not be inserting rows into system tables. Use the system stored procedures instead. And why not just script the original job and run that script on the other server?

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/

Go to Top of Page

BobRoberts
Posting Yak Master

109 Posts

Posted - 2014-07-02 : 13:01:04
I restored the msdb from the original after installation and recreated the backup through the Maintenance Plan wizard. A valuable lesson learned.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-07-02 : 13:07:43
Use the system stored procedures. Never modify data directly in the system tables. That type of stuff was done years and years ago, like in SQL Server 6.5.

Take a look at sp_add_job, sp_add_jobstep, sp_add_jobschedule.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -