如何从bat文件远程运行DTSX包?

时间:2022-01-29 16:02:17

I am trying to remotely run a DTSX package from a bat file with this command:

我试图使用此命令从bat文件远程运行DTSX包:

DTEXEC /DTS "\File System\MY_PACKAGE_NAME" /SERVER MY_SERVER_NAME /MAXCONCURRENT " -1 " /CHECKPOINTING OFF  /REPORTING V

This is working fine locally but failing remotely (I do have admin rights on the machine I am pointing to and I have SQL permissions as well) I am getting a timeout error (Login timeout expired).

这在本地工作正常,但远程失败(我在我指向的机器上有管理员权限,我也有SQL权限)我收到超时错误(登录超时已过期)。

3 个解决方案

#1


5  

It's very possible, and so easily. There is no need to have a store procedure, nor SQL agent, or Web, or .NET development. I am surprised the Microsoft never suggested this:

这很有可能,也很容易。不需要存储过程,也不需要SQL代理,Web或.NET开发。我很惊讶微软从来没有这么说过:

  1. Schedule a task on the SQL Server to run the DTSX package. Disable it, so it won't run until you manually execute it from a remote PC.
  2. 在SQL Server上安排任务以运行DTSX包。禁用它,因此在从远程PC手动执行它之前它不会运行。

  3. Execute the task from the PC using the command:
  4. 使用以下命令从PC执行任务:

schtasks /run /tn MyTask [/s MySQLServer [/u [domain]user /p password]] /?

schtasks / run / tn MyTask [/ s MySQLServer [/ u [domain] user / p password]] /?

Note: if you do not like exposing the password, use the 'PSEXEC' command to execute the 'schtasks' command(download the free and powerful tool from http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

注意:如果您不喜欢公开密码,请使用'PSEXEC'命令执行'schtasks'命令(从http://technet.microsoft.com/en-us/sysinternals/bb897553下载免费且功能强大的工具。 ASPX

#2


3  

After a bit of research it looks like it is impossible to run DTEXEC remotely (it needs to be run locally - remote execution is not supported).

经过一些研究后,看起来无法远程运行DTEXEC(它需要在本地运行 - 不支持远程执行)。

To overcome this limitation the following method seems to be broadly implemented:

为了克服这种限制,似乎广泛实施了以下方法:

  1. set up a SQL job to run the DTSX package
  2. 设置SQL作业以运行DTSX包

  3. set up a Stored Procedure to run the job
  4. 设置存储过程以运行作业

  5. use isql command line in a BAT file (remotely executed) to run the stored procedure on the relevant SQL instance (with SQL credentials and not machine credentials)
  6. 在BAT文件中使用isql命令行(远程执行)在相关SQL实例上运行存储过程(使用SQL凭据而不是机器凭据)

#3


1  

SSIS also exposes a web service on the hosting server. You could via code, query a machine for packages, run packages via database or file system and add / modify variables of the package programmatically via any programming platform you like.

SSIS还在托管服务器上公开Web服务。您可以通过代码,查询机器的包,通过数据库或文件系统运行包,并通过您喜欢的任何编程平台以编程方式添加/修改包的变量。

That being said you could also set up your webservice to call your local batch file which contains your 'DETEXEC' command.

话虽如此,您还可以设置您的Web服务来调用包含“DETEXEC”命令的本地批处理文件。

#1


5  

It's very possible, and so easily. There is no need to have a store procedure, nor SQL agent, or Web, or .NET development. I am surprised the Microsoft never suggested this:

这很有可能,也很容易。不需要存储过程,也不需要SQL代理,Web或.NET开发。我很惊讶微软从来没有这么说过:

  1. Schedule a task on the SQL Server to run the DTSX package. Disable it, so it won't run until you manually execute it from a remote PC.
  2. 在SQL Server上安排任务以运行DTSX包。禁用它,因此在从远程PC手动执行它之前它不会运行。

  3. Execute the task from the PC using the command:
  4. 使用以下命令从PC执行任务:

schtasks /run /tn MyTask [/s MySQLServer [/u [domain]user /p password]] /?

schtasks / run / tn MyTask [/ s MySQLServer [/ u [domain] user / p password]] /?

Note: if you do not like exposing the password, use the 'PSEXEC' command to execute the 'schtasks' command(download the free and powerful tool from http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

注意:如果您不喜欢公开密码,请使用'PSEXEC'命令执行'schtasks'命令(从http://technet.microsoft.com/en-us/sysinternals/bb897553下载免费且功能强大的工具。 ASPX

#2


3  

After a bit of research it looks like it is impossible to run DTEXEC remotely (it needs to be run locally - remote execution is not supported).

经过一些研究后,看起来无法远程运行DTEXEC(它需要在本地运行 - 不支持远程执行)。

To overcome this limitation the following method seems to be broadly implemented:

为了克服这种限制,似乎广泛实施了以下方法:

  1. set up a SQL job to run the DTSX package
  2. 设置SQL作业以运行DTSX包

  3. set up a Stored Procedure to run the job
  4. 设置存储过程以运行作业

  5. use isql command line in a BAT file (remotely executed) to run the stored procedure on the relevant SQL instance (with SQL credentials and not machine credentials)
  6. 在BAT文件中使用isql命令行(远程执行)在相关SQL实例上运行存储过程(使用SQL凭据而不是机器凭据)

#3


1  

SSIS also exposes a web service on the hosting server. You could via code, query a machine for packages, run packages via database or file system and add / modify variables of the package programmatically via any programming platform you like.

SSIS还在托管服务器上公开Web服务。您可以通过代码,查询机器的包,通过数据库或文件系统运行包,并通过您喜欢的任何编程平台以编程方式添加/修改包的变量。

That being said you could also set up your webservice to call your local batch file which contains your 'DETEXEC' command.

话虽如此,您还可以设置您的Web服务来调用包含“DETEXEC”命令的本地批处理文件。