有没有办法在不使用链接服务器的情况下触发远程服务器上另一个作业的作业?

原因是触发的作业在2008年执行SSIS软件包。调用作业位于2005服务器上,因此无法直接执行作业。

服务器没有链接,我希望有一种方法可以从另一个打电话。

有帮助吗?

解决方案

在SQL代理中使用类型的“ CMDEXEC(操作系统)”,然后使用dtexec f“ .....”命令行utily otecute SSIS 2008软件包。这项工作!

将DTSX文件导出到2005服务器框,并使用DTEXEC实用程序从命令行调用DTSX。

其他提示

不确定这是否会起作用。创建一个调用sp_start_job的HTTP终点

http://technet.microsoft.com/en-us/library/ms181591.aspx

http://msdn.microsoft.com/en-us/library/ms186757.aspx

假设您已执行XP_CMDSHELL,则填充代码应起作用。只需要替换@job_name和@server_name的文本即可。

USE master 
GO 
-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1 
GO 
-- To update the currently configured value for advanced options.
RECONFIGURE WITH OVERRIDE 
GO
-- To disable the feature.
EXEC sp_configure 'xp_cmdshell', 1 
GO 
-- To update the currently configured value for this feature.
RECONFIGURE WITH OVERRIDE 
GO 


declare @retcode int 
declare @job_name varchar(300) 
declare @server_name varchar(200) 
declare @query varchar(8000) 
declare @cmd varchar(8000) 

set @job_name = 'hodes - grant user permissions' ------------------Job name goes here. 
set @server_name = 'msc-dbs04' ------------------Server name goes here. 

set @query = 'exec msdb.dbo.sp_start_job @job_name = ''' + @job_name + '''' 
set @cmd = 'osql -E -S ' + @server_name + ' -Q "' + @query + '"' 

print ' @job_name = ' +isnull(@job_name,'NULL @job_name') 
print ' @server_name = ' +isnull(@server_name,'NULL @server_name') 
print ' @query = ' +isnull(@query,'NULL @query') 
print ' @cmd = ' +isnull(@cmd,'NULL @cmd') 

exec @retcode = xp_cmdshell @cmd 

if @retcode <> 0 or @retcode is null 
begin 
print 'xp_cmdshell @retcode = '+isnull(convert(varchar(20),@retcode),'NULL @retcode') 
end 

USE MASTER
GO
-- To update the currently configured value for advanced options.
RECONFIGURE WITH OVERRIDE
GO
-- To disable the feature.
EXEC sp_configure 'xp_cmdshell', 0
GO
-- To update the currently configured value for this feature.
RECONFIGURE WITH OVERRIDE
GO
-- To do not allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 0
GO
-- To update the currently configured value for advanced options.
RECONFIGURE WITH OVERRIDE
GO
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top