2014-04-10 10 views
6

पर मैन्युअल रूप से चलाए जाने पर विफल रहता है मेरे पास एक स्क्रिप्ट कार्य होता है जो ऑब्जेक्ट में कुछ सर्वर से दूसरे में स्थानांतरित होता है। यह कोडएसएसआईएस पैकेज विजुअल स्टूडियो में ठीक चलता है लेकिन तैनात बॉक्स

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

जब मैं यह दृश्य स्टूडियो 2012 के माध्यम से चलाने लेकिन जब मैंने उसे बॉक्स पर तैनाती और SSMS में पैकेज के नाम पर क्लिक करें और निष्पादित मार सही के माध्यम से इसे चलाने यह ठीक काम करता है है इसके साथ असफल यह संदेश "एसएमओ का उपयोग करके ऑब्जेक्ट ट्रांसफर करें: त्रुटि: डेटा स्थानांतरित करते समय एक त्रुटि आई। विवरण के लिए आंतरिक अपवाद देखें।"

मैंने स्क्रिप्ट को एक कंसोल एप्लिकेशन में भी परिवर्तित कर दिया और इसे उस बॉक्स पर चलाया जिसे मैंने पहले पैकेज में तैनात किया था और इसे टर्मिनल के माध्यम से चलाया था और यह सफलतापूर्वक स्थानांतरित करने में सक्षम था, इसलिए यह गायब डीएलएल के मुद्दे की तरह दिखता नहीं है ।

यह है कि सांत्वना आवेदन

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

मैं विभिन्न चीजों की कोशिश की है के लिए है, लेकिन कोई सफलता के लिए कोड है। कोई भी सहायताकाफी प्रशंसनीय होगी।

पीएस मैं एसक्यूएल सर्वर पर इस चला रहा हूँ 2012

+1

आप अपने लॉग संदेश smoex.Inner शामिल करने के लिए बदलते हैं, तो डॉट्स यह किसी भी अंतर्दृष्टि त्रुटि के रूप में प्रदान करते हैं? जब आप इस पैकेज को रिमोट सर्वर पर चलाते हैं, तो आप इसका आविष्कार कैसे कर रहे हैं? क्या यह प्रोजेक्ट परिनियोजन मॉडल (नया) या पैकेज परिनियोजन मॉडल का उपयोग कर रहा है? – billinkc

+0

मैं प्रोजेक्ट परिनियोजन मॉडल का उपयोग कर रहा हूं। और मैं इसे एसएसएमएस का उपयोग कर उस सर्वर में लॉग इन करके, फिर एकीकरण सेवाओं कैटलॉग-> ssisdb -> ... के तहत प्रोजेक्ट पर नेविगेट करके और फिर पैकेज पर राइट क्लिक करके निष्पादन मार रहा हूं। – bootkick

+0

आंतरिक odes भी लॉग इन अपवाद के रूप में मदद नहीं करता है, जिसे मैं फेंकता हूं। मुझे इस चुनिंदा संदेश_ प्रकार, \t संदेश से ssisdb.internal.operation_messages जहां ऑपरेशन_आईडी = 74404 \t संदेश_टाइम द्वारा क्रमबद्ध क्रम में त्रुटि सूची प्राप्त करें – bootkick

उत्तर

संबंधित मुद्दे