Business Central OnPrem sync-navtenant: the operation could not complete because a record was locked

techniquetechnique Posts: 14Member
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!?

Best Answers

  • techniquetechnique Posts: 14
    Accepted Answer
    Slawek_Guzek - you are bang on the money thank you so much!!! :smile:

    When you open the old database with the new CU02 client and NAV performs the automatic database upgrade task it is enabling change tracking on the following tables...

    Add-in
    Object Metadata
    NAV App Object Metadata
    NAV App Tenant App
    NAV App
    NAV App Publish Reference
    Debugger Breakpoint

    By resetting these and turning off Change Tracking I can solve my issue.

    I think this is a bug with Cumulative Update 2 as this doesn't occur with CU1 and I can't see why MS would make such a (stupid) deal breaking change...

Answers

  • SanderDkSanderDk Posts: 163Member
    What about in the SQL server?
    Is anything using the NAV database?

    Try running:
    Sync-NAVTenant -ServerInstance 'XXX' -Mode CheckOnly -Verbose
    if not error occurred then
    Sync-NAVTenant -ServerInstance 'XXX' -Mode ForceSync -Verbose
    For help, do not use PM, but use forum instead, perhaps other people have the same question, or better answers.
  • techniquetechnique Posts: 14Member
    Thanks but it now appears to be data related as I just exported all objects into a copy of the Demo DB from CU2 and everything works! So now I'm going to backup my working CU1 company, attempt to import it into CU2 and report back...
  • techniquetechnique Posts: 14Member
    Import failed.

    SanderDk- I've just tried your suggestion and the CheckOnly executes fine, no errors but the ForceSync fails with the same message as before 'a record was locked by another user' :(

    What can I try now?
  • SanderDkSanderDk Posts: 163Member
    If you go to SQL Management Studio and look in the activity monitor does any thing else using the database?
    For help, do not use PM, but use forum instead, perhaps other people have the same question, or better answers.
  • LCostaLCosta Posts: 27Member
    Check if the database ins't in single-user mode.
  • techniquetechnique Posts: 14Member
    Accepted Answer
    Slawek_Guzek - you are bang on the money thank you so much!!! :smile:

    When you open the old database with the new CU02 client and NAV performs the automatic database upgrade task it is enabling change tracking on the following tables...

    Add-in
    Object Metadata
    NAV App Object Metadata
    NAV App Tenant App
    NAV App
    NAV App Publish Reference
    Debugger Breakpoint

    By resetting these and turning off Change Tracking I can solve my issue.

    I think this is a bug with Cumulative Update 2 as this doesn't occur with CU1 and I can't see why MS would make such a (stupid) deal breaking change...
  • TallyHoTallyHo Posts: 161Member
    edited 2019-01-29
    I'm trying to upgrade from nav2016 to CU03. The error
    'The operation could not complete because a record was locked by another user' when executing
    sync-navtenant still occurs.

    I tried to solve this by disabling changetracking as explained in previous post.
    It seems to work fine, I can disable change tracking for the database after disabling it
    for the 7 tables.

    But now the following error pops up after sync-navtenant:
    Change tracking is not enabled on table 'dbo.Object Metadata'.

    Is this new to CU03, or am I missing something here?

    .. After some searching I found out that the classic client sets the values during the upgrade.
    AND the servicetier resets them at start-up. So disabling them in sql server is useless now.
    Also sync-navtenant checks if the settings are on. No way around it anymore.

    Hopefully this is a setting in the serverconfig file, but I haven't been able to find it yet.
  • TallyHoTallyHo Posts: 161Member
    edited 2019-01-30
    The solution for upgrading to CU02 and CU03 was not disabling Change tracking for me.

    After
    Task 6: Convert the old database to the Business Central format

    Perform the following:

    -Start BC130 servicetier
    -Open development environment as admin
    -Compile all system tables (2000000000..) with the force (locked by another user error appears at company
    table)
    -Compile all system tables with force again (the error is gone)
    -Stop BC130 servicetier

    continue upgrade as usual.
    Change tracking was never disabled.

Sign In or Register to comment.