One of the many great features Microsoft added into Office SharePoint Server 2007 is Content Deployment. This essentially allows you to have an Authoring Farm where the content is created and modified, a Staging Farm where the content can be tested and reviewed, and a Production Farm where the intended audience will view the finalized content.
I won't get into the specifics of how you configure content publishing, as we can save that for a later date if necessary. The issue arose just a few weeks after the initial site deployment. I received and email stating that my nightly content deployment job failed. Looking at the Job Report, I saw the following errors:
Content deployment job 'Job_Name' failed. The exception thrown was 'System.Data.SqlClient.SqlException' : 'Violation of PRIMARY KEY constraint 'PK__#ExportObjects____4A74B2AE'. Cannot insert duplicate key in object 'dbo.#ExportObjects'. The statement has been terminated.'
Violation of PRIMARY KEY constraint 'PK__#ExportObjects____4A74B2AE'. Cannot insert duplicate key in object 'dbo.#ExportObjects'. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Microsoft.SharePoint.Utilities.SqlSession.ExecuteNonQuery(SqlCommand command) at Microsoft.SharePoint.Deployment.SPExport.CalculateObjectDependencies(Boolean linksOnly) at Microsoft.SharePoint.Deployment.SPExport.FollowLinks() at Microsoft.SharePoint.Deployment.SPExport.CalculateObjectsToExport() at Microsoft.SharePoint.Deployment.SPExport.Run()
In the interim, I was able to work around the issue until I found the correct solution. This was done by running a "Full Deployment". This at least published out my changes, but it was definitely a pain to have to do this every time Marketing made changes (sometimes several times a day). After some rigorous searching, I stumbled upon the Microsoft KB Article 950279 which solved all my problems. Turns out, the issue is caused by versioning for a library on the deployed site. For some reason, the versions get muffed and you start to receive the above errors when the content tries to publish.
A few things to note, there are two versions of this hot fix, pre-SP1 and post SP1. I found this out when I obtained the Hotfix from KB Article 936867 and could not install it in our environment. It stated that I did not have the correct version of the software installed on the machine. Also, when installing the Hotfix, I would suggest backing up your databases before hand. The last thing you want to do is mess up your SharePoint configuration and have to start from the ground up. As well, follow the "Deploy software updates for Office SharePoint Server 2007" guide to a T. Essentially it states, the Hotfix must be installed on all servers in your farm. Start by installing the Hotfix on your server that hosts the Central Admin. Run the SharePoint Configuration Wizard to the point where it prompts you to install the Hotfix on the other servers in the farm. Install and complete the configuration on the other servers and then return back to the Central Admin Server. Click Ok on the prompt to continue and finish the configuration.
Just to follow up, I have been checking the status of our content deployments over the past few days since I installed the Hotfix. This definitely extends beyond my Irish blood when I say, I love seeing green! (Figure 1)
Figure 1