SSIS failing to save packages and reboots Visual Studio

偶尔善良 提交于 2019-11-29 15:33:33

I suggest reading data in chunks:

Instead of loading the whole table, try to split the data into chunks and import them to SQL Server. From a while, I answered a similar answer related to SQLite, i will try to reproduce it to fit the Oracle syntax:


Step by Step guide

In this example each chunk contains 10000 rows.

  1. Declare 2 Variables of type Int32 (@[User::RowCount] and @[User::IncrementValue])
  2. Add an Execute SQL Task that execute a select Count(*) command and store the Result Set into the variable @[User::RowCount]

  1. Add a For Loop with the following preferences:

  1. Inside the for loop container add a Data flow task
  2. Inside the dataflow task add an ODBC Source and OLEDB Destination
  3. In the ODBC Source select SQL Command option and write a SELECT * FROM TABLE query *(to retrieve metadata only`
  4. Map the columns between source and destination
  5. Go back to the Control flow and click on the Data flow task and hit F4 to view the properties window
  6. In the properties window go to expression and Assign the following expression to [ODBC Source].[SQLCommand] property: (for more info refer to How to pass SSIS variables in ODBC SQLCommand expression?)

    "SELECT * FROM MYTABLE ORDER BY ID_COLUMN
    OFFSET " + (DT_WSTR,50)@[User::IncrementValue] + "FETCH NEXT 10000 ROWS ONLY;"
    

Where MYTABLE is the source table name, and IDCOLUMN is your primary key or identity column.

Control Flow Screenshot

References


Update 1 - Other possible workarounds

While searching for similar issues i found some additional workarounds that you can try:

(1) Change the SQL Server max memory

(2) Enable Named pipes

(3) If using SQL Server 2008 install hotfixes


Update 2 - Understanding the error

In the following MSDN link, the error cause was described as following:

Virtual memory is a superset of physical memory. Processes in Windows typically do not specify which they are to use, as that would (greatly) inhibit how Windows can multitask. SSIS allocates virtual memory. If Windows is able to, all of these allocations are held in physical memory, where access is faster. However, if SSIS requests more memory than is physically available, then that virtual memory spills to disk, making the package operate orders of magnitude slower. And in worst cases, if there is not enough virtual memory in the system, then the package will fail.

Are you running your packages in parallel ? If yes, change to serie.

You can also try to divide this big table into subsets using an operation like modulo. See that example :

http://henkvandervalk.com/reading-as-fast-as-possible-from-a-table-with-ssis-part-ii

(in the example, he is running in parallel, but you can put this in serie)

Also, if you are running the SSIS package on a computer that is running an instance of SQL Server, when you run the package, set the Maximum server memory option for the SQL Server instance to a smaller value. That will increases available memory.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!