Archive
Informatica | Thread: WRITER_1_*_1, Message Code: WRT_8229, Native Error: 3621, Violation of PRIMARY KEY constraint
Today while working with an Informatica mapping, I faced a strange issue. The image below shows the design of the INFA mapping:
Here I’m Acquiring a new table with ~500k records and the table is also very fat with PK as a GUID column. Its just a plain data pull with a simple SELECT query, no JOINs, UNIONs, etc. But while running the Workflow it gave me PK Violation error, as shown below:
Severity: ERROR Timestamp: 5/30/2013 7:22:54 PM Node: INFA_NODE_SERVERNAME Thread: WRITER_1_*_1 Process ID: 8216 Message Code: WRT_8229 Message: Database errors occurred: Microsoft OLE DB Provider for SQL Server: The statement has been terminated. SQL State: 01000 Native Error: 3621 State: 1 Severity: 0 SQL Server Message: The statement has been terminated. Microsoft OLE DB Provider for SQL Server: Violation of PRIMARY KEY constraint 'PK_tblTableName'. Cannot insert duplicate key in object 'dbo.tblTableName'. The duplicate key value is (2ea8b6b9-e505-4ef1-a385-0cf9143d2cfd). SQL State: 23000 Native Error: 2627 State: 1 Severity: 14 SQL Server Message: Violation of PRIMARY KEY constraint 'PK_tblTableName'. Cannot insert duplicate key in object 'dbo.tblTableName'. The duplicate key value is (2ea8b6b9-e505-4ef1-a385-0cf9143d2cfd). Database driver error... Function Name : Execute Multiple SQL Stmt : INSERT INTO tblTableName
This was strange because the error was for the GUID PK column, and there is no reason for duplicate values here. As I’ve already taken care of INSERTs & UPDATEs by ROUTER Transformation, which can be seen in the image above. I tried to find the root cause of the error, BINGed/GOOGLEd a lot, but no luck.
Then I checked with an experienced person in my team about this error. He immediately asked me if I’ve added any “WITH (NOLOCK)” option in my query with the Source Table. I said yes, so he asked me to remove it and try, as they had faced similar issues with NOLOCK option before. I removed it and the Workflow ran successfully 🙂 .
I knew that with NOLOCK option I’m doing Dirty Reads, and had added it just to avoid locking/blocking at the Source end. But I was not aware that these Dirty Reads means any kind of data, which can also be duplicate. Thus by adding NOLOCK option with the Table, which is also going through lot of changes, we may allow data to be read more than once. This may be due to Data Movement, Uncommitted Data or Page Splits on the Source table during our reads, where we may be reading the data before and after the Page-Splits.
So, be careful while using NOLOCK option while designing your queries.
For more information check following blog: http://sqlmag.com/database-development/quaere-verum-clustered-index-scans-part-iii
Apache Spark books:
- Spark: The Definitive Guide
- Learning Spark 2Ed
SQL Server - Certification exam books:
- TSQL: 70-761 , 70-762
- DBA: 70-764 , 70-765
- DW/BI: 70-767
SQL Tags
annual report Apache Spark APPLY Operator Azure Databricks BCP Clustered Index ColumnStore Index Cpp CROSS APPLY Databricks Denali Download SQL Server Excel Exception Handling FileTables Graphics in Cpp Hekaton Hekaton 2014 IDENTITY In-Memory Tables Install SQL Server Java Applet Programs Java Basic Programs Java File Handling Java IO Programs Java OO Programs JSON JSON SQL Linked Server msdb MSDN TSQL forum multiple values to Stored Procedures PRIMARY KEY Python Runnable Interface sp_configure SQL Agent SQL Server 2012 SQL Server 2014 SQL Server 2016 SQL Server 2017 SQL Server Certification SQL Server Interview Questions SQL Server on Linux Stored Procedure Temporary Tables TRY-CATCH WordPress Annual Report XML XML SQLM | T | W | T | F | S | S |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 |
Categories
- Big Data (13)
- Apache Spark (6)
- Hadoop (5)
- DBA Stuff (37)
- Interview Q (8)
- Microsoft Azure (37)
- Azure Data Factory (1)
- Azure DevOps (2)
- Cosmos DB (5)
- Databricks (7)
- MS BI (9)
- Analysis Services (1)
- DW and BI (1)
- Integration Services (1)
- Power BI (4)
- Reporting Services (2)
- Tabular Model (1)
- Others (205)
- Blockchain (1)
- Certifications (9)
- Cloud Computing (1)
- Cpp (32)
- Cpp Graphics (21)
- Excel (10)
- Informatica (5)
- Java (56)
- Linux (8)
- Microsoft (15)
- MS.net (2)
- Oracle (1)
- Powershell (3)
- Python (6)
- Reviews (5)
- Security (1)
- Spark SQL (3)
- SQL Server (9)
- SQLwithManoj (12)
- Uncategorized (7)
- VBA Macro (1)
- Visual Studio (1)
- Windows (6)
- SQL Server Conferences (1)
- SQL Server Internals (85)
- Datatypes (5)
- DB Concepts (28)
- Indexes (11)
- JOINS (4)
- ML Python (2)
- SQL DB Engine (8)
- SQL Server Migration (1)
- SQL Server Upgrade (1)
- Stored Procedures (11)
- tempdb (3)
- XML (16)
- SQL Server Questions (41)
- SQL Server Versions (137)
- SQL Azure (4)
- SQL Server 2005 (7)
- SQL Server 2008 (5)
- SQL Server 2012 (33)
- SQL Server 2014 (18)
- SQL Server 2016 (50)
- SQL Server 2017 (20)
- SQL Server 2019 (2)
- SQL Server 2022 (1)
- SQL Server Express (1)
- T SQL (184)
- Differences (31)
- JSON (6)
- Misconception (7)
- Optimization Performance (14)
- SQL Basics (15)
- SQL Built-in Functions (6)
- SQL Errors (45)
- SQL Tips (67)
- SQL Trivia (9)
Archives
Top Posts
- SQL Error - The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE
- SQL DBA - Windows could not start the SQL Server... refer to service-specific error code 17051 - SQL Server Evaluation period has expired
- Python error: while converting Pandas Dataframe or Python List to Spark Dataframe (Can not merge type)
- Using IDENTITY function with SELECT statement in SQL Server
- Reading JSON string with Nested array of elements | SQL Server 2016 - Part 3
- SQL Error - SQL Server blocked access to procedure 'dbo.sp_send_dbmail' of component 'Database Mail XPs'
- SQL Error - "SELECT TOP 100" throws error in SparkSQL - what's the correct syntax?
- SQL Error - Unable to open the physical file. Operating system error 5: "5(Access is denied.)"
- Linked Server error: Named Pipes Provider: Could not open a connection to SQL Server [53] - MSDN TSQL forum
- SQL Jokes!!!
Blog Stats, since Aug 2010
- 4,986,940 hits
StatCounter …since April 2012

Leisure blog: Creek & Trails
- An error has occurred; the feed is probably down. Try again later.
Disclaimer
This is my personal blog site.
The opinions expressed here represent my own and not those of my employer. For accuracy and official reference refer to MS Books On Line and/or MSDN/TechNet.
My employer do not endorse any tools, applications, books, or concepts mentioned on the blog. I have documented my personal experience on this blog.