What happened??

A while ago I tried to update some of our CRM organizations to the latest version of 0.1 and faced some troubles. The installer for the update seemed to have been successful, but the actual version of the organization according to Deployment Manager was the old one. When I tried to update I got an error message. I didn’t have time to check it out then, but today I had to because it stopped me from importing solutions into the testing environments.

Getting more info

So first I recreated the issue. Simply trying to update the CRM Organization via Deployment Manager triggered the error again.

It starts out nice and friendly and says everything will be ok.


But then it spits out a Failed message and points to the logs.


The logs have a very cryptic message:

1
2
3
4
5
Error| Installer Complete: OrganizationDatabaseHotFixer - Error encountered
Error| Exception occured during Microsoft.Crm.Tools.Admin.OrganizationDatabaseHotFixer: Error.ActionFailed Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction
InnerException:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Data.SqlClient.SqlException: The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction.
Uncommittable transaction is detected at the end of the batch. The transaction is rolled back.

The solution

After quite a bit of googling I managed to find a community forum post about this: https://community.dynamics.com/crm/f/117/t/158085

Thanks to the kind Johnny Rossi, who posted the solution provided to him by MS via opening a ticket, we all have a resolution!

Pretty quick actually after you know where to look and what to do:

  • Make a backup of the file MetadataDiffs.xml from “C:\Program Files\Microsoft Dynamics CRM\Setup\Serviceability\Latest\Actions_Org\Install”

  • Open the file MetadataDiffs.xml from “C:\Program Files\Microsoft Dynamics CRM\Setup\Serviceability\Latest\Actions_Org\Install”

  • Remove the entry about the index “cndx_BusinessDataLocalizedLabel”. This is found at the very end of the file:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    <index Name="cndx_BusinessDataLocalizedLabel">
    <EntityId>4ba1569e-3c9c-4d9f-99ea-b61fb08d7f97</EntityId>
    <IsClustered>1</IsClustered>
    <IsUnique>1</IsUnique>
    <IndexType>6</IndexType>
    <IsPrimaryKey>0</IsPrimaryKey>
    <attributes>
    <attribute AttributeId="d88e1df3-b5b3-42f3-9ffa-007f22951dd4" IsSystemManaged="1" order="0" />
    <attribute AttributeId="bb23d3c8-8d18-40d3-9519-66101a8cae34" IsSystemManaged="1" order="1" />
    <attribute AttributeId="976e1053-5faa-4c3f-be6e-669acfec9d5a" IsSystemManaged="1" order="2" />
    <attribute AttributeId="e81341c4-4d4a-4977-98eb-6597fcde2cc4" IsSystemManaged="1" order="3" />
    </attributes>
    </index>
  • Restart Deployment Manager if it’s open

  • Start the organization update from Deployment manager.

  • This time you should get the Successfully Updated message:

  • Run the following query on the organization DB to manually recreate the index.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    IF EXISTS (SELECT * FROM sys.indexes WHERE name = 'cndx_BusinessDataLocalizedLabel' AND OBJECT_NAME(object_id) = 'BusinessDataLocalizedLabelBase') DROP INDEX [cndx_BusinessDataLocalizedLabel] ON [BusinessDataLocalizedLabelBase];

    IF NOT EXISTS (SELECT * FROM sys.indexes WHERE NAME = 'cndx_BusinessDataLocalizedLabel' AND OBJECT_NAME(object_id) = 'BusinessDataLocalizedLabelBase')

    BEGIN TRY

    CREATE UNIQUE CLUSTERED INDEX [cndx_BusinessDataLocalizedLabel] ON [BusinessDataLocalizedLabelBase]([ObjectId] ASC, [ObjectIdTypeCode] ASC, [ObjectColumnNumber] ASC, [LanguageId] ASC) WITH (FILLFACTOR = 80, MAXDOP = 4, SORT_IN_TEMPDB = ON, ONLINE = ON)

    END TRY

    BEGIN CATCH

    CREATE UNIQUE CLUSTERED INDEX [cndx_BusinessDataLocalizedLabel] ON [BusinessDataLocalizedLabelBase]([ObjectId] ASC, [ObjectIdTypeCode] ASC, [ObjectColumnNumber] ASC, [LanguageId] ASC) WITH (FILLFACTOR = 80, MAXDOP = 4, SORT_IN_TEMPDB = ON)

    END CATCH
  • Restore the file MetadataDiffs.xml to its original state using the backup taken at step 1.

That’s it. Hopefully managed to make your day a bit better…