Saturday, March 23, 2013

AX 2012 R2 database synchronization error



When doing an install of AX 2012 R2 (clean) we were getting a synchronization error on two tables which were stopping things from proceeding. The two tables were part of the public sector code and were 'ADVANCEDLEDGERENTRYHEADER' and 'ADVANCEDLEDGERENTRYLINE'. The synch error was referencing an index error or some sort.

Issue: The issue was with the SourceDocumentHeaderIdx index on the 'ADVANCEDLEDGERENTRYHEADER' table and the SourceDocumentLineIdx index on the 'ADVANCEDLEDGERENTRYLINE' table. While not 100% sure what the issue was, I'm guessing that the data in the released Contoso demo data was made before the unique index change was put in place. See the missing indexes below in Figure 1.

Figure 1 - The missing indexes causing the issue

Resolution:  There are two possible resolutions that I have confirmed. If you don't care about the data, I'd recommend the first one:
  1.  Delete the two tables in SQL and resynchronize the database
    1. This removes the base data but at least the tables syncs without any modifications to the base AX objects 
  2.  Change the 'Allow Duplicates' property to 'Yes' on the appropriate indexes on those tables.
    1. Not sure what negative things this change will have but it resolves the issue and will retain the base data. I see how things could go wrong in the future but I don't know Public Sector so use this technique at your own risk.
THE ERROR:
Error        Synchronize database        Cannot execute a data definition language command on  ().
The SQL database has issued an error.
Info        Synchronize database        SQL error description: [Microsoft][SQL Server Native Client 10.0][SQL Server]The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo.ADVANCEDLEDGERENTRYHEADER' and the index name 'I_12156SOURCEDOCUMENTHEADERIDX'. The duplicate key value is (5637144577, psus).
Info        Synchronize database        SQL statement: CREATE UNIQUE  INDEX I_12156SOURCEDOCUMENTHEADERIDX ON "DBO".ADVANCEDLEDGERENTRYHEADER (PARTITION,DATAAREAID)
Error        Synchronize database        Cannot execute a data definition language command on  ().
The SQL database has issued an error.
Info        Synchronize database        SQL error description: [Microsoft][SQL Server Native Client 10.0][SQL Server]The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo.ADVANCEDLEDGERENTRYLINE' and the index name 'I_12157SOURCEDOCUMENTLINEIDX'. The duplicate key value is (5637144577, psus).
Info        Synchronize database        SQL statement: CREATE UNIQUE  INDEX I_12157SOURCEDOCUMENTLINEIDX ON "DBO".ADVANCEDLEDGERENTRYLINE (PARTITION,DATAAREAID)
Error        Synchronize database        Problems during SQL data dictionary synchronization.
The operation failed.
Info        Synchronize database        Synchronize failed on 2 table(s)

1 comment: