【问题标题】:SSIS Package runs fine in Visual Studio but fails when run manually on the deployed boxSSIS 包在 Visual Studio 中运行良好,但在已部署的机器上手动运行时失败
【发布时间】:2014-04-10 21:12:49
【问题描述】:

我有一个脚本任务,将某些传入的对象从一台服务器传输到另一台服务器。 这是代码

public void Main()
        {
            try
            {
            string schemaName = Dts.Variables["$Package::SchemaName"].Value.ToString();
            string objectName = Dts.Variables["$Package::ObjectName"].Value.ToString();

            //object rawETLConnection = Dts.Connections["etl"].AcquireConnection(Dts.Transaction);
            //Server etlServer = (Server)rawETLConnection;

            Server etlServer = new Server("ciesqldeva04");
            Database etlDB;
            etlDB = etlServer.Databases["sell_side_content"];




            //object rawReportingConnection = Dts.Connections["reporting"].AcquireConnection(Dts.Transaction);
            //Server reportingServer = (Server)rawReportingConnection;
            Server reportingServer = new Server("ciesqldeva05");





                Transfer xfr;
                xfr = new Transfer(etlDB);
                xfr.DestinationServer = reportingServer.Name;
                xfr.DestinationDatabase = "sell_side_content";
                xfr.DropDestinationObjectsFirst = true;
                xfr.CopyAllObjects = false;
                xfr.CopyData = true;
                xfr.CopySchema = true;
                xfr.Options.DriAll = true;


                xfr.ObjectList.Add(etlDB.Tables[objectName, schemaName]);

                xfr.TransferData();
            }
            catch (SmoException smoex)
            {
                Dts.Events.FireError(120, " SMO - TransferObjects.dtsx", smoex.Message, "", 0);

            }
            catch (Exception ex)
            {
                Dts.Events.FireError(120,"Non SMO - TransferObjects.dtsx",ex.Message,"",0);

            } 
            Dts.TaskResult = (int)ScriptResults.Success;
        }

当我通过 Visual Studio 2012 运行它时它工作正常。但是当我将它部署到盒子上并通过右键单击 SSMS 中的包名称并点击 execute 运行它时,它会失败并显示此消息 “使用 SMO 传输对象:错误:传输数据时发生错误。有关详细信息,请参阅内部异常。”

我还将脚本转换为控制台应用程序并在我之前将包部署到的盒子上运行它并通过终端运行它,它能够成功传输,因此看起来不像缺少 DLL 的问题。

这是该控制台应用程序的代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Management.Smo;
using System.Collections.Specialized;
using System.Collections;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Server etlServer = new Server("ciesqldeva04");
            Database etlDB;
            etlDB = etlServer.Databases["sell_side_content"];




            //object rawReportingConnection = Dts.Connections["reporting"].AcquireConnection(Dts.Transaction);
            //Server reportingServer = (Server)rawReportingConnection;
            Server reportingServer = new Server("ciesqldeva05");




            try
            {
                Transfer xfr;
                xfr = new Transfer(etlDB);
                xfr.DestinationServer = reportingServer.Name;
                xfr.DestinationDatabase = "sell_side_content";
                xfr.DropDestinationObjectsFirst = true;
                xfr.CopyAllObjects = false;
                xfr.CopyData = true;
                xfr.CopySchema = true;
                xfr.Options.DriAll = true;


                xfr.ObjectList.Add(etlDB.Tables["award_sector", "people"]);

                xfr.TransferData();
            }
            catch (SmoException smoex)
            {
                Console.WriteLine("This is an SMO Exception");
                //Display the SMO exception message. 
                Console.WriteLine(smoex.Message);
                //Display the sequence of non-SMO exceptions that caused the SMO exception. 
            }
        }
    }
}

我尝试了各种方法,但都没有成功。任何帮助将不胜感激。

附:我在 SQL Server 2012 上运行它。

【问题讨论】:

  • 如果您将日志消息更改为包含 smoex.Inner,它提供了有关错误的任何见解吗?当你在远程服务器上运行这个包时,你是如何调用它的?这是使用项目部署模型(新)还是包部署模型?
  • 我使用的是项目部署模型。我通过使用 SSMS 登录到该服务器来调用它,然后导航到集成服务目录下的项目-> ssisdb->...,然后右键单击包并点击执行。
  • 同样做内部颂歌也无济于事,因为记录的异常不是我抛出的异常。我使用此选择消息类型获取错误列表,消息来自 ssisdb.internal.operation_messages where operation_id = 74404 order by message_time asc

标签: sql-server sql-server-2012 ssis bids


【解决方案1】:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-05-27
    • 1970-01-01
    • 2021-07-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多