Monsieur Winner

MS D365FO || Monsieur D365FO

D365foOn-premisesTechnical

Financial Reporting deployment fails with SQL error 1712 (ONLINE = ON) on SQL Server Standard – D365FO 10.0.46 on-premises

While updating a D365 Finance and Operations on-premises environment to 10.0.46, the servicing failed on the Financial Reporting (FR / Management Reporter) component with SQL error 1712: “Online index operations can only be performed in Enterprise edition of SQL Server”. The environment runs on SQL Server 2022 Standard Edition, which is a supported edition for on-premises. Here is what I found and how we got past it.

The symptom

In LCS, the update failed during the Financial Reporting deployment. On the orchestrator node, the AX-SetupModuleEvents → Operational log showed the FinancialReporting PublishDatabase step failing:

Financial Reporting deployment SQL error 1712 ONLINE = ON on SQL Server Standard
FR PublishDatabase fails with Msg 1712 while creating Reporting.RepositoryCleanupIndices
Microsoft.Dynamics.Performance.Deployment.Commands.Database.PublishDatabase | DatabaseDeployer error occurred.
Framework Microsoft SqlClient Data Provider: Msg 1712, Level 16, State 3, Procedure RepositoryCleanupIndices,
Line 11 Online index operations can only be performed in Enterprise edition of SQL Server or Azure SQL Edge.

You can pull the same errors with PowerShell on the orchestrator:

Get-WinEvent -LogName 'Microsoft-Dynamics-AX-SetupModuleEvents/Operational' -MaxEvents 500 |
  Where-Object { $_.Message -match '1712|ONLINE = ON' } |
  Format-List TimeCreated, Message

Root cause

The 10.0.46 FR package ships a database project, ManagementReporter.dacpac. During deployment, it creates a new stored procedure, [Reporting].[RepositoryCleanupIndices], which creates four indexes WITH (ONLINE = ON):

  • IX_ReportRow_ReportId on Reporting.ReportRow
  • IX_ReportReference_ReportId on Reporting.ReportReference
  • IX_ReportOutput_ReportId on Reporting.ReportOutput
  • IX_ReportUnit_ReportId on Reporting.ReportUnit

Online index operations are an Enterprise-only feature. On Standard Edition, SQL Server rejects them with error 1712, and the dacpac publish stops right there.

How to confirm it on your environment

1. Check your SQL Server edition and patch level

SELECT SERVERPROPERTY('Edition')            AS Edition,
       SERVERPROPERTY('ProductVersion')     AS Version,
       SERVERPROPERTY('ProductUpdateLevel') AS CU;

If it says Standard Edition, you are exposed to this error.

SQL Server 2022 Standard Edition license
The customer is licensed for SQL Server 2022 Standard only

2. Look inside the FR dacpac

A .dacpac is just a zip file. Find every ManagementReporter.dacpac in the FR package (in the agent file share, where LCS downloaded the update) and count the ONLINE = ON occurrences:

$root = '\\FILESERVER\agent'   # or the folder where the FR package was extracted
Get-ChildItem $root -Recurse -Filter 'ManagementReporter.dacpac' -ErrorAction SilentlyContinue |
  ForEach-Object {
    $tmp = Join-Path $env:TEMP ('dacpac_' + [guid]::NewGuid())
    Copy-Item $_.FullName "$tmp.zip"
    Expand-Archive "$tmp.zip" -DestinationPath $tmp
    $hits = Select-String -Path "$tmp\model.xml" -Pattern 'ONLINE\s*=\s*ON'
    [pscustomobject]@{ Dacpac = $_.FullName; OnlineCount = $hits.Count }
  } | Format-Table -AutoSize
ManagementReporter.dacpac contains the procedure with ONLINE = ON
Only ManagementReporter.dacpac contains the procedure: 4 ONLINE = ON statements
model.xml of ManagementReporter.dacpac with CREATE NONCLUSTERED INDEX WITH (ONLINE = ON)
The four CREATE NONCLUSTERED INDEX … WITH (ONLINE = ON) statements in model.xml

Solution 1: Patch SQL Server and retry in LCS

1. Patch SQL Server to the latest cumulative update

The SQL Server was still on RTM (16.0.1000.6). Before anything else, we installed the latest SQL Server 2022 cumulative update (CU27 at the time) on the database server. Running an on-premises ERP database on RTM is not a good idea anyway.

2. Retry the failed step in LCS

Then we simply clicked Retry on the failed servicing operation in LCS. To be honest, I expected it to fail again, because the dacpac still contains ONLINE = ON. It went through, Financial Reporting was deployed and the environment finished on 10.0.46.

I can’t tell you with certainty why the second run passed. What I can tell you is: patch SQL, then retry before you do anything drastic. If the retry doesn’t help, use Solution 2.

Solution 2: Update the job state in the orchestrator database

The second way through is to update the state of the failed job directly in the orchestrator database, OrchestratorData. It’s the same approach I described in Restore a failed deployment to initial state on LCS.

Back up OrchestratorData first. You are overriding what the orchestrator recorded, so only do this once you understand the failure (here, the FR ONLINE = ON issue) and you’ve confirmed the rest of the deployment is fine.

1. Get the latest JobId and RunbookTaskId

select * from OrchestratorJob order by LastProcessedDateTime desc
select * from RunBookTask order by StartDateTime desc

From OrchestratorJob, take the JobId of the failed servicing job. From RunBookTask, take the RunbookTaskId of the failed task: it ends with -setupModules.

2. Update the job and task state

update OrchestratorJob set [State] = 2 where JobId = 'XXXXTEST-e670b280-3249-4af1-aacc-fc55a48aaf95';
update RunBookTask set [State] = 2, [Order] = 6, Retries = 1 where RunbookTaskId = 'XXXXTEST-e670b280-3249-4af1-aacc-fc55a48aaf95-setupModules';

Replace the IDs with your own. Give the Local Agent a few minutes to pick up the change, then check the environment status in LCS.

This changes the status the orchestrator recorded; it does not redeploy anything. Afterwards, check that Financial Reporting actually works (open the Report Designer from D365 and run a report).

If neither works

  • Non-production (UAT/TEST): SQL Server Developer Edition has all the Enterprise features and is free for non-production use. Many teams use it for on-premises sandboxes.
  • Production: the clean options are SQL Server Enterprise Edition, or waiting for a fixed FR package from Microsoft.
  • Don’t edit Microsoft’s dacpac, and don’t drop or rename the FR database to “start clean”. You’ll create a bigger problem than the one you’re solving.

Key takeaways

  • SQL error 1712 means a statement used an Enterprise-only feature (here, ONLINE = ON) on Standard Edition.
  • In 10.0.46, it comes from [Reporting].[RepositoryCleanupIndices] in ManagementReporter.dacpac.
  • Check your SQL edition before you plan an update, and keep SQL Server on a current CU.
  • Patch, then Retry in LCS. That’s what got us through.
  • Second option: update the job state in OrchestratorData, after a backup.

Has anyone else hit this on Standard Edition? Tell me in the comments what worked for you.

Komi Siabi

Komi Siabi is a Bilingual D365FO Solution architect who loves sharing his knowledge as he works on Both Francophone and Anglophone projects around the globe. He enjoys doing some tiktok videos in his leisure time.

Leave a Reply