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

could not find stored procedure 'sp_add_jobserver'

i need to run a t-sql statement in a maintenance plan. the t-sql is written and functions correctly from query analyzer but i get an error message that i need to specify sp_add_jobserver for it to run in the maintenance plan. when i add this line into query analyzer with teh correct parameters i get the error message Msg 2812, Level 16, State 62, Line 2
Could not find stored procedure 'sp_add_jobserver'.

here is my query:


use master 
exec sp_add_jobserver @job_name = 'DBBackup.DBBackup' , @server_name = 'csvmsql2005'
 
DECLARE @DBName sysname
DECLARE @PrevDBName sysname
DECLARE @sql nvarchar(255)
DECLARE @StartName sysname
DECLARE @EndName sysname
 
SET @StartName = ''
SET @EndName = 'zzzzzzzzzzzzzzzzzzz'
 
SELECT TOP 1 @DBName = name FROM master.dbo.sysdatabases 
WHERE sid <> 0x01 AND name BETWEEN @StartName AND @EndName
ORDER BY name
WHILE @DBName IS NOT NULL
BEGIN
  PRINT 'Processing database ' + @DBName
  IF databasepropertyex(@DBName,'recovery') = 'FULL'
  BEGIN
    Print '  Recovery Mode is ' + convert(varchar,databasepropertyex(@DBName,'recovery')) + '. Setting it to SIMPLE.'
    SET @sql = N'ALTER DATABASE ' + CONVERT(nvarchar,@DBName) + N' SET RECOVERY SIMPLE'
    EXEC sp_executesql @sql
  END
  ELSE
    Print '  Recovery Mode is ' + convert(varchar,databasepropertyex(@DBName,'recovery')) + '.'
  
  SET @PrevDBName = @DBName
  SET @DBName = NULL
  SELECT TOP 1 @DBName = name FROM master.dbo.sysdatabases 
WHERE sid <> 0x01 AND name BETWEEN @StartName AND @EndName
AND name > @PrevDBName 
ORDER BY name
END

Open in new window

0
newimagent
Asked:
newimagent
1 Solution
 
Aneesh RetnakaranDatabase AdministratorCommented:
sp_Add_jobServer  does not exist in master db, it is in msdb


use master
exec msdb.dbo.sp_add_jobserver @job_name = 'DBBackup.DBBackup' , @server_name = 'csvmsql2005'
0
 
john_steedCommented:
Hi,

I think sp_add_jobserver is in the msdb database, try to specify that (since you're having "use master" on top of the script)

exec msdb.dbo.sp_add_jobserver....

hope this helps
0
 
newimagentAuthor Commented:
i tried it without the use master as well to no avail, but using exec msdb.do.sp_add_jobserver did the trick!

Thank you!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now