Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Business Central On-Premises sync-navtenant error: the operation could not complete because a record was locked by another user

Posted on by 45

I've just recently upgraded from CU1 to CU2 of Business Central on-premises and now I can't synchronise the schema via Powershell & the NAV RTC will not run at all. 

The error makes no sense as I've closed all sessions and other than the BC130 service nothing is accessing the database (other than my Powershell command).

The exact error is:

sync-navtenant : The operation could not complete because a record was locked by another user. Please retry the activity.

At line:1 char:1
+ sync-navtenant bc130
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (0:Int32) [Sync-NAVTenant], NavCommandException
    + FullyQualifiedErrorId : MicrosoftDynamicsNavServer$bc130,Microsoft.Dynamics.Nav.Management.Cmdlets.SyncNavTenant

This worked fine in CU1 but I have to use CU2 so I have the latest objects and application for 'Making Tax Digital'.

In CU2 I can still compile the tables 'with validation' perfectly. 

But attempting to run the RTC produces the following error: 'The system is not accessible'.

This is a very frustrating show-stopper as I have no clue what is causing this & can't get past it.  PLEASE help!?

*This post is locked for comments

  • Suggested answer
    Maria Rusu Profile Picture
    Maria Rusu on at
    RE: Business Central On-Premises sync-navtenant error: the operation could not complete because a record was locked by another user

    Please see this blogpost about most probable cause you would hit this issue: community.dynamics.com/.../technical-upgrade-to-business-central-cumulative-updates-02-05-tenant-synchronization-issue

  • ekeukens Profile Picture
    ekeukens 60 on at
    RE: Business Central On-Premises sync-navtenant error: the operation could not complete because a record was locked by another user

    Thanks for your quick reply.

    It took me a long time as well. Part of our solution is to check things at source side as well. We upgrade from NAV2017 CU17. Customers started at NAV2017 CU3. I added recompiling system tables and syncing existing schema in source side as well, because when you just start on any NAV2017 database this is not Always going to work out. So maybe you can check/sync/upgrade in source side first?

    I know workaround of NavDataExport. But can't use this for customer database upgrades.

    We do not have any customization in system tables (200000000..). So I would like to know what kind of data could be lost in system tables [200000000..] if we use force option. So waiting for confirm of MS (Can we use this force option in compiling system tables when upgrading customer production databases?).

  • Rene Gayer Profile Picture
    Rene Gayer 7,564 on at
    RE: Business Central On-Premises sync-navtenant error: the operation could not complete because a record was locked by another user

    Forcing schema-sync depends on data. You can force as often you like, as you are aware of what happens with data..

    However, good to know that your steps works for you. :)

    I recompiled more than one time, with PowerShell and with the client. I also replaced all system tables to be sure everything is fine. I started the schema-sync more than one time  and a lot more :(

    However, it seems like there is some issue around it depending on data. I was in touch with Microsoft today, and they are aware of the issue. They don't know yet what is the reason.

    But if we have some workarounds, like yours and mine we can continue :)

    btw Update 4 is coming soon :)

    Rene

  • ekeukens Profile Picture
    ekeukens 60 on at
    RE: Business Central On-Premises sync-navtenant error: the operation could not complete because a record was locked by another user

    It seems I've struggled into some kind of work around.

    It is related to the compile system tables (see above). In my case I need to run this twice (and ignore error messages in the first attempt).

    We always used compiling system tables in upgrade procedure (but only the [later] option).

    The second thing I needed to do was add [NavServerName] and [NavServerInstance] in the compile cmdlet. We never used these in this process (even if instance was required in the past, because if there's a server running it shouldn't be necessary). So it looks like this sequence (create/start server and force twice with adding instancename) is working towards a synchronized schema (see example below, green lines is script running OK):

    I've asked Microsoft if it is OK to use Force twice at customer database upgrades.. Waiting for answer..

    2019_2D00_02_2D00_11-10_5F00_51_5F00_02_2D00_Window.png

     

  • Suggested answer
    Rene Gayer Profile Picture
    Rene Gayer 7,564 on at
    RE: Business Central On-Premises sync-navtenant error: the operation could not complete because a record was locked by another user

    Hi all, I tried all your ideas, no success. For me this helps:

    www.dynamicsblog.at/sync-navtenant-the-operation-could-not-complete-because-a-record-was-locked-by-another-user-please-retry-the-activity

    ("My solution" at the end of the post)

    /Rene

  • RE: Business Central On-Premises sync-navtenant error: the operation could not complete because a record was locked by another user

    Same problem here!

    - CU01 = No Problem

    - CU02 and CU02 has the Sync-NAVTenant problem:

    "The operation could not complete because a record was locked by another user. Please retry the activity"

     

    What I tried:

    1. Compile System Tables in Development Client : ID=2000000000.. twice

    First time I get the same error: 

    "The operation could not complete because a record was locked by another user. Please retry the activity"

    Second time I don't get this error.

    But the Sync-NAV-Tentant still give this error.

    Also restart and wait a long time does not fix this error

    2. Disable Change Tracking as suggested on mibuso

    But than I get this error:

    Sync-NAVTenant : The following SQL error was unexpected:Change tracking is not enabled on table 'dbo.Object Metadata'.

    3. Sync with option

    -Mode ForceSync

    -CommitPerTable

    4. Sync with CU01

    Then I don't get the error, after sync it and change back to CU02/CU03 I got the same error again. So we cannot go live with it


    ...nothing helps me.

    Please Microsoft can you fix this problem, not with a workaround but a solid repeatable fix.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Business Central On-Premises sync-navtenant error: the operation could not complete because a record was locked by another user

    It's too bad if it doesn't work for you. otherwise, just give it a try. I didn't'have full confidence if this would work, but it did.

    Don't depend on it to be resolved quickly.

    Using theire quote : "Parallel to this we are trying to invest more in our repro, and see if we can involve our product team on it soon"

    It doesn't look like it's  having theire utmost priority, because of the given quickfix.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Business Central On-Premises sync-navtenant error: the operation could not complete because a record was locked by another user

    I agree. I tried doing force and I still get the errors. I am also waiting for MS support.

  • ekeukens Profile Picture
    ekeukens 60 on at
    RE: Business Central On-Premises sync-navtenant error: the operation could not complete because a record was locked by another user

    Not sure if this is the solution. I'm aware of compiling systems tables. I wonder why they say "sometimes also the sync with force is the ultimate solution here", because we deliver 1 standard upgrade script for all databases/customers. So ther emust be 1 fixed procedure.

    To me it looks there's a difference in CU1 and CU2 (and up). I'm waiting for more comments of MS team on yammer..

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Business Central On-Premises sync-navtenant error: the operation could not complete because a record was locked by another user

    Received an answer from microsoft, and got it working again:

    "The way we saw how to work around this, is simply if you can make sure, with a fresh backup of this databse after converting it in the new version, and directly compile and synchronize system tables before doing anything else, sometimes also the sync with force is the ultimate solution here. Once you do this with the system table first, the rest should not be an issue."

    So after converting, compile the system tables with force first before continuing your upgrade script.

    But be aware, when doing the actual upgrade with "Start-NavDataUpgrade -ServerInstance <instancename> " , I received several "a record was locked by another user" errors. I had to resume the Upgrade several times, and also remove all add-in records.

    Check why the upgrade faildes with Get-NavDataUpgrade -ServerInstance <instancename> -ErrorOnly. And also try to resume the upgrade from the developer environment.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans