Monday, December 1, 2025

Dive: Understanding State and Status in the Orchestrator Database

Deep Dive: State and Status in D365 On-Premise (LBD)

Deep Dive: Understanding State and Status in D365 On-Premise (LBD)

In Dynamics 365 Finance & Operations On-Premises (LBD), troubleshooting often requires looking at two independent layers:

  • The Logical Layer (Orchestrator Database)
  • The Physical Layer (Service Fabric Cluster)

Part 1: The Logical Layer (Orchestrator DB)

The Orchestrator defines what should happen. Its core table is Deployment. The state machine here represents the “intended plan.”

1. DeploymentState (What stage are we in?)

These states follow a generally linear lifecycle.

stateDiagram-v2 [*] --> Undefined Undefined --> Preparing: User Clicks Deploy Preparing --> Downloading: Local Agent downloads package Downloading --> Prepared: Package Ready Prepared --> Deploying: Orchestrator starts SF actions Deploying --> Active: Successful Deployment Deploying --> Inactive: Failed Deployment Active --> Deleting: Removing Environment Deleting --> Deleted
Figure 2: Expected flow of Deployment States.
IDState NameDescription
7DownloadingLocal Agent is downloading packages. If stuck, Agent or storage connectivity may be the issue.
2DeployingOrchestrator is executing deployment actions in Service Fabric.
1ActiveEnvironment is deployed and running.

2. DeploymentStatus (How is it going?)

Status indicates whether the Orchestrator encountered errors:

  • None (0): Normal operation.
  • Failed (2): A deployment step failed.
  • StateTransitionIncomplete (3): A state change failed; deployment is stuck.

Part 2: The Physical Layer (Service Fabric)

When the Orchestrator is stuck in Deploying, it is usually waiting for Service Fabric to complete service or replica transitions.

graph TD Cluster --> Node1 Node1 --> Application Application --> Service Service --> Partition Partition --> R1[Replica 1] Partition --> R2[Replica 2] style R1 fill:#ffcccc,stroke:#333,stroke-width:2px style R2 fill:#ccffcc,stroke:#333,stroke-width:2px
Figure 3: Service Fabric Health Hierarchy. A single unhealthy replica (Red) can block Orchestrator transitions.

ReplicaStatus (Common physical blocker)

  • InBuild: Node is copying data; can be slow if network or disk is slow.
  • Standby: Replica assigned but not active.
  • Ready: Replica is healthy and active.

Troubleshooting: Safe SQL Queries

Run ONLY on: OrchestratorDB

Step 1: Check last Orchestrator Command

Confirms whether the system received your deploy/download click.

SELECT TOP 5 
    Id,
    CommandType,   -- 1=Deploy, 9=Download
    CommandStatus, -- 0=Init, 4=Processing, 2=Processed, 6=Failed
    CreatedDateTime,
    ModifiedDateTime
FROM OrchestratorCommand
ORDER BY CreatedDateTime DESC;

Step 2: Check Deployment State

SELECT TOP 1 
    Id,
    DeploymentState,  -- e.g. 7=Downloading, 2=Deploying
    DeploymentStatus
FROM Deployment;
-- Use WHERE Id='your GUID' if multiple environments exist

Step 3: Join with OrchestratorCommand

SELECT TOP 5
    d.DeploymentState,
    c.CommandType,
    c.CommandStatus,
    c.JobDescription

No comments:

Post a Comment

Search This Blog