SSIS transactions with multiple OLE DB commands - sql-server

I have the following Data Flow task in my SSIS package:
alt text http://img228.imageshack.us/img228/358/ssis1.png
It reads a file from an external vendor that has records with a column "change" that cointains A, C or D for add, change and delete. I have to process these in my SQL Server database. The conditional split checks the value of the change column and sends the row off to the appropriate command. This works fine.
Because the input files sometimes contain errors I would like to make this process transactional (there are 10 of these Data Flow tasks).
If I enable transactions on the SSIS package however the OLE DB commands seem to interfere with each other (they do not operate on the same rows). I get the error:
Error: 2010-02-02 12:21:08.39
Code: 0xC0202009
Source: name OLE DB Command 1 [58]
Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred.
Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0
" Hresult: 0x80004005 Description: "This operation conflicts with another pend
ing operation on this transaction. The operation failed.".
End Error
Error: 2010-02-02 12:21:08.39
Code: 0xC004701A
Source: name SSIS.Pipeline
Description: component "OLE DB Command 1" (58) failed the pre-execute phase
and returned error code 0xC0202009.
End Error
Progress: 2010-02-02 12:21:08.39
I have tried any order of the conditional split and all the IsolationLevels on the Transaction settings but nothing seems to work. If I make the conditional split use only 1 of the branches it works fine.
How to proceed?

Try replacing SQL Server Destination with a "OLEDB Destination" for the inserts.

SSIS is so bad it makes me scream - Seriosuly you should revist whether SSIS is the correct tool here

Related

How to interpret SISS error message of Package Validation Error: an OLE DB record is available Hresult: 0x80040E14

Sometimes when creating an SSIS data transfer job I get a scary-looking error along the lines of:
Package Validation Error. Additional information: Error at ... SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E14. An OLE DB record is available. Source: "Microsoft SQL Server Native Client." Hresult: 0x80040E14. Description: "Statements(s) could not be prepared."
It continues in this fashion. Where is the actionable part of the message? Why this strange error code when the SSIS job worked previously and I hardly changed anything?
This complex-looking error message occurs for me when there's some simple failure in one of my SQL statements, or I'm referring to an object that doesn't exist.
The actionable part of the error message occurs in the second "Description: ..." line.
In the example above, the next line was Description: "Invalid object name 'DataLake.dbo.MyTable'.". I had not selected the correct connection manager when creating that table, so it was created in another database, and then when one of my SSIS package steps failed to find it where expected, it threw this long error message.
Most of the message, with 0x80040E14 and all the rest at the end about failing validation and errors during task validation can be ignored for the purpose of fixing it.

SSIS Error Code DTS_E_OLEDBERROR 0x80004005

I am running an SSIS package that uses OLEDB connections to fetch data from and Oracle 10.2.0.5.0 database and insert it into an SQLServer 2012 (11.0.6260)
I get the following error.
Time: 2021-02-05 01:13:55 AM
Task: Data Flow Task
Error Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
followed by
Time: 2021-02-05 01:13:55 AM
Task: Data Flow Task
Error Description: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on OLE DB Source returned error code 0xC0202009. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.
There are no keys or constraints on the destination table.
Both of the dataflow tasks have CommandTimeout set to 0.
All of the other packages with the same source and destination databases run without any problem.
Edit 2
This particular package runs fine on our test/development environment.
I have sinced run the package several times and noticed that the source query returns about 4500 records but only about 500 are inserted into the destination database.
End Edit 2
Is there anything else that I can check for?
Edit 1
The Error message is as it appears in service manager.
The log files just before the error are below.
The source Query is quite along running query. It takes approximately 9 minutes.
End Edit 1
Logging into the oracle database directly with the user that is used for our integrations and running the query gave the following error.
After increasing the size of the user profile the query returned data and the integrations ran correctly.

Loading temporary tables in parallel

I load data from one SQL Server A to temporary table via Execute SQL Task (select * into x from remote_server) and join with another remote SQL Server B in Data flow.
So I have two source in Data Flow:
1.Local temporary table which contains date from SQL Server A (loaded in previous task)
2.Table on remote SQL Server B.
To achieve it I change "RetainSameConnection" connection manager property (which I use it to pull data from SQL Server A to local machine (SSIS server) to TRUE. It works but I cannot load these tasks parallely, because I get:
S [[209]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error
has occurred. Error code: 0x80040E14. An OLE DB record is available.
Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80040E14
Description: "Statement(s) could not be prepared.". An OLE DB record
is available. Source: "Microsoft SQL Server Native Client 11.0"
Hresult: 0x80040E14 Description: "Invalid object name
'##V_DEL'.".
[SSIS.Pipeline] Error: "S" failed validation and returned validation
status "VS_ISBROKEN".
How to solve it?
If you are using RetainConnection = True then only 1 object at a time can have the retained connection. This means that if 2 sql tasks run in parallel then only 1 will use the retained connection. Similar to the issue that you cant have a lookup and a dest with the same retained connection.
The only workaround is to serialize your SQL calls.
Simple solution: Just take Global temp table creation task in one sequence container and insert part in another sequence container. It will work fine and we can run the 2 task in parallel.
Take temp table creation part in one sequence container and insert part in another sequence container and it will work even if we run task in parallel having more than one Global temp tables.

SSIS 2008 R2 Completes But Gives Error "Violation of PRIMARY KEY constraint"

I've found a number of links on this but so far not the one with an answer.
Issue: SSIS 2008 R2 package importing data from many tables (about 160) of SQL 2000 database (conversion project) into new structures. This has run cleanly a number of times. To be clear, the data appears to be actually importing correctly. However, the last 3 times, I've run into this error. The Task (54) Source (269) shown in the message below is the last step and item in the step.
I've confirmed that the table mention as a "duplicate key violation" actually has the same 49166 records as the source. It seems like it almost just has issue with threading or the time that has elapsed (long running query). I have TRUNCATED the 5 tables in the final step and re-run that single Task 54 and it completes just fine, all green.
It would be good to not have to go hunting through the process due to red herrings. Any idea on how to address this so it reports cleanly?
Thanks
Error message below:
Executed as user: [masked]. Microsoft (R) SQL Server Execute Package Utility Version 10.50.6000.34 for 64-bit Copyright (C) Microsoft Corporation 2010. All rights reserved. Started: 4:36:46 PM Error: 2015-05-20 16:36:48.49 Code: 0xC0016016 Source: Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available. End Error Error: 2015-05-20 16:36:48.50 Code: 0xC0016016 Source: Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available. End Error Error: 2015-05-20 17:19:33.78 Code: 0xC0202009 Source: Data Flow Task 54 Destination 269 - cadNotificationStatus [396] Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "The statement has been terminated.". An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "Violation of PRIMARY KEY constraint 'PK__cadNotif__25843E4F1B0907CE'. Cannot insert duplicate key in object 'dbo.cadNotificationStatus'. The duplicate key value is (4, 2).". End Error Error: 2015-05-20 17:19:33.79 Code: 0xC0209029 Source: Data Flow Task 54 Destination 269 - cadNotificationStatus [396] Description: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "input "OLE DB Destination Input" (409)" failed because error code 0xC020907B occurred, and the error row disposition on "input "OLE DB Destination Input" (409)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure. End Error Error: 2015-05-20 17:19:33.79 Code: 0xC0047022 Source: Data Flow Task 54 SSIS.Pipeline Description: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination 269 - cadNotificationStatus" (396) failed with error code 0xC0209029 while processing input "OLE DB Destination Input" (409). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure. End Error Error: 2015-05-20 17:19:33.81 Code: 0xC02020C4 Source: Data Flow Task 54 Source 269 - cadNotificationStatus [218] Description: The attempt to add a row to the Data Flow task buffer failed with error code 0xC0047020. End Error Error: 2015-05-20 17:19:33.81 Code: 0xC0047038 Source: Data Flow Task 54 SSIS.Pipeline Description: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on component "Source 269 - cadNotificationStatus" (218) returned error code 0xC02020C4. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 4:36:46 PM Finished: 5:19:34 PM Elapsed: 2568.01 seconds. The package execution failed. The step failed.
As per the error, it is failing while to inserting duplicate records in 'dbo.cadNotificationStatus' table. Is there any logic to import only new records from source table which is in SQL 2000, which are not present in destination table? If no, data flow task importing data into this table is going to fail.
It looks like, it is running successfully because you are truncating the table and then importing the whole data again. If you can provide more info regarding source query, it will be more clear.
Just to be 100% sure I would redirect rows to a flat file that are causing you the issue. This will allow you to see what line item is causing the failure or triggering the error message. This link shows a good tutorial of how to do that:
http://www.techbrothersit.com/2013/07/ssis-how-to-redirect-invalid-rows-from.html
Also it looks like you have more going on in your error output from a security perspective based on the below:
Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information.
My guess is that someone else created this package and used: "EncryptSensitiveWithUserKey"...
I would recommend:
While importing the package to SQL Server choose Protection Level: Either
1- Don't save sensitive data.
Or
2- Rely on Server Storage and roles for access control.

Error while importing into table in SQL Server 2008 R2 from Excel File

I am getting this error while importing from an Excel file into a table in SQL Server 2008 R2.
I have added a picture.
Copying to [dbo].[MultiPLU] (Error) Messages Error 0xc0202009: Data
Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has
occurred.
Error code: 0x80004005. An OLE DB record is available.
Source: "Microsoft SQL Server Native Client 10.0"
Hresult: 0x80004005
Description: "The statement has been terminated.".
An OLE DB record is available.
Source: "Microsoft SQL Server Native Client 10.0"
Hresult: 0x80004005
Description: "Cannot insert the value NULL into column 'PLUCode', table 'AR4UWin.dbo.MultiPLU'; column does not allow nulls. INSERT fails.".
(SQL Server Import and Export Wizard)
Error 0xc0209029: Data Flow Task 1: SSIS Error Code
DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "input "Destination Input"
(57)" failed because error code 0xC020907B occurred, and the error row
disposition on "input "Destination Input" (57)" specifies failure on
error. An error occurred on the specified object of the specified
component. There may be error messages posted before this with more
information about the failure.
(SQL Server Import and Export Wizard)
Error 0xc0047022: Data Flow Task 1: SSIS Error Code
DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component
"Destination - MultiPLU" (44) failed with error code 0xC0209029 while
processing input "Destination Input" (57). The identified component
returned an error from the ProcessInput method. The error is specific
to the component, but the error is fatal and will cause the Data Flow
task to stop running. There may be error messages posted before this
with more information about the failure.
(SQL Server Import and Export Wizard)
The import process requires a value for every row in the 'PLUCode' column, whereas I believe that your excel spreadsheet sometimes has no value in these cells.
Right clicking on the PLUCode and setting it to allow nulls will allow you to upload the table. The query below will give you the errored entries for review.
SELECT *
FROM Tablename
WHERE PLUCode IS NULL
If you're dealing with duplicates I would recommend a self join to only give you the unique rows. (You'll need a few 'if' statements to check for rows with null values so you don't delete a whole record and leave you with the broken one.) I would be exceptionally careful with using any predefined remove duplicates function (like in excel) unless you've scrutinized the table to ensure it wont drop the completed rows.
EDIT: To respond the need to save as a flat file you'll want to save as a comma delimited csv file. Its in the usual file formats list unless you're using excel 2010, the itll be under the "Save and Send" option.

Resources