2014-04-10 29 views
6

Belirli bir nesneyi bir sunucudan diğerine aktaran bir komut dosyası görevim var. Bu başarısız, kodSSIS paketi, Visual Studio'da iyi çalışır, ancak dağıtılan kutuda el ile çalıştırıldığında başarısız olur

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; 
     } 

Ben Visual Studio 2012. yoluyla çalıştırdığınızda Ama kutunun üzerine dağıtmak ve SSMS paket adı tıklayıp yürütmek isabet sağ aracılığıyla çalıştırmak zaman güzel çalışıyor Bu ileti "SMO Kullanarak Nesneyi Aktar: Hata: Veri aktarırken bir hata oluştu. Ayrıntılar için iç özel duruma bakın."

Ayrıca, komut dosyasını bir konsol uygulamasına dönüştürdüm ve daha önce paketi açtığım ve uçbirim aracılığıyla çalıştıracağım kutuda çalıştırdım ve başarıyla aktarılabiliyordu ve bu yüzden eksik DLL'lerin bir sorunu gibi görünmüyordu .

Bu

Çeşitli şeyler denedim o konsol uygulaması

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. 
      } 
     } 
    } 
} 

için ama hiçbir başarının koddur. Herhangi bir yardım çok takdir edilecektir.

P.S. Ben 64bit smo kitaplığındaki yüklemeden 2012.

+1

, noktalar o hata için herhangi bir fikir sağlayabilir? Bu paketi uzak sunucuda çalıştırdığınızda, onu nasıl çağırıyorsunuz? Bu proje dağıtım modeli (yeni) veya paket dağıtım modeli kullanıyor mu? – billinkc

+0

Proje dağıtım modelini kullanıyorum. Ve ben SSMS kullanarak o sunucuya giriş yaparak, sonra da entegrasyon hizmetleri katalogları-> ssisdb -> ... altındaki projeye gidip paketin üzerine tıklayıp yürütme işlemini gerçekleştirerek çağırıyorum. – bootkick

+0

Ayrıca kaydedilen istisna olarak, iç odes yardımcı olmaz, attığım şey değil. Ben message_time asc tarafından ssisdb.internal.operation_messages operation_id = 74.404 \t sipariş bu seçkin message_type kullanarak hata listesi, \t mesajı olsun – bootkick

cevap

İlgili konular