Modify the Target Server(s) Associated with a SQL Server Agent Master Job
This topic describes how to modify the target server(s) associated with a SQL Server Agent master job in SQL Server 2012 by using SQL Server Management Studio or Transact-SQL.
In This Topic
Before you begin:
Limitations and Restrictions
Security
To modify the target server(s) associated with a SQL Server Agent master job, using:
SQL Server Management Studio
Transact-SQL
Before You Begin
Limitations and Restrictions
A SQL Server Agent master job cannot be targeted at both local and remote servers.
Security
Permissions
Unless you are a member of the sysadmin fixed server role, you can only modify jobs that you own. For detailed information, see Implement SQL Server Agent Security.
[Top]
Using SQL Server Management Studio
To modify the target server(s) associated with a SQL Server Agent master job
In Object Explorer, click the plus sign to expand the server that contains the job where you want to modify the target server.
Click the plus sign to expand SQL Server Agent.
Click the plus sign to expand the Jobs folder.
Right-click the job where you want to modify the target server and select Properties.
In the Job Properties – job_name dialog box, under Select a page, select Targets. For more information on the available options on this page, see Job Properties / New Job (Targets Page).
When finished, click OK.
[Top]
Using Transact-SQL
To delete a target server currently associated with a SQL Server Agent master job
In Object Explorer, connect to an instance of Database Engine.
On the Standard bar, click New Query.
Copy and paste the following example into the query window and click Execute.
-- removes the server SEATTLE2 from processing the Weekly Sales Backupsjob -- assumes that the Weekly Sales Backups job exists USE msdb ; GO EXEC sp_delete_jobserver @job_name = N'Weekly Sales Backups', @server_name = N'SEATTLE2' ; GO
For more information, see sp_delete_jobserver (Transact-SQL).
To associate a target server with the current SQL Server Agent master job
In Object Explorer, connect to an instance of Database Engine.
On the Standard bar, click New Query.
Copy and paste the following example into the query window and click Execute.
-- assigns the multiserver job Weekly Sales Backups to the server SEATTLE2 -- assumes that the Weekly Sales Backups job already exists and that -- SEATTLE2 is registered as a target server for the current instance USE msdb ; GO EXEC dbo.sp_add_jobserver @job_name = N'Weekly Sales Backups', @server_name = N'SEATTLE2' ; GO
For more information, see sp_add_jobserver (Transact-SQL).
[Top]