首页 > 代码库 > SSIS包部署

SSIS包部署

1、ssis包部署可以生成部署文件,部署到sqlserver,再通过sqlserver计划作业来执行。

2、也可以通过shell来调用dtsx ,通过windows计划任务来定时调用exe。

不论是哪种方式服务端都需要安装sqlserver integration service. 安装了integration service后 在 C:\Program Files (x86)\Common Files\microsoft shared\VSTA\Pipeline\AddInViews下或者 C:\Program Files (x86)\Microsoft SQL Server\100\SDK\Assemblies 目录下有 Microsoft.SqlServer.DTSRuntimeWrap.dll

引用这个dll

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;using System.Configuration;using DtsRunTime = Microsoft.SqlServer.Dts.Runtime.Wrapper;namespace SsisShell{    class Program    {        private static string ssisName = ConfigurationManager.AppSettings["SsisName"];        static void Main(string[] args)        {            try            {                Log.Write("开始执行");                string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ssisName);                DtsRunTime.Application dtsApplication = new DtsRunTime.Application();                DtsRunTime.IDTSPackage100 package = dtsApplication.LoadPackage(path, true, null);                DtsRunTime.DTSExecResult result = package.Execute();                Log.Write("执行结束,执行结果为:"+result);            }            catch (Exception ex) { Log.Write(ex); }        }    }}

 

SSIS包部署