Tonight as it was happening a deployment of a package on latest version of Dynamics 365, it ended up with failure.


Upon checking the event viewer logs it showed issues in database synchronization, however the error shown in the event viewer, was something not very helpful. As per guidelines, I checked logs of Event Viewer, on AOS box, as well as on Orchestrator. It was on-prem topology so I was lucky to explore all logs.


The error message at time of failure was something as following.


Error - SqlStmt::execute()

Cannot insert record

Statement: Insert Into UserInfo(Id,.....



It is strange that nowhere my code is referring to UserInfo table (As far as I remember the developments done). Anyhow, further I went into the logs of AOS application directory, where it keeps all artifacts of the deployed application and in process work. This is usually on your primary OS drive, however this path can change depending upon how you installed your AX.




That was the path as per my installation.


Here within the logs, I sorted the files by last update date/time and opened the file in notepad. This showed exactly what is going on. Table Name and Query it was trying to run.


Finally executed manually on SQL server, what it was failing to do otherwise automatically (during package deployment), and proceeded ahead for redeployment.


This time it went error-free.


Summarizing it, there could be several different reasons for DB sync failure and solution can be different for each different situation. Watch logs all around and culprit should be in hand. Specifically for on-prem deployments, you have all the freedom to see your boxes