PK violation importing an XML backup of a space
Asked by Mario Garcia:

Hi,

I have been struggling to get an xml export imported into a brand new 3.5.13 system. I have worked with Atlassian support but their involvement has been very limited because this version is no longer supported.

The export came from a system that has been running for a few year is Linux based and, is using ORACLE 11g as its database. The system that I am having trouble importing to is using MS SQL xPress 2008 R2. The DB server was built with case sensitivity (SQL_Latin1_General_CP1_CS_AS) as suggested in this article:

<https://confluence.atlassian.com/display/CONF35/Database+Setup+for+SQL+Server>

The DB is running on the same box as the Confluence application. I set up the connection as JDBC, here is the connection string: jdbc:jtds:<sqlserver://msp0weiat001.etdbw.com:1433/confluence>

The Confluence server that I am having trouble importing to is a Windows 2008 R2 SE SP1 64bit. This is a brand new install with no existing data other than what comes default with the installer.

Related Link to KBase article I found:

<https://confluence.atlassian.com/display/CONFKB/Unable+to+Import+Space+due+to+Primary+Key+Constraint>

The export was done using an admin account and the include all files option was selected. Also, Atlassian support was able to import the file without issue so it appears to be something either with the DB server or my installation.

The error I am seeing during the import process:

Import failed. Check your server logs for more information. Hibernate operation: could not insert:

[com.atlassian.confluence.core.BodyContent#617027](https://support.atlassian.com/servicedesk/customer/portal/14/CSP-135414#617027); SQL \[\]; Violation of   
PRIMARY KEY constraint 'PK_*BODYCONT* _D49B339249C3F6B7'. Cannot insert   
duplicate key in object 'dbo.BODYCONTENT'. The duplicate key value is   
(617027).; nested exception is java.sql.SQLException: Violation of PRIMARY   
KEY constraint 'PK_*BODYCONT* _D49B339249C3F6B7'. Cannot insert duplicate   
key in object 'dbo.BODYCONTENT'. The duplicate key value is (617027).

<br />

Any insight into what may be happening here will be greatly appreciated.


Answers:
author: Deividi Luvison
body: Hey Mario,

When I got a similar case to this with other 5 customers I made the following actions:

1. Ask then to set up a staging environment.
2. Upgrade their confluence from 3.5.\* to 5.0.3 and then latest version with current database.
3. Then generate the export and try importing again.

From 5 of those cases 4 were able to import fine (some of our upgrade tasks addressed the inconsistencies), the last one we needed to further troubleshoot the database.

We do not support EOL versions (as you already know), however since we are having troubles on that version one approach I like to use is to bring the fight to a familiar ground (Confluence 5 series), if we do that we gonna have further troubleshooting options to try ![laugh](/html/@BEA1CC333F4D830F5303329D7DC07DE4/images/emoticons/laugh.png "laugh").

I will add myself as a watcher in your case, if you agree with that plan let me know trough here so I can assist the assigned engineer.

Thanks and Regards,  
David\| The Engineer that like Windows for realsies.


Tags: confluence-administration