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

0

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.

sql-server
sql-server-2008
ssis
bids
asked on Stack Overflow May 21, 2015 by KDS

2 Answers

0

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.

answered on Stack Overflow May 22, 2015 by SwapnilK
0

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.

answered on Stack Overflow May 3, 2017 by mpmartin618

User contributions licensed under CC BY-SA 3.0