One of new procedures/functions we have in NAV 2013 R2 is “metadata synchronization”. It is process when object (table) description done in C\SIDE by NAV developer is applied to SQL object (object structure in SQL becomes the same as we have in NAV object designer).
It is described at http://blogs.msdn.com/b/nav/archive/2014/03/27/table-synchronization-paradigm-in-microsoft-dynamics-nav-2013-r2.aspx
Unfortunately synchronization step is not mentioned in some place, for example:
– after you convert database to NAV 2013 R2, just after you have opened database with NAV 2013 R2 C\SIDE client and received message “database conversion was successful” – run metadata synchronization;
– after you have created new database – run metadata synchronization
– in any case whatever you have done with objects – please run synchronization…
About synchronization process in details you can read at https://mbs.microsoft.com/files/partner/NAV/Support/HotTopics/SynchronizingSchemachangesNAV2013R2.docx
But rough description could be: in NAV we have 3 “parts” of the same object: SQL object, Object description in Metadata snapshot, Object description in Object metadata.
When synchronization runs, NAV compares object description in metadata snapshot and object metadata and if differences found then NAV tries to apply object description from object metadata to SQL object to make it as we see it objects designer in C\SIDE. When this is done, NAV updates object description in metadata snapshot and we have all 3 parts identical. So there must be no situation when SQL objects is not the same as object description in metadata snapshot.
To find theses inconsistency we have released NAV 2013 R2 database consistency checker tool” which checks database metadata vs database structure and reports any inconsistency which could be fixed directly in SQL. Mentioned tool is released under KB 2963997 and could be downloaded from hotfix site.
Metadata synchronization process is running by NAV Service Tier (NST) and it starts when
– any client (RTC, Web client, Web service) connect to NST
– or executed NAV Administration PowerShell cmdlet “Sync-NAVTenant”
– or user imports objects to object designer and option “Prevent data loss from table changes” is set to “Yes”.
Usually synchronization is fast process: we run RTC, connect to NST, synchronization starts and finishes and RTC loads.
However when we do “big changes” (added fields to table and few keys…) or have big databases, synchronization runs hours. I have cases where synchronization runs >3 hours and here comes problem: process runs in background, users are not aware about it and whatever they tries to do with db, they receives different errors (about channel failure; SQL timeout, service not responsive and etc.). Even worse user can stop NST and with this kills synchronization and then SQL starts rollback for next few hours…
When NAV shows that synchronization finished successfully (cmdlet finished) or NAV client shows error, it could be that SQL still continue to synchronize metadata in background (or rollback ). Run sp_who2 in SQL management studio to see if there are running/active processes where ProgramName is “Microsoft Dynamics NAV Service”. If there is not “sleeping” process and it’s DiskIO increase continuously, please wait and do nothing with NAV (don’t modify any object, don’t compile, don’t import – better close development environment at all). At some moment processes becomes “sleeping” – this means synchronization finished (successful or failed you can see in Windows Event Viewer). Only after that you can continue your further actions.
Our development team is preparing solutions which make metadata synchronization more transparent and user friendly, so we expect easier life soon, but now: Synchronize metadata and track synchronization, please…
These postings are provided “AS IS” with no warranties and confer no rights. You assume all risk for your use.
Microsoft Customer Service and Support (CSS) EMEA