If there is an error during Mount-SPContentDatabase operation:

Mount-SPContentDatabase completed with errors


and in upgrade logs(“C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS\”) there is something like

Exception: The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name ‘dbo.AllDocStreams’ and the index name ‘AllDocStreams_CI’. The duplicate key value is (71d46679-4432-4fbf-b6c3-2988c42d2858, c6398b61-8d07-4b04-978b-23dff256e6ac, 34).

then You need to connect to MS SQL database using SSMS, open target table and remove duplicated rows. Applying to above error, we can construct this query, where values in parentheses are SiteId(first guid), Id and InternalVersion respectively.

select * from dbo.AllDocStreams  where Id='c6398b61-8d07-4b04-978b-23dff256e6ac'  and InternalVersion='34'



As we see, query returned 15 records. In my case I deleted them all from database:

delete from dbo.AllDocStreams  where Id='c6398b61-8d07-4b04-978b-23dff256e6ac'  and SiteId='71d46679-4432-4fbf-b6c3-2988c42d2858' and InternalVersion='34'

Next restart upgrade operation from cmd:

"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN\PSCONFIG.EXE" -cmd upgrade -inplace b2b -force -cmd applicationcontent -install -cmd installfeatures

After this upgrade terminated successfully.

p.s.: You should ensure that You have enough empty space on Your hard drive(recommended value is x * 2, where x is Your SQL database size). This occurs because during upgrade all the files and their versions are moved from AlldocVerions to AllDocStreams, more info could be found here.

Click below to expand comments form..