SSIS - Using Dataflow task to insert records 47 mill records from a SQL Server 2008 r2 db to a destination SQL Server 2008 r2 db, but the log is growing and eating up all disk space, causing the package to fail. The database is in simple mode. There are approximately 47 million records that needs to be moved. I set the "Maximum Insert Commit Size" to 5 mill. I thought that would keep that log under control, but the package keeps failing due to the log growing out of control. Please help. Any suggestions.
What you need are minimally logged inserts, and you can't use a smaller commit size for them, because then the next 'section' won't minimally log. However, 47 million records can be huge depending on row width.
More information on Minimal Logging prerequisites: http://msdn.microsoft.com/en-us/library/ms190422(v=sql.105).aspx
Now, commit size is equivalent to BATCHSIZE from BULK INSERT. Now, from the BULK INSERT page:http://msdn.microsoft.com/en-us/library/ms188365.aspx
The BULK INSERT statement can be executed within a user-defined transaction to import data into a table or view. Optionally, to use multiple matches for bulk importing data, a transaction can specify the BATCHSIZE clause in the BULK INSERT statement. If a multiple-batch transaction is rolled back, every batch that the transaction has sent to SQL Server is rolled back.
This means that you're not saving any T-Log space because it's not multiple transactions, it's merely multiple batches in the same transaction. So, that's not going to help with the problem.
Is there some kind of Identity field on the originating data that you could create a WHERE loop for the inbound data and grab it in 5 million row chunks, allowing for checkpoints to be sent to the database after each chunk? If not, try the minimally logged route and see where it can take you.
- Craig Farrell
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake. For better assistance in answering your questions | Forum Netiquette
For index/tuning help, follow these directions. |Tally TablesTwitter: @AnyWayDBA